Electrical – Attiny85 programming for production

attinyattiny85microcontrollerpcb-design

I have created a prototype PCB with an Attiny85 on board. This Attiny is programmed by the supplier before it is sent to the PCB manufacturer. I received my prototype on friday and it seems that the Attiny on the PCB has a clock speed which is much slower than mine on the breadboard.

Is the desired IC clock specification (e.g 8Mhz internal) not compiled into the HEX files one sends to IC supplier? Does it have to be specified separately?

Best Answer

The HEX files only contain the contents of the flash memory, not the fuses.

In addition to the HEX file you must also supply the values for the fuse bytes. Here is what Digikey requires when requesting pre-programmed parts...

The following information is required for us to program:

1.  A copy of the program on master dip chip and disk or .HEX file via e-mail.
2.  A letter / attachment stating the following information:
a)  Oscillator used
b)  Watchdog timer on or off
c)  Brown out fuse – enable or disable
d)  Power up timer – enable or disable
e)  Checksum
f)  Code protect – on or off

If sending via e-mail, please include a statement of not infringing anyone’s copyrights.

I know this seems backwards and brutish, but so it goes. Most other vendors would prefer an email just giving them the hex values for the 3 fuse bytes. Your email might look like...

Please program and verify the attached HEX file into the ATTINY85 parts. 
Additionally, please program and verify the fuse bytes with the following values...

LOW:      0x62
HIGH:     0xDF
EXTENDED: 0xFF

You can get these bytes from one of the many calculators on the internet, using the looking in the "device programming" dialog in Atmel Studio, or reading them from a working device using something like AVRDUDE.

Interestingly, the ELF file format can encapsulate both the flash and fuses in a single file. You can create one of these file in Atmel Studio in Device Programming->Production Files...

enter image description here

Unfortunately I have never seen an ELF filed used by a production programmer. Even AVRDUDE must be coaxed into use the individual values inside the ELF with a command line like...

avrdude -p t85 -c usbtiny -B 6 -U flash:w:firmware.elf:e -U efuse:w:firmware.elf:e - U hfuse:w:firmware.elf:e -U lfuse:w:firmware.elf:e