Flashing the keyboard firmware

I just failed to flash the keyboard firmware for my pocket :grimacing:Well it all succeeded (after putting the keyboard in programming mode), but I think moving the enter key down one row in matrix.h means I can’t use Hyper+Enter in new or old position to boot. Is that expected? The sources made me think it should be fine. Now Hyper+anykey gives me “Press Hyper + Enter for menu. Hold to power up”… have I any options other than disassembly to put the controller in factory mode now?

ah… I just noticed the flash.sh script in the firmware repo directory, and that uses picotool to reboot the rp2040. I ran the picotool load command from the manual, waited a minute or two after the progress bar had completed, and then toggled the reset switch. Maybe that left it in an inconsistent state?

I’m on vacation the next couple of weeks, but unless I get better advice before then I plan to manually flash the system rp2040 with a factory mode setting when I get back. I’m very nervous about disassembling my new favorite toy so early on though!

I believe I can cross compile the sysctl from my intel thinkpad and flash the disassembled pocket by connecting to the internal usb and carefully following instructions on setting dip switches. Then I should be able to power up with just the charger, and trying programming the keyboard again with an external usb keyboard attached.

Once I’ve figured out what I did wrong, I’ll put together a prototype keymap editor gui with Lua!

2 Likes

The plan worked, and the pocket now boots in factory mode shortly after connecting power. Also, now that I have a running terminal after booting I can see that my remapped keyboard is working perfectly too!

But something is not right because the OLED display does not come on with the remapped keyboard. When everything is powered off, and there is some charge in the battery I can provoke the press HYPER + ENTER for menu and hold for boot message on the OLED, but it is otherwise off, and does not respond at all when fully booted from Factory Mode, so I can’t put it into programming mode with HYPER+x (using the original or remapped x key location) nor bring up the OLED menu with HYPER+ENTER (using original or remapped ENTER key location).

@minute Is there another way to reflash the default keyboard fw?

Well dang. I found the error in my remapping… I moved ENTER down one row in the normal matrix, and replaced the ENTER key in the HYPER matrix without also adding an ENTER one row down. So there’s no key-chord for HYPER+ENTER in the current layout.

But it’s good that I discovered this now, so that once I’ve fixed it, I’ll be sure to have my keymap editor prevent you from making a HYPER layer with no ENTER key in it!

2 Likes

IIRC you can double-tap the keyboard’s reset button to get it to flashing mode. Might take a few times to get it right.

@minute thanks for the tip… but no luck . I see a reset button between the number keys and the OLED board after removing the keyboard top cover? I see there’s also a prog button there, but various double and triple taps with a spudger from fast to fairly slow seem to only restart the OLED module. Or is there an additional reset button somewhere else for the keyboard?

OK, that’s the right one. If that doesn’t work try holding down prog while you press reset.

On a Pi Pico holding down prog while connecting power goes into mass storage (programming?) mode. If connecting power is like reset than this should work, as long as you release reset before prog :slight_smile:

Thanks @minute and @pff! With well spaced out presses, it worked:

  1. press and hold reset for a second
  2. with reset still held down, press and hold prog for a second
  3. release reset
  4. a second or so later release prog
  5. with an external keyboard, run the flash.sh script after recompiling the fw with an ENTER key on the HYPER layer this time

And everything is working properly again :laughing:

4 Likes

Thanks for posting these instructions, I made the same mistake >_<

For me the sequence described by @gvv didn’t work, I kept getting the “No devices in BOOTSEL mode were found” message when trying to flash.

What finally worked was very similar though:

  1. press and hold prog
  2. with prog still held down, click the reset button a bunch of times very quickly
  3. release prog
  4. run sudo sh ./flash (in my case via SSH)
1 Like

I did the same thing accidentally. Do I still need to unscrew the top half, move the jumper and use internal USB to flash it from different computer?

But in general, is there way to boot the pocket reform device without keyboard sequence?

There is a patch to the sysctl which automatically switches on the pocket once power is applied. That patch is useful for testing things without having to attach a keyboard. Are you looking for that?

Here is the canonical guide for this situation: MNT Support

3 Likes

I really love the simple step-by-step nature and the very detailed macro photos in these guides. Thank you for creating these! I also very much appreciate the anchor links in the upper right corner and I should be pasting reference to these guides more often. Is the content behind support.mnt.re in a git repository so that one can send merge requests?

2 Likes

That would be great to have. Could you share it? I will apply it once I will boot the device.

Thank you. That helped. Now I will be more careful with the matrix.h :slight_smile:

1 Like

I might be wrong, but maybe the scripts should be swapped in step 13 and 14?

1 Like

Is there a way (e.g. through a combination of jumpers/switches) to expose the keyboard RP2040 to an external USB host? like the unbricking guide explains how to expose the sysctl RP2040 via the SYSUSB connector?

I suspect there is not … since if there were then the guide would be shorter. You wouldn’t need to first flash the system controller and boot the machine to reflash the keyboard firmware. Maybe in the future?

1 Like

Sorry I forgot to respond. It’s not a patch. You enable it with a make flag MNTRE_FACTORY_MODE=1 and it’s published in the CI result as sysctl-recovery-mode.uf2.