Attiny25/45/85 FW Development Thread

1911 posts / 0 new
Last post
Flintrock
Offline
Last seen: 11 months 1 week ago
Joined: 09/10/2016 - 20:29
Posts: 1544

differences in attiny hex

 

So I now have a Makefile automating builds of several configurations  in combination with several chips (with for example: -DCONFIG_FILE="bistro-custom.h"  -DATTINY=25) .  For what it's worth, my code built for the attiny45 and attin85 differs by about three bytes in the instruction payload of the hex files.  I haven't bothered to figure out what those bytes are, but obviously there can be some memory address differences at least, but I just don't know.  The attiny25 file is different, and for that I knew at least one reason, the attiny25 uses an 8 bit stack pointer and the 45 and 85 use 16. I access the stack pointer so in this case there's even different source code.  Will and attiny45 hex work on an attiny85 without problems?  I don't know, but at this point I wouldn't try it unless I had to.

 

 

Flintrock
Offline
Last seen: 11 months 1 week ago
Joined: 09/10/2016 - 20:29
Posts: 1544

No luck on this 7135 thing yet.  I hoped it was a software issue, but it doesn't seem to be.  I went back to the old test rig with no back-side 7135's using latest firmware, and also tried an older version firmware with the new driver.  The test board works fine, with the all7135s channel on, with no actual 7135s on it.  Just to see, instead of shutting down all channels right before sleeping I turned on turbo instead.  It really shouldn't matter, and it didn't. 

 

About the best idea I have is get the driver to self trigger a shutdown.  by sending input power through a second channel FET.  Then it's possible to time the shutdown detection.  Mostly that would just prove what already seems true though, but still wouldn't explain it. This is really puzzling.  

 

 

Flintrock
Offline
Last seen: 11 months 1 week ago
Joined: 09/10/2016 - 20:29
Posts: 1544

a crud.. never mind.  I thought I had progress on this 7135 thing, but I think I fooled myself.  Anyway, I'll keep playing with it.

 

Anyway, I found  diagnostic tool.  I can sneak in a  Vcc ADC read in the interrupt right between detecting the shutdown and powering off.  It's working, although no time to interpret it now. It should give insight into how much time and charge is lost before the shutdown. I could make use a couple actually, like one after the first wake, and get a read on how much drain is happening during sleep that way too.

Flintrock
Offline
Last seen: 11 months 1 week ago
Joined: 09/10/2016 - 20:29
Posts: 1544

So some interesting results.  Unless I'm getting completely fooled, like the interrupt is firing at all the wrong times (TURBO works so it can't be all broken) I think I'm measuring the voltage on C2 immdiately after the pin fall is detected.

 

I first had to calibrate my Vcc read real well (which uncovered a slight bug in the calibration function, but almost irrelevant really).  Anyway 

In turbo I'm getting:

 

Input Voltage     Vcc Catch voltage

4.0                    3.06

3.06                  2.71

 

On All7135s I'm getting almost the same

 

Input Voltage     Vcc Catch voltage

4.0                    3.00

3.06                  2.60

 

I find it interesting that the 4.0V reading does relatively badly compared to the 3 V readings in both cases.  But what's more interesting is that there doesn't seem to be any serious problem here with the 7135s, and yet there is.  This helps though, because if this holds up it at least points to what's not the problem, power down detection time, unless that 0.1V is really a big deal, I wouldn't think so.

 

This seems to be a good tool.  I'll continue, trying to measure voltage at the first power-on and see what that looks like.

(just updated numbers to uncorrect for the diode, so these are real voltages on the Vcc pin now.)

Flintrock
Offline
Last seen: 11 months 1 week ago
Joined: 09/10/2016 - 20:29
Posts: 1544

SOLVED!!!

 

Yes.  I got it.  Just had to find the right pin state to get the driver pins into after shutdown detection.  Apparently output low doesn't work (or output PWM 0, should be the same thing).  I have no idea why not.  Input high is documented as a good option because it's high impedance and avoids supposedly problematic middle voltages (input low actually means input floating).  And yet, the solutions was input low.  It maybe helped that I shutdown the 7135's first pulling them down with a quick output low first, I don't know.

 

