Attiny25/45/85 FW Development Thread

Regarding multiple channels:
There is an alternative to PWM if you need more channels: BAM (Bit Angle Modulation), 8 channels are easily doable (if you have the pins). I did some tests last year and it worked out quite well. It’s a bit tricky to program and I wouldn’t choose this method if I needed smooth ramping with 7135 at low levels.

Regarding the reset pin:
if you use this pin you don’t need expensive programmers for further reprogramming. I built a cheap fuse resetter with this instructions:
http://www.rickety.us/2010/03/arduino-avr-high-voltage-serial-programmer/
I used a arduino nano and a cheap MT3608 boost converter for the 12 V ouput.

I'm not sure what you guys are say'n. Certainly we do 3 PWM outputs now, but you see only 2 are possible?

PB4 (pin #3) is PWM'ing now for the FET in BistroTriple and narsilTriple.

I'm not saying only two are possible. However, only 3 are possible using the hardware waveform generators. There are 4 output compare registers but two of them have waveform generators that attach to the same pins.

Anyway, yes, I've figured out how to get 4 in principle. You need to leave the 4th compare register detached from the pin, and enable its(the register not the pin) interrupt, and use the interrupt to bit-bang the OTC pin. In phase mode you need to keep track of ups and downs. (why are we using phase-correct mode though?)

It's not too bad really. The datasheet recommends against it because it will keep the CPU busy. On the other hand, what else is this CPU busy doing hunh? It's not like we're going to connect these lights to SETI are we? I shouldn't ask.

Sigh.. the tripple version was clearly whipped up a littel quickly to work and was no longer compatible with single and double versions anyway, so I've started cleaning that all up and adding capability for a fourth channel too. It does mean ramps don't have nice names anymore but are just RAMP_PWM1 ... etc, but calling it 7135s just inhibits keeping the code flexible.

I've also simplified the defines to maybe make configuring creative driver setups a bit easier. I don't promise TK would approve of all the changes. Maybe someday I'll even finish something.

Oh someone asked about frequency. As far as I can tell bistro tripple is running at CPU frequency. The PWM ramps up to 255, but the 7135 and 7135s are in phase mode so it ramps up and down, so that's a frequency of 8Mhz/500 so 16khz. The FET doesn't have a phase correct option and appears to me to be running at 32 khz! Unless I'm missing something.

This is one of the examples I found that created four pwm outputs on the 85.

http://www.technoblogy.com/show?LE0

This stuff gets a little silly now:

#ifdef PWM4_LVL
inline void set_output(uint8_t pwm1, uint8_t pwm2, uint8_t pwm3, uint8_t pwm4) {
#elif defined(PWM3_LVL)
inline void set_output(uint8_t pwm1, uint8_t pwm2, uint8_t pwm3) {
#elif defined(PWM2_LVL)
inline void set_output(uint8_t pwm1, uint8_t pwm2) {
#else
inline void set_output(uint8_t pwm1,) {
#endif


but it actually does save a few bytes over using globals. It kind of just went from one to two, and then someone hacked a third on, and now it's kind of silly.

Exactly the way I've headed with it. Interrupt for the 4th, like I said. Apparently I can figure that out, but not how to end a quote after a link.

Ok, it's now configurable to use any combination of 4 outputs, trying to get the hardware defines more simplified and flexible too.

Oh ha, and this was another example of software PMW on four channel.

Seems you have surpassed this info already though. Great work!

You had one too many end-quotes. :wink:

This all sounds great Flintrock! I gotta get a looksy when you post it all. Quick read of the article as well...

Well, distracted with this

https://budgetlightforum.com/t/-/44174

And by the way, things are bit broken now. I said I implemented it, but I've done a bunch of "clean" up and reorganizing and who knows how long it will take me to recover from that. I haven't even tried to run it yet. I already know of one thing I broke (a feature that I added though), but I'm not going backwards. I'll twiddle at getting it all in shape as I get time.

thats way over my head lol

:FACEPALM: It ended up being just a dumb mistake. After all that I deleted it. I just didn't have optimization on at the time, doh.

Some days are like that programming. You know like when waste a bunch of time just to figure out the program you're running is in a different directory than the one you're compiling, which explains why the last 10 ways you tried to fix it didn't work. I'm pretty sure anyone who's programmed much has done that one before... or maybe it's just me.

I can vouch for that, for sure.... Was gonna ask bout the S optimize setting, but thought that was little insulting . Anything one could get wrong, I've done, I'm sure. All a matter of how fast you can figure it out. Many times I come in the next morning and it's obvious, staring me in the face.

So here's a new one. Vcc ADC reading seems to mess with the light a bit.

I did of bunch of recent changes without testing, just getting the code organized, surprised things mostly work still, but they seem to. Except the light had a pule, a heartbeat. After burning through another 20 flashes on this poor attiny's life it boiled down to the adc being on and set to the Vcc reference, and having changed the timing of things I noticed now when not before. In fact I intentionally was cycling the ADC on longer between voltage and thermal mode to stabilize readings, but that's the heartbeat. Of course ADC_on was the last thing I suspected. It seems that an adc reference on the Vcc pin is disturbing the electronics and dims (we don't want dim) the light a little.

It's a full single 7135 mode, no PWM. Being a regulator I'd hope it wouldn't be too sensitive to a little voltage fluctuation. I have found these things are pretty finicky,very easy to break entirely. Maybe I should replace the 7135 and see what happens.

Sorry if I missed something, but if the opamp gives use true regulation, why do we need a 7135? Couldn't the FET give use everything we need?

The opamp driver is not released yet, DEL has not been able to look at it to see if it is even ready for release.

He is dealing with the normal Avenger driver.

Oops! Yea, I'm getting things confused...

Well, just bugs.. just crammed too much new stuff in here all at once.

I hope that I’am in the right thread. Does anybody get the lvp working for 6V configuration with 36k/4,7k Resistors? For example with blf-a6 firmware. I would be glad to see the code. Thank you guys!