It’s worth mentioning that increasing PWM to 16 bits also means decreasing the pulse speed by a factor of 256. Instead of 15.625 kHz at a clock speed of 8 MHz, it would be just 61 Hz. So that can be kind of a problem.
However, there are some other ways to increase the resolution… especially on the low modes:
- Add a low-mode power channel at like… 20 mA or so. Or maybe 40 / 50 / 80 mA. Then the step sizes will be much smaller at the bottom of the ramp. Like, at 20 mA, each step would be about 0.03 lm.
- Instead of 16-bit PWM, maybe use a PWM+DSM hybrid. This would get the in-between levels by rapidly switching between two adjacent PWM levels, using an interrupt tied to the pulses. This allows it to use 16 kHz 8-bit PWM but get several extra bits of resolution.
About the first option, it’s relatively straightforward if there’s room on the PCB. It can also be combined with a higher regulated power channel, using the low channel to provide extra resolution between every two high-channel steps. To do this well though, you’d need a power-of-two relationship between the two power channels… like 20mA and 5A, since that’s about 256X.
About the second option, Inferion did it on the YLP Unicorn and it worked well. I also rewrote the entire interrupt system in FSM in order to make PWM+DSM theoretically possible in the future, though I haven’t actually tried it yet.
Anyway, increasing the analog resolution is probably the best option… but if it must be digital, at least there’s a potential way to do it without sacrificing pulse speed.