I have a flasher again !!!!

I soldered round wires onto my teensy to function as the round headers I don't have, but then I dropped the teensy approach. In all this exploration, I found there is an old arduino flasher. I happen to have an arduino as the same model as the dev.

I looked at his pcb schematic and wired up a breadboard the same way. I put an LPC socket, with its square pins and all, in a breadboard, but was careful never to remove it in case it wouldn't reinsert well. I used the larger breadboard I had gotten for the nyansat kit, which looks higher quality.

When wiring it, I used solid core jumper wire from the nyansat kit, and kept the wires flat to the breadboard and short, and of colors consistent with their use, and straight and organised, to easily comprehend them visually.

I used a 100nF 104 capacitor instead of the large round 1uF capacitor used in the schematic, which I don't have on hand (although I do have a 10uF, unsure which is better), between ground and 3.3v.

To wire the arduino, I had to map the schematic to the shield headers on the arduino. It turns out they are labeled a little wrongly, but visually are aligned to the same locations, looking from above.

I happen to have a huge bag of resistors and used the exact 4.7K and 2.2K resistors used in the schematic. Some apear to be 2.2K pullup, some appear to be 4.7K pullup, although I'm never sure of these things, and some are voltage dividers. This made for a little more complicated wiring, and I kept it organised, relatively consistent, and flush with the board.

In order to make the arduino flashing code run successfully, I had to replace the serial firmware code on the board with some written by the dev. I was pleased that the dev shared some of my opinions regarding arduino's coding style and quality, which I don't usually encounter. The entire setup can be built and flashed without ever installing java, using only the avr toolchain.

The dfu flashing process was a little poorly documented. There is a bad that needs to be grounded called "reset" on the serial chip. This is completely different from the "reset" line of the avr chip on the arduino that is wired to a button. Pressing that button until your finger is sore won't get the arduino into dfu mode to reflash its serial firmware. Rather, the serial reset pad must be grounded or bridged to its neighbor. The board then stays in dfu mode until repowered or instructed to leave.

While in dfu mode, I found the serial port kept resetting, and often my kernel driver would get confused and disable it. I tried even with a usb cable that seemed new, and had the same experience. It took some replugging and some timing and repeated attempts to flash the firmware, to succeed, and then it eventually did.

The custom firmware flashing step used a "launch" command to the "dfu-programmer" debian binary, which my binary did not have. It looked like this was supposed to be part of bringing the board out of dfu mode correctly, without powercycling it. Replugging the usb cable instead seemed to function fine.

Once the board has its serial firmware, and the flashing code uploaded for the main chip, flashrom would only recognise it as a serial programmer if the device and correct baud were specified (115200). This was different from the behavior of the teensy. Additionally, my device was detected as a ttyACM device, whereas the documentation indicated my setup would show as a ttyUSB device. However, it ended up working anyway.

An extant bug is that it takes two run cycles to use the programmer with flashrom. The first one encounters a "device or resource is busy" error, and the second works. "fuser" reports nothing else using the port.

This has been a silly multiweek struggle for me! I'm excited that the solution I ended up finding uses open source hardware and firmware, and requires no gui tools like teensy's installer.

I'm using an arduino uno r3. The custom arduino serial firmware is at https://github.com/urjaman/fast-usbserial . The LPC flashing code and wiring schematics are at https://github.com/urjaman/frser-m328lpcspi .

There is further documentation at https://www.flashrom.org/Serprog/Arduino_flasher but note that most of that page is for SPI flashing whereas I have LPC chips.

I took a photo of the new flasher but ran into some issues (during brief period, with my EEG off for the photo, my body spasmed and knocked many things on floor, still shaky and anxious from big spasm, other parts of my behaviors acting more inaccurately) and decided not to go through the trouble of uploading it somewhere and linking it here at this time.