Attiny25/45/85 FW Development Thread

I will probably get the dumb question of the year award for this, but I gotta learn sometime. 2.7v doesn't sound like a half bad cut-off point. Some cells should only go down to 3v, others 2.5v. Of course, they bounce back up some after the load is removed. I tend to replace cells when the get down into the mid to high 3's because they seem boring at that point. Won't your MCU's have automatic LVP and not need LVP coding?

I’m not sure what it’d do if the MCU shuts off due to voltage. It could “fail open”, so to speak, with the power channel fully connected. Maybe. I’d prefer letting it shut itself (and the light) down properly.

I would love to see the 2.7v cutoff tested. To be safe an LVP could be programmed for 2.8-2.9V but having a hard cutoff at 2.7 would be good in my opinion. It’d be yet another way to protect us.

This isn’t LVP, it’s the voltage range where the chip is expected to behave properly. Some individual attiny25 chips may work just fine outside of the range but it is not guaranteed. The attiny25 and others have a Brown-out Detector that would be better to try as a backup LVP. Brown-out Detection can conveniently be set to 2.7v. Fuses 0x62 0xdd will set Brown-out Detection to 2.7v

Is there any real point in running either chip past 10 MHz? The chip uses more power at higher MHz.

As far as I can tell, there’s no point running faster than ~5 MHz, since that’s fast enough to make imperceptible 19kHz PWM. It’s not like it’s processing a lot of data.

For the "V" chips, I believe the choices are 6.4 and 8Mhz unless you use an external oscillator. I opted for 8 just because it is the default and doesn't seem that much higher than 6.4. I will flash for the lower speed next time. I chose 1.8v brown out because that is what TK used for BLF-A6.

I tried to add dual PWM Modes (fast/phase) and Alternative PWM output (like for +7135) to Tom E's version of Star Mom. I have build errors that need to be fixed. So no progress on LVP testing yet.

I just measured my chip at about .21" square not counting the legs. So the chip pictured in the OP is the S82 package.

It’s too bad you have to go up to the Attiny 24 to get more than 2 PWM outputs. I’d like to play with RGBW leds.

You can do RGBW on a tiny13, but at least two of the channels will be on/off only so if you want PWM you’ll have to do it manually. It’s generally not worthwhile except for low-power indicator lights, like for showing battery state through a translucent button.

I want PWM on red green and blue, I’d like to play with color mixing. I might buy a DIP package tiny 24 and build a test driver on perf board.

