Close

Single wire bootloader

A project log for Wireless ETTL flash conversion

Convert a vintage flash to wireless with full ETTL

lion-mclionheadlion mclionhead 11/30/2022 at 05:130 Comments

There was thus a transmit & receive board with test leads attached.  The transmitter is distinguished by an extra jumper resistor.  The only bodges were A0 not having any output mode & A1 not having a pullup.  It was finally time to sacrifice the extension cord.

Careful mapping of the pins

allowed resoldering to the development boards

The mane problem with sniffing the flash signals is both boards have to be powered on.  

There was a real desire for a bootloader this time, with so many cables being required.  The mane problems are these parts being end of life, the interrupt vector, & only 1 serial line.  The last bootloader a lion wrote for a 1 off project was for the mighty STM32, back when those just came out & were in long term production.  The 1st bootloader a lion wrote for a PIC was for the PIC18F458.  That one used the programming pins.

It would have to use the serial port, but the radio boards all short the TX & RX pins.  To receive & transmit on a single wire, the FTDI needs a tristate buffer for the TX, controlled by the DTS pin.

The mane problem with a single wire UART is we don't know when the FTDI is finished writing the last byte.  The kernel is happy to toggle the DTS pin before the TX pin is finished writing.  The best option is to read back every byte written, since the RX pin is always on.  Now the problem is knowing when the FTDI has read back the last byte written so the PIC knows when to transmit. The best the PIC can do is delay, which makes a single wire bootloader very slow.  

XC8 has a strange bug where it skips the memory from 0x00d0 to 0x300.  This only goes away if 

--codeoffset=0x800

After 2 solid days, the lion kingdom's 2nd PIC bootloader in 20 years came alive.

It's a grotesque waste of memory for a bootloader to print so much text, but it was about making supporting this obsolete part less miserable.

Discussions