crycode-de / mcp-can-boot

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

Read MCU_ID in program #11

Closed fabehr closed 9 months ago

fabehr commented 9 months ago

Is it possible to read MCU_ID in uploaded program, when bootloader was flashed with fixed MCU_ID value set in config.h or should I reflash it to read MCU_ID from eeprom?

I'd like to use MCU_ID in program as can message ID.

crycode-de commented 9 months ago

No, you can't read the fixed MCU_ID directly from you main program. Maybe you could read the flash section containing the bootloader code but then you need to know the exact address where the ID is stored...

As you mentioned, you should store the MCU_ID in the EEPROM and read it from there in the bootloader and you main program. This should be easier to implement and more reliable.

fabehr commented 9 months ago

Thanks, so I will reflash my module to use eeprom to store mcu id 😉