Anyway, it not only works, it works great.  You can whistle a couple of line of Dixie before you turn you light back on.  I've got the code in a bit of a mess at the moment from all kinds of testing, so I'll probably start over from the last release and add things and test, might take a couple of days, might not, but I think we'll have OTSM working great in bistro here shortly.

 

I keep recompiling and reflashing this same ROM and keeping checking that it's really in ALL7135s because I keep thinking I must be confused, but it's working.

 

Updated: It actually works over 4s at 3.0V without a bleeder (~4K of divider resistance) and 160C heat gun pointed at it!  

Big Smile

MRsDNF
MRsDNF's picture
Offline
Last seen: 4 hours 34 min ago
Joined: 12/22/2011 - 21:18
Posts: 12600
Location: A light beam away from the missus in the land of Aus.

I have no idea what you are talking about Flintrock but your writing tells me you are excited and that can only mean one thing. Your onto a winner. well done. Thumbs Up

My current and or voltage measurements are only relevent to anything that I measure.

Budget light hobby proudly sponsored by my Mastercard and unknowingly paid for by a hard working wife. 

djozz said "it came with chinese lettering that is chinese to me".

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

Flintrock
Offline
Last seen: 11 months 1 week ago
Joined: 09/10/2016 - 20:29
Posts: 1544

Thanks MRsDNF.  

 

OTSM.  (I think TA named it that).  I think it means off-time sleep mode or something like that.  It's the replacement for OTC in bistro HD.  It means that the length of a medium click is as steady as the watchdog timer, which as far as I can tell is about 10% even when hot, which is much better than many caps.  It's also not sensitive to all the resistor tuning that the OTC is, so should eliminate those headaches.  

 

I've got the first low-capacitance bistro Texas Avenger OTSM light ever right here in my hand, working just fine.  I thought the issues were worked out several weeks ago, but it hit a snag when applied to a real light. The snag is now defeated.

 

These fixes will of course get posted up to the bistro-HD thread shortly.

 

MRsDNF
MRsDNF's picture
Offline
Last seen: 4 hours 34 min ago
Joined: 12/22/2011 - 21:18
Posts: 12600
Location: A light beam away from the missus in the land of Aus.

Thanks for the explanation. Now to remember it. Thumbs Up

My current and or voltage measurements are only relevent to anything that I measure.

Budget light hobby proudly sponsored by my Mastercard and unknowingly paid for by a hard working wife. 

djozz said "it came with chinese lettering that is chinese to me".

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

Justintoxicated
Justintoxicated's picture
Offline
Last seen: 2 weeks 4 days ago
Joined: 12/28/2016 - 19:36
Posts: 79
Location: California

12v jobbers isn't a term I can google to fix my bricked chip /board (I tried to do a flash and I think I bricked my chip)  What do I need to fix my driver board?  It's a 17DD MTN Fet + 7135.  

 

 

Mike C
Mike C's picture
Offline
Last seen: 2 days 3 hours ago
Joined: 01/22/2014 - 08:03
Posts: 2080
Location: Sweden

I built a high voltage serial programmer to deal with that stuff: https://arduinodiy.wordpress.com/2015/05/16/high-voltage-programmingunbr...

However, if it’s one driver you’re talking about it’s cheaper and less frustrating to just get a new one. I used the reset pin quite a lot on the ATtiny85 so I needed this in order to be able to flash after activating reset pin as IO.

Flashy Mike
Flashy Mike's picture
Offline
Last seen: 6 hours 18 min ago
Joined: 01/14/2016 - 16:38
Posts: 1158
Location: Germany

Edit: false alarm, read here .

Have to reanimate this thread, I guess.
Did anybody take the dependency between voltage and temperature readings on Attiny25/85 into account?

For my 2018 BLF Contest light I developed bluetooth remote control with telemetry. Voltage and temperature readings are sent to the app once per second. I noticed a significant dependency between voltage and temperature. Here a couple of readings for roughly the same temperature:

at 4.6 V temperature reading is 13 °C
at 3.6 V temperature reading is 27 °C
at 2.7 V temperature reading is 33 °C

As you can see the dependency is not linear. When I find some time I’ll do more research.
For now I’d say this dependency might interfere with temperature regulation.

