September 17, 2024

Biscotti firmware -- Some PWM history of Convoy flashlights

I ran across some interesting posts from 2015 and 2018 related to PWM in Convoy flashlights (as well as the BLF light that I also have).

I did a quick scratch paper calculation of the PWM frequency. Given a 4.8 Mhz system clock and a PWM timer counting for 8 bits (256), we get: 4800 Khz / 256 = 18 kHz.

A fellow measured a Convoy S2+ with Biscotti at 35 percent running at 36.4 kHz. Sometime soon I will measure the Biscotti (and Convoy) waveforms at various power levels with an oscilloscope. He measured using a scope and an optical sensor.

In the above post (in 2018), Toykeeper commented:
A while back on my original Cypreus and Ferrero Rocher drivers, which are both FET-only, I used a combination of PWM and PFM to ramp between individual PWM levels by changing the pulse frequency. At the lowest level it had a self-adjusting moon mode which went anywhere from 15 kHz to about 2 MHz depending on battery voltage.
But I haven’t seen any commercial lights with such fast pulses.

Usually I try to get PWM as close as possible to 20 kHz, so it’ll be just barely too fast for humans to hear, without reducing pulse resolution or wasting a lot of power on MCU clock speed. And for the lowest few levels I slow it down to increase stability.

Also:
The Convoy biscotti driver changes the MCU clock speed at the lowest level. Behavior depends on which version of the driver you got, but if it’s running at 36 kHz it’s the old version. That one uses SPEED/16 for moon, SPEED/2 for levels 1 and 2, and then full speed for everything above. Because the prototype driver hardware had really slow leading edges on each pulse, so I had to slow it down when the pulses were narrow.

But then the hardware totally changed in production, and they got the fuse values wrong, so the first batch runs twice as fast as intended and isn’t calibrated correctly.

He gave this link to a source file: Apparently the dreaded Convoy firmware uses a 4.5 Khz PWM frequency, according to this post from 2015. Again, "ToyKeeper" says:
It uses 4.5 kHz PWM.

This is fast enough that most people generally won’t notice it, but you might hear a tone while the light is in medium mode.

Really cheap lights and a lot of car tail lights tend to use ~150 Hz, while high-end brands often use 4.5 kHz or non-PWM current-controlled output. The 19 kHz speed we use on BLF is generally only available in custom lights or qlite drivers.

I wonder if it would be feasible for Simon to start selling lights with BLF-sourced firmware. It might be awkward since he doesn’t actually make the drivers, but it would be really cool to have better firmware options.

This depends, of course, on whether the firmware authors are okay with someone else selling their code. And the availability of good general-purpose firmwares. But I like the idea, at least. The stock code on nanjg drivers is a bit dated now.

Note the latter part of his comments. This implies that Convoy (Simon) buys the NANJG driver boards "ready made" with the firmware already installed from some source outside of Convoy. This explains at least part of why we still get the dreaded "Convoy" firmware -- I should start calling it the NANJG firmware. Also note that this post was in 2015, and he was calling the firmware dated then (9 years ago).

There are lots more interesting comments in the above thread from 2015.


Feedback? Questions? Drop me a line!

Tom's Light Info / [email protected]