Page 1 of 1

fuse bytes

Posted: 17 February 2019, 16:30 PM
by rich
Is there a way to read the fuse byte with ZBasic code for the 328p device?

Ricahard

Re: fuse bytes

Posted: 17 February 2019, 17:46 PM
by dkinzer
rich wrote:Is there a way to read the fuse byte with ZBasic code for the 328p device?
There is no ZBasic function that allows direct reading of the fuse bytes. However, there is a multi-step process that you can use to read a fuse byte, one that requires a little assembly language code and also requires interrupts to be disabled temporarily. See section 25.2.2 of the ATmega328P datasheet.

http://ww1.microchip.com/downloads/en/D ... asheet.pdf

If you need some help writing the assembly language code, I can provide some early in the week - I'm traveling at the moment.

Posted: 19 February 2019, 17:20 PM
by dkinzer
The attached .zip file contains a ZBasic project that demonstrates how to read fuse bytes and the lock byte on a ZX328N. The functionality is implemented in an AVR assembly language file (that may need to be modified for other base devices). It has been tested on a ZX328N and seems to produce the correct results.

Posted: 20 February 2019, 14:10 PM
by dkinzer
The attached .zip file is another implementation of the code to retrieve fuse bytes. This one doesn't use an assembly language file but does use some inline C code that utilizes some knowledge of the generated names for parameters and return values.

As with the last one, it is written specifically for the ATmega328P-based devices and might need some minor changes for other devices.

Posted: 22 February 2019, 8:54 AM
by rich
Thank you much Don.

Your support is amazing.

Richard