Mike C
Mike C's picture
Offline
Last seen: 2 days 3 hours ago
Joined: 01/22/2014 - 08:03
Posts: 2080
Location: Sweden

I didn’t care much about it. On the other hand I don’t recall getting such wild variations, but since I haven’t touched the 85 in ages my brain has purged most of that stuff. I’m sitting with my ATtiny1634 drivers right now so I just tested: 20°C at 2.6V and 22°C at 4.4V, nothing for me to worry about.

Flashy Mike
Flashy Mike's picture
Offline
Last seen: 6 hours 18 min ago
Joined: 01/14/2016 - 16:38
Posts: 1158
Location: Germany

Do you use Noise Reduction Sleep Mode for temperature readings? I don’t do this currently but might give it a try.

Mike C
Mike C's picture
Offline
Last seen: 2 days 3 hours ago
Joined: 01/22/2014 - 08:03
Posts: 2080
Location: Sweden

No I don’t. Have you allowed a settling time when switching between voltage and temperature readings? At least on the 1634 it’s important if you are reading voltage by connecting internal voltage reference to the ADC and using MCU voltage as reference. I read voltage on 1S lights this way and if I don’t have a delay I’d get funky results. 1634 datasheet specifies 1ms settling time, I have a 2ms delay just to be sure. I’m not in a hurry.

This will probably not help if the results you posted are always consistent but at the moment I can’t think of anything else.

Flashy Mike
Flashy Mike's picture
Offline
Last seen: 6 hours 18 min ago
Joined: 01/14/2016 - 16:38
Posts: 1158
Location: Germany

Yes, I have this 1 ms delay in my code. Anyway -

I have to apologize for crying wolf.

After some more research – including the noise reduction sleep mode – I checked the temperature readings again in my battery driven final light setup and the readings turned out normal (without noise reduction), without much deviation at different voltage levels. But the wrong readings are still there in my test setup on breadboard. So the reason must be somewhere in this test setup, don’t know yet if its the test setup itself or if its the USBASP connected to the breadboard which is causing the noise. And it must be noise causing the weird readings since they are normal even in my test setup when I use the noise reduction sleep mode.

Thanks for your help, Mike!

Flashy Mike
Flashy Mike's picture
Offline
Last seen: 6 hours 18 min ago
Joined: 01/14/2016 - 16:38
Posts: 1158
Location: Germany

Flashy Mike wrote:
Yes, I have this 1 ms delay in my code.

Actually I do this delay only when measuring voltage internally since Atmel says in the specs it is required when measuring Vbg against Vcc. As I understand the specs this delay is not required for measuring temperature against Vbg. (I’m refering to Attiny85 specs).
Mike C
Mike C's picture
Offline
Last seen: 2 days 3 hours ago
Joined: 01/22/2014 - 08:03
Posts: 2080
Location: Sweden

Glad it’s sorted. You’re right about the delay, according to the datasheet it’s only required when switch to internal voltage reference, it says nothing about from. For me it doesn’t matter though, I have 2ms to spend after each conversion regardless if I’m reading voltage or temperature.

staticx57
Offline
Last seen: 53 min ago
Joined: 04/11/2016 - 00:43
Posts: 530
Location: New Jersey, United States

Anyone ever release a candle flicker mode for a clicky firmware? Or just Anduril at this point?

If not, how easy would it be to port Anduril code to Bistro (HD) nothing fancy just the flickery output

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 57 min 52 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8247
Location: (469219) 2016 HO3

staticx57 wrote:
Anyone ever release a candle flicker mode for a clicky firmware? Or just Anduril at this point?

If not, how easy would it be to port Anduril code to Bistro (HD) nothing fancy just the flickery output

It shouldn’t be too hard, assuming there’s space in the ROM. Basically just take code from the candle mode’s EV_tick handler, put it in a loop, and add a 16ms delay between frames.

This, um, also assumes some other things though… like the existence of a function to set the output level in ~150 visually-linear steps, without the caller having to worry about how that’s actually implemented in the hardware.

staticx57
Offline
Last seen: 53 min ago
Joined: 04/11/2016 - 00:43
Posts: 530
Location: New Jersey, United States

Thank you for direction. Hopefully I’ll get it Big Smile

Pages