Menu

Problems with FF5.0 PIC18F4550 USB

2016-05-09
2020-07-26
  • Leonardo Alvarez

    Hi all,

    I recently started using FF5.0 with PIC18F4550 through USB.
    I managed to install FF5.0 following the installation notes and I use Tera Term for the serial communication through USB.
    But I could not run any of the examples provided for pic18, even the simple blink.

    I attach a screenshot of the blink example loaded into the terminal.

    [url=http://postimg.org/image/cp2089si9/full/][img]http://s32.postimg.org/m9lmv5hud/Flash_Forth_PIC18_F4550_USB.jpg[/img][/url]
    [url=http://postimage.org/index.php?lang=spanish]sube fotos[/url]

    As can be seen, the interpreter does not recognize some of the commands.

    What I am doing wrong?
    I hope that someone can help me.

    Best regards,

    Leonardo.

     

    Last edit: Leonardo Alvarez 2016-05-09
  • Mikael Nordman

    Mikael Nordman - 2016-05-10

    Strange that it does not reognize the marker word.

    It seems that FF cannot find any of the words that you have defined yourself.
    EMPTY resets the dictionary pointers to default values.

    Does this basic functionality work ?

    empty warm
    -test
    marker -test
    1234 constant test
    test

    BR Mikael

     
  • Mikael Nordman

    Mikael Nordman - 2016-05-10

    The 8blink in your screenshot is not the simplest one.
    It requires that task.txt is loaded before.

    Then 8blink blinks 8 leds, each in its own background task.

    BR Mikael

     
  • Leonardo Alvarez

    Hi Mikael

    Thanks for your response.

    I attach the screen capture of the terminal output for the basic functionality you suggested.

    As you may see, it seems the basic code does not work. Also it shows some unexpected numbers.

    What could be the problem?

    Regards,

    Leonardo.

     
  • Mikael Nordman

    Mikael Nordman - 2016-05-10

    It could be I have introduced some bug.
    It take a few days to check it.

     
  • Leonardo Alvarez

    Oh, what a pity.
    I hope you can fix it.
    If you need that I run some other tests on the PIC18F4550, let me know.
    I will keep in touch.

    Regards,

    Leonardo.

     
  • Mikael Nordman

    Mikael Nordman - 2016-05-10

    I tested the latest code with pic18f2550 and the USB interface.

    It worked just fine. I use the 12 MHZ crystal.

    I compile with MPLABX and the only change to the PIC18_USB project is to include the correct device library file.

     
  • Leonardo Alvarez

    Hi Mikael

    Thanks for you response.
    Here I attach a capture of the MPLABX complete project. I think that all the correct files are included. The project compile without a problem. I am also using a 12MHz crystal.

    [url=http://subefotos.com/ver/?5330d7b9801eb913adacf480dca71d52o.jpg][img]http://thumbs.subefotos.com/5330d7b9801eb913adacf480dca71d52o.jpg[/img][/url]

    I have followed all the install instructions and re-programed the PIC18F4550.
    But as you may see in the next attached image, the behaviour is somewhat inconsistent. Yes, at the end execute the code, but it does a lot of extrange things in between.

    Putty Terminal Capture

    [url=http://subefotos.com/ver/?cdaec8a4943d355aed4a41dc37cc4ddao.jpg][img]http://thumbs.subefotos.com/cdaec8a4943d355aed4a41dc37cc4ddao.jpg[/img][/url]

    TeraTerm Terminal Capture

    [url=http://subefotos.com/ver/?c1d11dae93518e99e9262ca02531a40co.jpg][img]http://thumbs.subefotos.com/c1d11dae93518e99e9262ca02531a40co.jpg[/img][/url]

    I have checked under the Windows Device Manager the virtual com configuration and is ok (Baudrate 38400, 8bits, 1 stop, etc).

    I will try with a PIC18F2550 microcontroller. If still resists to work thru USB, I will try by USART.

    By the way, I am using Windows 7 x64.

    Regards,

    Leonardo.

     
  • Mikael Nordman

    Mikael Nordman - 2016-05-11

    You are not using the latest FF.
    I created a new ZIP file for download just a while ago.
    The GIT repository had a bit newer code.

    I tried your version and it worked too.

    Have you activated HW flow control in TeraTerm ?
    Your download of Forth code that overflows indicates the maybe the flow control does not work.

    I am using Linux.
    Could you attach your zipped FF project to a message or mail them to me.
    oh2aun@gmail.com

    The AD? message indicates that kernel write protection is on.
    Are you using the bootloader or how are you porgramming the chip ? Pickit ?

    Try also this:
    empty
    warm
    fl+
    1234 flash here !
    flash here @ .
    ram

     
  • Leonardo Alvarez

    Hi Mikael

    I think I found the problem! I think it was the MPASM/MPLINK version!
    I was using the MPASM V5.50, I changed to MPASM V5.64 and now it seems to work ok.
    I have downloaded the latest version from Github. I attach an image showing the success!

    Sorry for the inconvenients.

    Thank you very much for your support.

    Regards,

    Leonardo.

     
  • Leonardo Alvarez

    Hi all

    After a few years I return to FF.

    Download the latest version for pic18 (04/01/2020), configure the project, compile the code and upload it to the microcontroller.
    But I am having issues with the interpreter. The problem is similar to the one I had in 2016, but with the exception that it recognizes some commands / words, but not others.

    I attach an image where you can see the problem.

    I am using the following parameters:

    • FF 5.0 release 01.04.2020 for PIC18
    • USB CDC Emulation Operator Task
    • PIC18F4550 - 40DIP
    • MPLABX 5.10
    • MPASMWIN 5.82
    • CoolTerm as terminal
    • Windows 10 x64

    What is the version of MPLABX, MPASMWIN and Windows that you recommend to be able to compile the latest version of FF 5.0?

    I hope you can help me!

    Thanks in advance.

    Regards,

    Leonardo.

     
  • Mikael Nordman

    Mikael Nordman - 2020-07-23

    The versions of MPLABX and MPASMWIN have not made any difference for the chips you are using. I am currently using MPLABX 5.35 and MPASM 5.87.
    I cannot say anything about the Windows versions.

    With USB you should be using CTS/RTS flow control in the terminal program. Not XON/XOFF which you seem to have active as can be seen from your screenshot.
    But I don't think that has anything to do with your problems.

    Could you attach the MPLABX map and listing files from a debug compilation so that I can check for problems. These files can be found in
    FF_USB.X/dist/default/debug/FF_USB.X.debug.map
    FF_USB.X/disassembly/listing.disasm

     
  • Leonardo Alvarez

    Hi Mikael!

    Thanks for your response!

    I attach the requested files.

    Regards,

    Leonardo

     
  • Mikael Nordman

    Mikael Nordman - 2020-07-24

    I cannot see anything wrong in those files.

    The first . ? after warm happens to me also but afterwards everything is working fine.
    But it is a bug caused by some extra random character in the input buffer.

    The marker without a parameter should return a question mark instead of ok .
    In your case it does not. So that is a mystery.

     

    Last edit: Mikael Nordman 2020-07-24
  • Leonardo Alvarez

    Hi Mikael

    Thanks for your response!

    I have been doing further testing and cannot get it work!

    I attach an image with the test in the FlashForth Shell in Debian 10. As you may see, the problem still is there. Looking at the image you can see that some words are recognized, and other no.

    I used MPLABX 5.1, 5.2 and 5.35 to compile the project, and Pickit3 and Pickit4 to program two different integrated circuits (installed in totally different PCB boards). None of them worked as spected.

    A wird thing is that with pickit4 programming the firmware crashes and only outputs "FlashForth 5.0 PIC18F4550 01.04.2020" all the time you send any command.

    I have used Coolterm, TeraTerm, Putty and FlashForth Shell with the recommended parameters (38400,8,N,1, rts/cts) and all exhibit the same behaviour.

    I have to try use Operator Task via UART to complete the tests.

    Could you give me a hint on how to continue?
    Do you have a previous release of FF5.0 for PIC18 to test?

    Thanks in advance, and sorry for the inconvenience.

    Regards,

    Leonardo

     
  • Mikael Nordman

    Mikael Nordman - 2020-07-24

    Could it be a character set issue ?
    FlashForth expects word names to be in US ASCII (0x20-0x7e) .

    Apparently marker without a parameter contains some unvisible byte as a parameter since the response is ok<#,ram> instead of ?.

    If that unvisible byte has bit 7 set, it messes up the dictionary searches of user defined words.
    Core word searches would still be unaffected.
    So this is maybe a wrong theory....

    You could try these commands
    empty
    warm
    enter
    words
    marker
    hex
    2700 20 dump

    what is the result of the dump ?

     

    Last edit: Mikael Nordman 2020-07-24
  • Mikael Nordman

    Mikael Nordman - 2020-07-24

    Is the USB connection stable ?
    If you look at dmesg in linux, does the USB connection stay up ?
    Are there any USB error messages ?

     
  • Leonardo Alvarez

    Hi Mikael

    After several tries, I was able execute the commands you indicate me.
    I attach two images of TeraTerm in Windows 10.
    The first one is the test with the flashforth image from this morning tests.
    The second one is the test with a fresh flashforth install. Also execute the commands below to see the generated changes in dump.

    marker -test (enter)
    1234 constant test (enter)
    2700 20 dump (enter)
    test (enter)

    USB connection remains stable on Windows and Linux. There are no USB error messages. Although, it is possible to observe that sometimes TeraTerm loses synchronism and throws garbage characters on the screen (See attached image).

    Regards,

    Leonardo

     
  • Leonardo Alvarez

    Maybe it's just a terminal sync problem with FlashForth? Or a character set?
    I don't know, I'm a little lost. I can't find the reason why it doesn't work.

     
  • Mikael Nordman

    Mikael Nordman - 2020-07-25

    For me my boards have worked reliably. On Linux and W7. I can try W10 later today.
    I have been using the 2455, 2550, 14k50 chips. From FF and USB perspective 4550 should be identical to 2550 and 2455.

    Do you have a circuit diagram of your boards. Are the boards commercial or hombrew ?
    Is the USB filter capacitor of good quality? Is the crystal on frequency ?
    Is the power supply bypass filtering good ?
    Have you tried with different USB cables ?
    Do you have the 22 ohm resistors installed in the D+ and D- leads ?
    Have you tried disabling all power saving features on the PC ?
    Have you tried with different PCs ?

     
  • Mikael Nordman

    Mikael Nordman - 2020-07-25

    The serial 22 ohm resistors in the D+ and D- leads seems extra. At least the datasheet does not mention them. But I have used them on my boards. Proably just copied from some old design.

     
  • Leonardo Alvarez

    Hi Mikael

    Shame on me!
    I followed your advice and I buy a new USB cable. Problem solved!
    Now FlashForth works like a charm on both of my PIC18f4550 boards on Windows and Linux.

    I trusted the USB cable, I did not suspect that it did not work, since it connected correctly to USB and transferred data without problems (at first glance) and did not report a device error in Windows and Linux. My bad, sorry.

    I do not know what I was thinking of. I have complicated the situation too much, I apologize for make you wasting your valuable time in this nonsense!

    Again, sorry for the inconvenience!

    Thank you very much for your support.

    Regards

    Leonardo

     
  • Mikael Nordman

    Mikael Nordman - 2020-07-26

    Hi Leonardo,
    Great that you finally fixed it !
    BR Mikael

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.