Attiny25/45/85 FW Development Thread

This thread way over my head. So here are links to "Status" posts of members that are developing and sharing code for the Attiny 25/45/85. They are talented folks that we all appreciate. Alphabetical order on screen name:

Flintrock:

Mike C:

Tom E (Primarily focusing on Momentary Switch FW):

ToyKeeper (Primarily focusing on Clicky Switch FW):

Original Post:

Decided to pursue the Attiny 25/45/85 ("25") because I want the following:

  • Thermal protection that is based on actual temperature and not a make shift solution like turbo time out.
  • Ability to use the widely available Attiny 13a driver boards without having to modify the pcb.
  • Not having to use one of the valuable remaining 3 or 4 pins of the mcu for an external thermal protection circuit.
  • Not having to sacrifice valuable existing code to make room for new thermal protection code due to the Attiny13a's 1k flashable program space limit.

Status:

  • Thanks to Tom E's skill and efforts, modified JohnnyC's Star Momentary modified for strobe, dual PWM modes, and Alt PWM by Tom E is working on the 25. He has published his first working version in Post 71. This is big news! BLF drivers will be jumping up to a whole new level of functionality soon. Probably not tterev3 levels, but we should hopefully be able to better address heat safety issues and gain whatever fun new features programmers can imagine with the extra programming space, PWM outputs, etc.

To Do:

  • Create OSH Park boards that can be used to piggy back this MCU on to any driver (making it a slave) using air wires. The wire solder points will be far enough out to still enable flashing the MCU. It will also have a ground plane that can be used to both provide ground and a thermal path to the slave drivers ground ring. Will include pads to have an optional LVP voltage divider to the board too.
  • Begin creating thermal protection code

Some Notes:

Pinout:

The 25/45/85 have 2 PWM channels (Attiny13a has 1) that can put put to pins 2, 3, 5, and 6.

A direct match would be 8S1 which is only available in the 25. For the 45 and 85, the 8S2 appears to the best match. The pins of the 8S2 package need to be bent down to fit the Attiny13a SSU (8S1) package footprint. It's easy to do and I am still able to attach clip for flashing. The modified chip still fits in the original protective sleeve (Chip on far right).

Original Post (8/3/2015, changed on 8/4/15):

The question of why we don't use the 25/45/85 pops up from time to time with no real conclusions. I'm not a programer, but had to try it out to satisfy my curiosity.

Ordered some cheap Attiny45's because I didn't know how things would turn out. Went for the 10 Mhz version. If I understand the data sheets correctly, the 20 Mhz version only operates at 20 above 4.5 volts (just like the Attiny13a).

Grabbed JohnnyC's Star Momentary modified for strobe by Tom E. For every memory reference, I compared the the Attiny13a data sheet to the 25,45,85 data sheet. To my surprise, only one change was needed in the end.

Fuses, I know nothing about. Tried to flash with 0x75/0xff and got an error which basically bricked the chip. I will need to make one of those 12v jobbers to reset it and make it usable again.

Tried a 0x75/0xfd with the same result.

Finally tried to learn a bit about Attiny25/45/85 fuses and got overwhelmed. Queried a chip and saw that it had 0x62/0xdf/0xff (l,h,e) fuses. Decide that seemed good enough for now until I learned more.

Hooked up the chip to a HX-1175b1 driver and lit her up. Worked good. Fast clicks when up through the 7 modes I programed. Medium clicks went down and a real long click went into strobe. Strobe was pretty slow with long flashes. Thinking setting the proper fuses will fix that. After a second or so in any mode with button activity, a fast click would turn off the light. In short, the FW appears to be working fine.

I have more to learn some more to get it running right, but it seems pretty close already. Why are we still not using the 25/45/85 when we could have the following for just slightly more cost?:

  • Internal temp sensor
  • 2 PWM channels
  • 2/4/8K Bytes of In-System Programmable Program Memory Flash
    • Endurance: 10,000 Write/Erase Cycles
  • 128/256/512 Bytes In-System Programmable EEPROM
    • Endurance: 100,000 Write/Erase Cycles
  • 128/256/512 Bytes Internal SRAM
  • etc, etc.

