FORTH on the PicoCalc

Still doesn’t work. I did invoke picocalc-term::picocalc-term-internal::picocalc-welcome manually before trying init-term and saw the welcome message over TTY.

I actually meant for the welcome message to show up on the picocalc itself as a sanity test that the text routines worked.

Just added a bit of debugging prints to print incoming and outgoing bytes on the terminal emulator to the serial console. > indicates a byte that is to be handled in the outgoing display logic; < indicates a byte that has been read from the keyboard followed by its attributes separated by :.

picocalc-term::picocalc-term-internal::picocalc-welcome is meant as a sanity test to indicate that text can actually be displayed when the user calls picocalc-term::term-console, by the way.

I’m running into this error increasingly more often when I upload picocalc_term

error initializer init-shared-term I2C target address not acknowledged

That indicates some communication problem with the I2C keyboard. Thing is, you had it working, because otherwise the LED would not have toggled when pressing keys. I would say try power-cycling your board then.

It seems like for best results, I need to cycle power, not just reboot, between uploads.

Also, the screen (terminal app on OSX) goes dead as soon as I invoke term-console. There’s no more traffic even if I press keys on the picocalc.

Furthermore, I’m never seeing the welcome message because I have to disconnect the terminal app before I can upload code with the script. So by the time the upload has finished and I’ve started up screen again, the text is gone. And if I leave screen running, the codeutil refuses to connect to upload the source.

-Dave

I just added a bit of code to make the keyboard code ignore cases of the I2C target address not being acknowledged.

The fact that nothing is happening on the serial console indicates that something is wrong, because the debugging prints I added should be happening on the serial console when you press keys on the PicoCalc keyboard.

Maybe put a delay at the end of picocalc_term.fs so I have 5-10 seconds to switch over to screen to see any TTY output? As I’ve mentioned before, sometimes by the time I’ve started screen I see the tail end of what looks like an exception handler running on the PICO.

Or I wonder if I can do the uploads from within screen somehow so that I never have to leave it.

Can’t see a way to upload within screen but it did finally occur to me to make a shell script that does the two uploads and then immediately invokes screen. Didn’t really help though.

It turned out there was a critical bug in my initialization code that certainly broke almost everything and would likely have caused the instability you saw. Please try again now.

Thanks,

Travis

    XPSR:           21000000
    Return address: 20020DBA <no name> 20020C3E +0000017C
    LR:             20020D9D <no name> 20020C3E +0000015E
    SP:             200414B4
    R12:            DEADBEEF
    R11:            00000000
    R10:            DEADBEEF
    R9:             DEADBEEF
    R8:             DEADBEEF
    R7:             200410F4
    R6:             00000001
    R5:             DEADBEEF
    R4:             DEADBEEF
    R3:             00000007
    R2:             00000000
    R1:             20002409 <> 20002408 +00000000
    R0:             0000001E

Data stack:
    TOS:      00000001
    200410F4: 00000000
    200410F8: 00000057
    200410FC: FEDCBA98

Return stack:
    200414C0: 00000000
    200414C4: 200213C0 shared-term 200213B4 +0000000C
    200414C8: 00000057
    200414CC: 2001D093 handle-char 2001D088 +0000000A
    200414D0: 2001E825 <no name> 2001E67E +000001A6
    200414D4: 00000057
    200414D8: FFFFFFFF
    200414DC: 200213C0 shared-term 200213B4 +0000000C
    200414E0: 2001D747 <no name> 2001D70E +00000038
    200414E4: 200213C0 shared-term 200213B4 +0000000C
    200414E8: 2001C5A3 run-term 2001C59A +00000008
    200414EC: 20007E47 try 20007E14 +00000032
    200414F0: 00000000
    200414F4: 200410F8
    200414F8: 10010EE9 try-and-display-error 10010EE2 +00000006
    200414FC: 10035D45 task-entry 10035D3C +00000008

Terminating task

*** HARDWARE EXCEPTION, TASK TERMINATED ***

That’s more progress ─ that pointed out a key bug in handle-char. Please try again now.

Now I get this. Pico LED stops toggling on keypresses after this, everything is dead again

