crycode-de / mcp-can-boot

CAN bus bootloader for AVR microcontrollers attached to an MCP2515 CAN controller.
Other
33 stars 12 forks source link

Different Value Of Extended Fuse Required On Atmel #13

Closed ptoshkov closed 5 months ago

ptoshkov commented 5 months ago

Dear all,

Thank you for the lovely project you have created.

My device is Arduino Uno R3 with microcontroller Atmel ATmega328P.

With the fuse settings in platformio.ini, flashing over CAN does not work.

[env:ATmega328P] board = ATmega328P build_flags = ${env.build_flags} -Wl,--section-start=.text=0x7000 ; 2048 words bootloader, 0x3800 * 2 ;board_fuses.lfuse = 0xFF ;board_fuses.hfuse = 0xD8 ;board_fuses.efuse = 0xFC

For the fuse "efuse", I had to use the value "0xFD" for the flashing over CAN to work.

crycode-de commented 5 months ago

Hi, the fuse values in platformio.ini are only examples and need be adjusted according your hardware. Therefore they are commented out by default.

The only relevant fuse bits for the bootloader itself are BOOTRST, BOOTSZ0 and BOOTSZ1 in the hfuse byte.

For ATmega328P in the efuse byte only the brown-out detection level is defined. See AVR Fuse Calculator for reference.

ptoshkov commented 5 months ago

Ok, makes sense 👍