I think inertia is keeping us from starting to use them. I guess I'm not really concerned with why we aren't using them, but more I'm urging us to start using it. It could help address a major safety issue with some of our hot rods and will also help with some other challenges the 13a poses.

Hi,

i think it´s not a question about hardware specs, it´s cause the tiny13 is already mounted on most drivers. it´s easy to reprogram without desolder. shure, the bigger tiny´s are nice and have some features, but you also need software the use them.

markus

Skip the attiny45 and go straight for tiny85!

AVR Fuse Calculator Be sure “Serial program downloading (SPI) enabled; [SPIEN=0]” is always checked.

You can also use the calculator backwards. Enter the fuses and you can see what it would do. With an attiny45, the fuses 0x75 0xFF or 0x75 0xFD disables SPI. Which does indeed brick your chip unless you have a high voltage programmer or fuse resetter.

mash.m,

I agree with your logic. For those reasons and others, the 13a will not be going out of use for a long, long time. It's a decent chip and is a good choice. My biggest concern is that we have to use make shift thermal protection schemes with it. I know manufactures use it because they make thousands of boards and the 13a is cheaper.

I reworded my question because using the 13a is fine. I also added the following to the end of the OP:

"I think inertia is keeping us from starting to use the 25. I guess I'm not really concerned with why we aren't using it, but more I'm urging us to start using it. It could help address a major safety issue with some of our hot rods and will also help with some other challenges the 13a poses."

Halo...,

I think any FW that works in the 25 will work in the 45 and 85 (I'm sure there are exceptions). But not the other way around if it is too large. So programming for the 25 leaves the option for all 3 chips to be used. That could be handy if prices go up for one or supplies get tight for one.

Thanks for the info on fuses. Last night, I tried that calculator you linked to along with several others. But to be honest, some of the options go over my head. I have some studying to do.

Although I am still not fully up to speed with regards to fuses and the Attiny25/45/85 commands need to get various PWM results (such as fast,phase,frequency), I selected some new fuses and tried to flash them last night. Problem is I'm getting a error message in AVRDUDE that says something like, "Command "avrdude" is not recognized . . .".

I tried the following, but still got the same message after each change:

  • Different USB ports,
  • New programmer,
  • Installed the latest WinAVR

Maybe my programmer's drivers are corrupted or maybe the USB ports are screwed up (seems doubtful). Any one have this problem before and what did the problem turn out to be?

EDIT: Also tried with an Attiny13a in the clip. I'm using Windows XP (64bit version, I think) and the programmer is the standard ASPUSB 2.0.

I got the tools installed on Win 7, believe 64 bit (not sure), and works fine with 13A's. Are you trying on 13A's to sanity test it?

The message is implying it can't locate the avrdude.exe file, as if it's gone, or in another folder that's not in the search path.

Ohh btw - way cool you like my e-switch implementation. I think it's real nice, has me hooked on e-switch lights in fact. In other firmware goings ons, I modded a STAR_OFFTIME base (power clicky switch) to switch modes like luxdrv - where it initially changes mode to lowest, then mode toggles up from there. Always liked how luxdrv behaved like that. My luxdrv/STAR_OFFTIME has these features:

  • removed support for STAR jumpers (I know - STAR in the name is meaningless)
  • has simple support for FET+1 drivers with low modes using the 7135
  • a mode "locks in" in about a second, once locked in, the next quick power OFF cycle will switch to 1st mode, then following quick clicks go to next mode, etc.

This will allow me to add battery tests, strobe modes, etc. after turbo high, and you never have to click through those extra flashy modes Smile. I also like the fact if you are working on a low or medium mode, you don't have to get blinded by hi or turbo to switch to a lower mode.

I'm looking fwd to getting this new power clicky switch firmware ported to the 25/45/85 as well so I can take advantage of adding temp monitoring and a whole bunch of extra modes with the extra available memory. I always run out of space when I try to add some cool things...

^ Thanks Tom. I did try Attiny13 too with same result. Forgot to list that in my post above. I see what you mean that it may not be finding avrdude.exe. I'll check into that tonight.

That modded program of yours sounds sweet. Like the way you think when it comes to features and UI.

Good news. Finally got new fuses flashed and the program appears to work flawlessly. Next is to turn on LVP protection and see how that goes. After that, it's time to start drafting thermal protection code that uses the 25/45/85 internal temperature sensor. Starting to get excited.

Awesome. I’d like to include code when you have some working. :slight_smile:

Even better if you’re already using a version control system I could import from.

Nice work - BLF marching forward once again :beer:

Hi TK,

You're certainly welcome to any code I create. I've provided Tom E the details of my changes to "his" FW so far. Since I'm just a hack when it comes to programming, I'm hoping a real programmer will eventually pick up whatever I get done and turn it into real code. I figure I will probably be creating as many problems (if not more) as solutions. Just trying to be a catalyst of change here. If I have to develop it all on my own, so be it. It just will take way more time and probably not be optimal code.

Thank you FmC.:)

