I am having second thoughts about co-processor model. This significantly increases the complexity of the firmware for this design. I haven’t ruled out any options yet. If I can get a good voltage for Vpp without the co-processor, I may decide to go back to the level shifter.
Programmatically controlling Vpp:
I have been thinking about how to make an “adjustable voltage” switching regulator adjustable by the microcontroller. By putting a transistor on the low side of the voltage divider feedback, I believe I can have linear control of the generated voltage controlled by the Sigma-Delta output. I got a basic circuit design from the FAN5331 datasheet. I then replaced the ground side resistor of the feedback voltage divider with an NPN transistor. I came up with the circuit below.
The FAN5331 has a 1.25 volt reference comparator to decide if it needs to generate more voltage or wait. With the Sigma Delta input to r3 at 0 out of 255, the transistor will never turn on and the voltage on the feedback will be above the 1.25V threshold and the regulator will effectively shut down.
I have implemented the Reading the ADC from a keystroke (R) sent over serial. I have implemented the PWM on GPIO12. My initial testing of the PWM has a lot of jitter and didn’t perform at the frequency I configured. I want to set up a Hardware PWM and see how it performs. Jitter and frequency can be important when running a switching power supply, so I want to get this right. I set GPIO2 high to select Target voltage as the input to the ADC and set a variable power supply at 0.3 volts tested it and got results around 300, then set it to 0.5 volts and got ADC results around 500 indicating it’s working as expected.
The chip doesn’t have a PWM instead it has a built in sigma-delta pulse generator. It creates a stream of pulses to achieve the specified duty cycle by adding more pulses to fill in the middle. The chip will connect the sigma delta generator to any GPIO pin I choose. I can use any free pin to drive the boost inductor switch. If I optimize the inductor for the width of the pulse, I should get very efficient voltage conversion.
There is no API configured for the Sigma Delta unit. I had to write directly to the registers that set the pin connection and the Sigma Delta unit. I had to do a lot of experimentation to understand how to set up the Sigma Delta pulse generator. There is a piece of example code on Espressif’s forum that doesn’t work correctly, but gave me the information I needed to figure out how to configure the unit. The example code tries to be very generic, and my code is over-simplified for testing.