1
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ You must specify the "fuses". There is a fuse for the default clock selection and also a fuse for dividing the clock by 8. You can see these in the programming dialog in the IDE under "Fuses". \$\endgroup\$ – Wossname Sep 12 '16 at 9:16
  • \$\begingroup\$ So the fuses must be specified to the IC supplier/programmer independently of the HEX files? \$\endgroup\$ – Kafros Sep 12 '16 at 9:18
  • \$\begingroup\$ I would have expected the company to have at least asked you if you wanted any specific fuses set if you hadn't told them. I would always explicitly tell them what fuses to use. Look where it says "EXTENDED / HIGH / LOW" in the dialog, once you have chosen the fuses you are happy with, give those 3 hex values to the person doing your chip programming. \$\endgroup\$ – Wossname Sep 12 '16 at 9:23
  • 1
    \$\begingroup\$ I believe *.hex files just have code, full project is in *.elf including code, fuses, E2PROM... \$\endgroup\$ – carloc Sep 12 '16 at 13:35
1
\$\begingroup\$

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
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.