Well I received yesterday some PFS154s, and I already have managed to get have them programmed. I've made the programmer as simple and as hobbyist-friendly as possible, using only DIP parts.
On the hardware size:
The boost converter is composed of L1, Q1, D1 and C1. The part values were mostly chosen at random until the circuit worked reliably. 1N4007 is possibly the worst choice but it's the only diode I have at the moment
.
R1 is there to ensure the gate doesn't float, shorting the MOSFET. R2 and R3 form a 1/10 voltage divider for feedback. Q2 is required to cut voltage from the boost converter to the microcontroller during reset, and pass voltage only once it is stable.
VDD may be chosen from two different sources: from the SMPS through Q3, or from a fixed 3.3V supplied by a Holtek HT7133 linear regulator (U1) through Q4.
R5, R6, R7 and R8 form the standard voltage divider for data lines, for reducing 5V to 3.3V. I have settled on those values because higher ones (ie 3.3k/2.2k) introduced errors on the transmissions and I had to lower programming speed.
Now on the software side:
The Arduino's ADC is set to free running mode sampling from FB at the max allowed speed by the ATmega328 datasheet (1MHz). It is also set to use the internal 1.1V bandgap as reference, to avoid noise on the USB VCC to affect the quality of the regulation.
On every read sample, it is compared against a target voltage. If lower, the DRV pin is toggled. Otherwise, it is set to low. Given the 78KHz sampling rate, that means the buck frequency is around 37KHz at max current drain.
Now, to start a command (kudos to JS for the sequence):
- Sets boost target to 5.8V, and waits for voltage stabilization
- Lowers VPP_EN to send 5.8V to chip's PA5
- Waits 100uS
- Lowers VDD_33_EN to send 3.3V to chip's VDD
- Waits 500uS
- Sends the well-known payload to start command
For writing, after sending the command it sets VDD_33_EN to high impedance, and then immediately lowers VDD_SMPS_EN, thus connecting both VPP and VDD to 5.8V, which seems to be the required voltage for programming.
For wiping flash, after sending the command it then raises the target voltage to 6.5V, and then proceeds with the erase sequence.
I'm open to suggestions and improvements. I had thought about getting an ATtiny261, running V-USB on it and have the smallest and simplest, all-DIP programmer.