picocalc-term::term-console >0D >0A >57 >65 >6C >63 >6F >6D >65 
>20 >74 >6F >20 >7A >65 >70 >74 >6F >66 >6F >72 >74 >68 >20 >6F 
>6E >20 >74 >68 >65 >20 >50 >69 >63 >6F >43 >61 >6C >63 >0D >0A 
>42 >75 >69 >6C >74 >20 >66 >6F >72 >20 >72 >70 >32 >30 >34 >30 
>5F >62 >69 >67 >0D >0A >56 >65 >72 >73 >69 >6F >6E >20 >31 >2E 
>31 >33 >2E >31 >0D >0A >4F >6E >20 >53 >61 >74 >20 >4D >61 >79 
>20 >31 >30 >20 >30 >32 >3A >34 >31 >3A >30 >39 >20 >50 >4D >20 
>43 >44 >54 >20 >32 >30 >32 >35 >0D >0A >7A >65 >70 >74 >6F >66 
>6F >72 >74 >68 >20 >63 >6F >6D >65 >73 >20 >77 >69 >74 >68 >20 
>41 >42 >53 >4F >4C >55 >54 >45 >4C >59 >20 >4E >4F >20 >57 >41 
>52 >52 >41 >4E >54 >59 >0D >0A >46 >6F >72 >20 >64 >65 >74 >61 
>69 >6C >73 >20 >74 >79 >70 >65 >20 >60 >6C >69 >63 >65 >6E >73 
>65 >27 >20 >20 >6F >6B >0D >0A >06 

I assume that’s the welcome text you added. But pressing keys doesn’t generate any <?? traffic.

I forgot a reference to self when updating the display, which has since been fixed. Please try again now (I know this must be getting old by this point).

Thanks,

Travis

I’ve been on the other side of this sort of debugging in my day job, it’s fine.

Sorry, this wasn’t any different. Same TTY output, keyboard is dead, Pico LED no longer toggles.

Try it again. While I couldn’t get it so that picocalc-term::term-console usb::usb-console would do what I wanted it to, i.e. dump debugging into to the serial console and then immediately return to the USB CDC console (I all using a full_usb build), when I issued control-T z at either the USB CDC console or the serial console, it would dump more debugging info to the serial console, indicating it was still alive.

Thanks,

Travis

Crashed again. It’s fine until I press a key on the picocalc, then it crashes:

*** HARD FAULT *** 

Exception state: 
    IPSR:           00000003
    XPSR:           21000000
    Return address: 1001FAF2 test-set 1001FADA +00000018
    LR:             1004CCB3 claim-slock 1004CCA0 +00000012
    SP:             200414B4
    R12:            DEADBEEF
    R11:            00000000
    R10:            DEADBEEF
    R9:             DEADBEEF
    R8:             DEADBEEF
    R7:             200410EC
    R6:             D0000170
    R5:             DEADBEEF
    R4:             DEADBEEF
    R3:             00008000
    R2:             10000000
    R1:             20040F60
    R0:             FEDCBA9C

Data stack:
    TOS:      D0000170
    200410EC: FEDCBA9C
    200410F0: 10050C70 claim-lock 10050C6C +00000004
    200410F4: FEDCBA9C
    200410F8: 2001B3C6 <no name> 2001B366 +00000060
    200410FC: FEDCBA98

Return stack:
    200414C0: FEDCBA9C
    200414C4: 10050E1D claim-lock 10050C6C +000001B0
    200414C8: 10050E45 with-lock 10050E36 +0000000E
    200414CC: FEDCBA9C
    200414D0: 2001B453 <no name> 2001B366 +000000EC
    200414D4: 2003A514 shared-term 200214C8 +0001904C
    200414D8: 2001E591 <no name> 2001E55E +00000032
    200414DC: 200214D4 shared-term 200214C8 +0000000C
    200414E0: 2001D78B <no name> 2001D75E +0000002C
    200414E4: 200214D4 shared-term 200214C8 +0000000C
    200414E8: 2001C5F3 run-term 2001C5EA +00000008
    200414EC: 20007E47 try 20007E14 +00000032
    200414F0: 00000000
    200414F4: 200410F8
    200414F8: 10010EE9 try-and-display-error 10010EE2 +00000006
    200414FC: 10035D45 task-entry 10035D3C +00000008

Terminating task

It’s late here in the UK. I’m happy to pick this up again in the morning.

I just made a key fix to picocalc-keys::picocalc-keys> to a bug that was almost certainly causing your problem. If you have a bit of time now, could you try just this, or not, could you make sure to do it in the morning tomorrow (note however that I’m in CDT myself).

Travis

I have made major progress on the PicoCalc terminal emulator! I realized I had an ST7789V display that I could use that I had already written an 8-bit display driver for which was very similar in API to that for the ILI9488, such that it was nearly a drop-in replacement. So I modified the terminal emulator to support both the ILI9488 and the ST7789V with conditional compilation (I also made it select a larger font when using the ST7789V just because my ST7789V display is much smaller in dimensions than the display on a PicoCalc, such that using a 6x8 font would be unbearably small). I also added a basic test tool to inject characters entered via serial into the input for the terminal emulator, to allow me to exercise it more fully without having an actual PicoCalc keyboard on hand. With these I have gotten the PicoCalc terminal emulator to the point that I can not only see the welcome message but I can also enter words at the REPL and even execute words (note however that the words word assumes an 80 character-wide display, so each line gets folded over weirdly). Scrolling and clearing the screen with page work, as does the bright red error color, as can be seen if one attempts to enter a nonexistent word.

1 Like