Oh boy, I ordered the 20 MHz probably because of my need-for-speed mentality I've had in this biz since 1980. I thought the speed was free, apparently not, I didn't fully research the consequences. At this point, there's no reason to play with the risk of that 2.7v cutoff with the 10 MHz chips. The 45's I received are the 8S2 package, and the legs do need to be bent or clipped to fit on a wight 17 FET+1 driver (https://budgetlightforum.com/t/-/31102) - it's way too darn close, but the wight 22 FET+1 driver (https://budgetlightforum.com/t/-/31559) is perfect for these packages with the extra set of extended pads, so it appears. I'll use the 22 mm board for development then.

I'll check around for 25's in the S8S1 package at 10 or 8 Mhz max - this seems to be the best option for using on existing 13A board designs.

This seems like the best in-stock option (ATtiny25V-10SSU):

http://www.mouser.com/ProductDetail/Atmel/ATTINY25V-10SSU/?qs=sGAEpiMZZMvqv2n3s2xjsY4e7hoSVIBakrXdKP3UXak%3d


So I realized that I had just received an attiny85-20SUR from Mouser the other day. I bent the legs and soldered it to a 105C to do some tests using TKs Cypreus2 firmware.

With the following fuses (2.7 Brownout Detection) I had the these results.
-U lfuse:w:0x62:m -U hfuse:w:0xdd:m -U efuse:w:0xff:m

3.11 works
3.07 erratic
3.05 more erratic
3.04 off
3.03 off
3.02 off

Then I flashed these fuses to disable brownout detection and got these results.
-U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m

3.06 works
2.98 works
2.83 LVP

So on my test board the 2.7V brownout detection actually started kicking in just over 3V. With it disabled the programmed LVP correctly shutdown the light at 2.8V. Next I’ll disable the LVP in the firmware to see how low the attiny85 will go.

EDIT: I should note that the voltages were tested after disconnecting the battery so there may have been some sag involved. That said, if even the very low moonlight level wouldn’t light up there couldn’t have been that much sag.
EDIT2: While replicating my results I realized that I had wrongly attributed the LVP shutdown to the attiny85 when it was the attiny13a.

So my attiny85 works all the way down to 2.5V. That’s far lower than I wanted it to be able to go. It might go lower but that’s as far as I’m taking my battery.

^ Great info SciFiFreak. Thank you for sharing. Looking forward to hearing about your next test.

Did you change the FW code at all? I ask because I see it references memory code "WDTIE". That isn't a valid code on the 85. It's equivalent would be "WDIE". You many want to also change F_CPU to 8000000 with the last fuse settings you listed. You probably did all that, but I mention it just in case.

I didn't look at all the memory references. Just the above because those were the only real changes I had to make to the version of Star Momentary I ported over.

EDIT: Not sure I follow your "EDIT2:" above. Can you elaborate on it?

I haven’t touched the firmware in any way yet but will start digging into that soon. Thanks for the tips. My primary goal was just to see if it ran and at what voltages it would run. My basic tests were only simple mode changes.

While testing the voltages I was bouncing the battery back and forth between a FET+1 attiny13a, to discharge it, a charger, and the 105C attiny85. I thought I saw the 85 do the LVP step-down and turn off. In reality it was the 13a and I had gotten them confused. So the LVP code in the Cypreus2 firmware doesn’t seem to work on the 85 (at least on the 105C). That’s OK, it’s a different chip/board after all.

Thank you for the follow up SciFiFreak. :)

TK wrote:

As far as I can tell, there’s no point running faster than ~5 MHz, since that’s fast enough to make imperceptible 19kHz PWM. It’s not like it’s processing a lot of data.

If going running faster can get rid of the whining in the medium to highish modes, that would be a a good point in favor of it. I didn't notice any whining when testing at 8MHz, but I wasn't focused on that when I was doing the test. I will listen for that this weekend and report back.

Oh, it shouldn’t whine with fast PWM (19 kHz), but you’ll probably hear whining with phase-correct PWM (~9 kHz).

I mean, unless you have extremely unusually good hearing, in which case 19 kHz might still be audible.

Also, I’m surprised to hear that the cypreus2 code compiles for the attiny85, much less actually works. I thought it had enough differences that it would require some rewriting. But if only the WDT stuff needed changes in STAR, that would explain why cypreus2 works… it doesn’t use the WDT.

TK wrote:
Oh, it shouldn’t whine with fast PWM (19 kHz), but you’ll probably hear whining with phase-correct PWM (~9 kHz).

I mean, unless you have extremely unusually good hearing, in which case 19 kHz might still be audible. . . .

My wife says I have a terrible sense of hearing. At least, I think that's what she says.

Seriously though, my sense of hearing really is pretty bad. I have never heard fast (19k) PWM. I do hear phase PWM as you mention. My wife and dogs, on the other hand, regularly comment on the noise my lights make in the mid to highish modes. That, in a sense, pretty much makes me sensitive to it too. Since 19k is on the outer edge of human hearing, nudging up the frequency might add some peace in my household. That would be a definite benefit of moving to the Attiny25, at least for me and my wife. The dogs will probably still occasionally bark.

I can hear the 19KHz PWM in most lights in the middle modes, but that's because what I'm hearing isn't 19KHz anymore--it's the springs and MLCCs resonating at a lower frequency. MLCCs are especially bad (piezoelectric effect).