Fantastic!!!!

This is sounding better and better! Hope to join you in the efforts soon. I did just get in a ASUS 15.6" touch screen laptop i7 (great deal at TigerDirect btw at the time), and installed Win 10 and Atmel Studio 6.2 so far, then will be installing and copying over the rest of my development tools so I can finally work on the firmware and do downloads in the same room where I do the modding, rather that running upstairs/dnstairs every time - was a major hassle. Also was a major hassle not having a good online access for pic uploading, BLF'ing, etc., in the same room as the modding...

I was thinking of switching over to the 85 so i could use the arduino ide. I think moving to that would make this alot more accessable to alot more people. Although maybe im just a wimp.

Diode663,

Does the arduino ide require a specific package of the Attiny85?

I ask because it appears that package 8S2 would be the best match for our typical driver boards that use the SSU footprint.

I've never use arduino. What would be the benefit of what your talking about? High level and pretend I'm a 5 year old (I almost said 5th grader, but they probably know alot about this stuff).

Thanks for working on this. I have been working on it on and off for a while now, but keep getting sidetracked. JonnyC posted some code 7-8 months ago that does work, but no temperature sensor added yet. I was surprised that nobody except me tried it out.

I have some code that I started that has temperature sensor implementation and builds, but I have no idea if it actually works or not since I haven't even flashed it yet. Too busy.

You ought to get in touch with MikeC. I think he has the temperature code already figured out.

Thank RMM. Need to find where JohnnyC posted that. I think MikeC is working with much bigger chips, but maybe the his code could save some time.

It's in his github repository and was on his site before he started that. He shared that code with me last August, but it sounds like you've already made it that far.

As far as i know it shouldnt matter what package it uses as the architechture is the same. And the main advantage i see is the aurdino ide seems much more integrated and user friendly then winavr. Also alot of the low level programing is taken care of for you, the only time you would need to write registers is to set the fast pwm. You can have all the code down below with a few variables up at the top of the code that the user modifies to get the desried modes and features and just click upload. At any point someone can step in and tell me im wrong because i dont have very much time in winavr and im not well versed in programing.

True, but I do care about the package because I would lke to use the 45 (or 25 or 85) on existing 13A boards we have on OSHPark. Besides new board orders, I got a little stock on the wight designed OSHPark boards, as well as RMM OSHPark boards. I don't have the time or expertise to Eagle CAD new board layouts, maybe someone else could, that would be great, but dunno. It's a chicken and egg thing -- no sense in doin board designs because no working firmware, no motivation to develop firmware without any board designs...