I want to put my own code on the RP2040 that is on the macropad. If I do that there’s a good chance the code will get stuck in a loop or whatnot, so I’d need a way to get to mas storage mode to get working code back on there. Are the boot modes I’ve seen hardware or firmware? Is the RP2040 BOOT function somehow tied to hardware?
Is the BOOT signal available somewhere on the PCB?
Are the SWD pins available somewhere on the PCB?
The current methods used to enter bootloader mode are triggered by firmware. But it is low level QMK code, lower level than what anyone changes when customizing their QMK firmware. I believe one or more normal methods of triggering bootloader mode should still work, even if you mess up your attempts at customizing the QMK firmware to your liking. Presuming you don’t touch the low-level code, which few people outside of QMK developers are going to do.
But if you’re really inexperienced I would recommend playing with a RP2040 dev board first. You can get them extremely cheaply. No reason not to.
All RP2040 chips have a BOOT pin.
But I haven’t seen anyone post pictures of the macropad board with the sticker removed to check if it’s broken out to an easy-to-use pad. So you tell us. Or if you remove the sticker and take a good quality picture, I could help locate a pad.
Read the RP2040 documentation. The usb mass storage bootloader is a permanent ROM built into the silicon of the chip. The BOOT button is just a button that ties the CS pin of the flash chip to ground. It should be easy to tie into that pin with a soldering iron and some thin magnet wire (depending on the chip package they use, you might have to scrape the PCB some to access the trace instead of the pin on the flash chip). You have to press and hold the button on power up (or reset) to enter the bootloader, so you can’t just press the button anytime you want. If you can tie into the reset pin on the RP2040 then you just have to press and hold the boot button, then press the reset button while still holding the boot button.
Yes, I’ve read the Rp2040 documentation. It is conceivable that the SPI pin was pulled down by the key matrix somehow, it looks like that isn’t the case. I’ve looked at the PCB and it’s not immediately obvious what is going on. Its a black PCB so everything is tricky to see
Looks like there is a test pad (labeled TP9) right next to pin 1, of what should be the flash chip. Check conductivity of that test pad and pin 1. On the Winbond W25Qx flash chip that raspi pico normally uses, or pin compatible flash chips, pin 1 is your CS / BOOT pin.
Certainly would have been better if Framework brought it out to a more convenient location.
I have soldered a couple of wires to TP9 and GND (right hand ground plane), and run that to a switch and resistor. TP9 is on pin 1 of the flash chip so a resistor is needed, otherwise you ground the flash SS if you press the button when the rp2040 is executing out of flash. I used 2k2 because I had one.
This all works. I can now get into mass storage boot mode by holding the switch closed while I power the macropad up. I’m now going to pop some code on there and see if I can find the key matrix. The macropad still works as well.
Is there a UF2 somewhere that has the original code on it?
Wow, that’s a bit convoluted. I need to find the gpios that have the scan lines next. Well, after I can get Pico code building on the new framework, can’t get usb going at the moment. I did load a uf2 of some other code I have and I got a serial CLI so it will work. I’ve lost my original code for the time being, I may hunt that out.
Key matrixes can be like that sometimes. There are limited options to route traces around keys. It doesn’t have vias. Not a traditional pcb, not even a polyimide / kapton pcb.
I don’t know the material used, but I don’t believe you can solder to it. If you image search “keyboard disassembled” you’ll see pictures of the type used.
Anyone know where the key scanning for the macropad is done in QMK? I need the gpios or whatever is used so I can code my own scanner, and also where the SPI for the RGB controller is. This would have been much easier with a schematic. Seconds vs hours.
If you want a fully customizable keyboard, in seconds, use qmk. If you want to reinvent the wheel, it might take a little time.
Schematics are also not available for the expansion cards or the GPU expansion bay module. They may have been developed with a partner, as the mainboard is. Unfortunately, partner(s) may not be as enlightened as Framework themselves are about releasing full schematics or board level files of their hard work. Still, full mainboard schematics are available to repair shops who sign an NDA. I don’t know about other pieces. But we were never promised any. Framework has worked to open source everything they can.
I have managed to create some macropad firmware that can generate keys to the laptop, and also presents a serial USB CLI and a mass storage device. The mass storage device is 8K in size and was in the code I started with, so I left it. It might be useful, but can be deleted if not. The CLI is for debug at the moment, but configuration can be done this way.
The LEDs work and key scanning is multi-key internally, but that is turned into single keys at a time at the end of processing. The CLI allows a boot to mass storage mode to be initiated for programming .uf2 files.
There’s a video here of keys being pressed and some code that illuminates the corresponding LED. The key is also sending a character to the laptop. At the moment only single keys can be sent but that’s easily changed to string.
It doesn’t support the SLEEP pin yet so stays on when the lid is closed.
This is definitely for people who want to use it as a basis for something else.