[sdiy] Rotary Switch -> illuminated PB w/ multicolor LED?

Mike Bryant mbryant at futurehorizons.com
Fri Feb 18 00:50:36 CET 2022

If Microchip spec it like this then that's fine, but STM and NXP don't have the same specs even for their ultra-cheap 8 to 20 pin devices.  Some STM32 chips start to close down as soon as the slightest hint of a voltage drop is detected.

-----Original Message-----
From: Synth-diy [mailto:synth-diy-bounces at synth-diy.org] On Behalf Of Tom Wiltshire
Sent: 17 February 2022 23:38
To: Brian Willoughby
Cc: synth-diy at synth-diy.org
Subject: Re: [sdiy] Rotary Switch -> illuminated PB w/ multicolor LED?

I can only answer point (B) since I've tried Roman's technique of saving to EEPROM on power-down:

Microchip give a supply voltage range of 1.8V to 5.5V or 2.3V to 5.5V for many of their recent chips. So "low voltage" is "below 2.3V". If we're operating at 5V normally, that gives us oodles of voltage drop and time before we've even close to the edges of the specification. We could lose a volt and a half and we'd still have another volt and a half to go before we even got close to "out of spec". While I understand your reticence to use an apparently unorthodox technique, in reality to program a few settings as the power drops is not doing anything that's pushing the limits in any way. If it was a critical application where people might die if it didn't work correctly, then ok - it's probably a no-no. But we're talking about state-saving on a synth module. The worse-case scenario here is that our poor user might lose some element of a patch. It's not the end of the world, so we can safely risk it for the convenience and extended memory life it offers.

On another note entirely - Microchip want you to buy a $300 programmer because they claim the $30 one won't do the same job? Conflict of interests much?!?

> On 17 Feb 2022, at 23:15, Brian Willoughby <brianw at audiobanshee.com> wrote:
> I'm looking at two data points for my statement:
> A) Recent work with eMMC chips, which are NAND based, where they've added power supply voltage monitoring and an internal firmware mechanism that specifically avoids writing to the NAND memory when voltage is present but below a particular threshold.
> B) Microchip recommendations to never ship PIC processors to end-user customers when programmed with their inexpensive PICkit emulator, due to insufficient voltage during programming. Even though the code flash may verify as programmed, it may not read back reliably under all conditions, especially when the supply voltage varies during read-back. Microchip provides another programmer, their ICE product, that maintains a strong voltage during programming, such that read-back data is correct no matter what the supply voltage is at the time. I had a client who wanted to use the $20 PICkit to program commercial products because they didn't want to pay for the $300 programmer. Microchip specifically stated that they would not support this process.
> So, it still seems to me that it would be a bad idea to wait for voltage to drop before writing to EEPROM (even though EEPROM is distinct technology from NAND or NOR Flash) when one company avoids writes altogether during low voltage and another company warns that read data is unreliable when data is written during low voltage conditions.
> You raise a good point because perhaps EEPROM is able to function perfectly under low-voltage conditions, but I'd say it would be more important to prove that this tactic is 100% reliable, rather than assume it's reliable and expect proof that it will fail. At least, I say this when using a timer costs nothing and will certainly be reliable (unless the user thinks it's fun to change the settings a few seconds before powering off).
> Brian
> On Feb 17, 2022, at 12:06, Roman Sowa <modular at go2.pl> wrote:
>> How can you judge something as "bad idea" with so much self-confidence without providing any figures to back your claims?
>> Power hungry assumption is wrong, because current draw during EEPROM write is around 5mA, and write cycle takes about 5ms. That is 25uC, something that 47uF capacitor is able to deliver while loosing merely 0.5V - more than good enough to complete EE write. And that is only if main power supply voltage drops immediately, which is never the case.
>> "Over-engineering" in this case is 47uF capacitor and shottky diode. We're replacing $10 Grayhill switch here, so money and size is still way below.
>> I'm not talking about some of the modern non-volatile devices, but sub dollar PIC microcontroller, which does write EE in low supply conditions.
>> Writing EE with a timer after a change is still writing after a change, so it doesn't reduce many writes, it all depends on playing style. That's more like battery backed RAM way of doing things.
>> Roman
>> W dniu 2022-02-16 o 07:10, Brian Willoughby pisze:
>>> Bad idea to wait for the supply voltage to drop before writing to non-volatile memory, because the write operation requires more power. It will not be reliable unless you completely over-engineer the supply to be able to sustain sufficient power after it's turned off. Sure, it can be done, but there are other ways to solve this that don't increase size and cost of the circuit.
>>> Some of the modern non-volatile devices have onboard firmware that detects drooping voltage, and actually refuse to write to the NV memory unless the power is at full levels. They'll cache the data in internal SRAM and only write it after power is restored. If power is never restored, that data is lost rather than risk starting a write operation that cannot be completed due to falling power.
>>> An easier approach is to set a timer every time the value is changed. If the user changes the value before the timer expires, then simply restart the timer from the beginning again. But if the timer expires without any further changes, that's a good time to save the most-recent value. There aren't many musical uses for changing a setting right before turning off the power, and users probably won't be upset if such an erratic change is lost. In contrast, if the value if left steady and used musically for a while then it makes sense for it to be retained. You can choose whether the timeout is 1 second, 10 seconds, 30 seconds - anything that makes sense for the typical workflow.
>>> The replies about EEPROM versus Flash are correct. An EEPROM will last through 10 times as many writes as a Flash device. Some of the high capacity devices are actually 1/100 of an EEPROM's duration, but I doubt anyone is putting 16GB of NV memory in a module. The only downside is thet EEPROM memory sizes are much smaller, but that won't affect storage of a 2-bit or 3-bit setting. Many PIC and other micro controllers have both Flash and EEPROM for code and settings, respectively.
>>> But, yeah, nothing beats a mechanical rotary switch ... provided the price is reasonable.
>>> Brian
>>> On Feb 11, 2022, at 13:05, Roman Sowa wrote:
>>>> Power off and one button + LEDS was discussed here exactly 8 years ago.
>>>> There's no endurance issue, because how many times do you plan to turn off the modular? Some people never do it at all. But let's say everyday for 40 years, so that's still about 15% of typical EEPROM endurance in microcontrollers, and probably less than 1% of standalone good quality EEPROMs.
>>>> EEPROM should be written only when supply voltage is detected to fall below some threshold. Those 8 years ago I've made an example with PIC12F683 and even posted video about it. Of course at the moment you can forget about getting any PIC12F683, but it can be rewritten to anything else with self-writing capability.
>>>> Surely nothing beats Grayhills, although for me they are too stiff for 1/2'' knob. OTOH the already mentioned NKKs work with perfect feel.
>>>> Roman
>>>> W dniu 2022-02-11 o 18:52, grant pisze:
>>>>> I haven't found one small enough and even the closest competitors 
>>>>> seem like $10+ (recent prices).  The Grayhill 56 series is pretty 
>>>>> tiny as rotary switches go.
>>>>> The other thing that's nice about a rotary switch versus an 
>>>>> electronic pushbutton/MCU/LEDs is memory. Not only does the switch 
>>>>> already tell you what bank you are on as you switch it, but it 
>>>>> remembers it when the power goes off.  :-)  So that needs to be 
>>>>> factored into the MCU probably (EEPROM or emulation in flash, but endurance could be an issue).
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy
> Selling or trading? Use marketplace at synth-diy.org

Synth-diy mailing list
Synth-diy at synth-diy.org
Selling or trading? Use marketplace at synth-diy.org

More information about the Synth-diy mailing list