How to name your tiny

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all,

this question my be odd, however, I would like to name my tiny, namely I would like to store which version of program is on it.

I was thinking to put that info as text, number to EEPROM, however, how would I read that back via programmer, therefore, is there a way to change the signature or do something else that is more appropriate?

Best.

Bravo!!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In AS7 under Tools/Device Programming, you can select your programmer and read/write the EEPROM.

Note, you may need to set the fuse EESAVE in order to not erase the eeprom contents when the flash is erased.

 

I often will record the Software Version number into EEPROM along with data logging info so if a product is returned from the field I can dump the log and know what version of the SW was on the unit.

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Optiboot bootloader (https://github.com/Optiboot/optiboot) sticks the version number in a variable in a particular section, and then uses linker magic to put that section at the end of flash:

unsigned const int __attribute__((section(".version")))  
  optiboot_version = 256*(OPTIBOOT_MAJVER + OPTIBOOT_CUSTOMVER) + OPTIBOOT_MINVER;
avr-gcc ... -Wl,--section-start=.version=0x3ffe

 

Then, if there is "extra space" in flash, it'll also just put a text "VERIONS=x.y" string in there too:

#define OPTFLASHSECT __attribute__((section(".fini8")))

OPTFLASHSECT const char f_version[] = "Version=" xstr(OPTIBOOT_MAJVER) "." xstr(OPTIBOOT_MINVER);

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
Note, you may need to set the fuse EESAVE in order to not erase the eeprom contents when the flash is erased.
USERROW isn't erased in unified memory AVR.

USERROW cannot be read via UPDI after the AVR is locked.

ATtiny202/402 Complete via ATTINY402 - 8-bit AVR Microcontrollers

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

All good, thanks, eeprom seems to be the easiest, adhoc solution, however, I am wondering how complicated is to go with the optiboot?

For example, I am using spance konde at tiny core on Arduino...

Best.

Bravo!!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You don't have to use optiboot itself (which only runs on some tinys.)  You can use the same sort of mechanism in any application (though if you DO have a bootloader, the 'absolute location' where you put the version number will need to be adjusted.

 

EEPROM is fine if you don't need it for anything else, and if it doesn't get erased accidentally.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I sometimes add a hidden back door to read out the version on a user led...something like hold this button for 5 sec, then tap it 6 times,  or hold these two buttons down during powerup....then one of the product leds will blink out the software and/or hardware versions...Makes it nice, since nothing extra is required.  If someone calls in, we can investigate their complaint better.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sat. Jun 1, 2019 - 07:59 AM