|
AtMega CAN Bootloader
Well documented CAN-based bootloader for AtMega processors
|
Go to the source code of this file.
Macros | |
| #define | NODE_ADDRESS_MASK 0x007F |
| #define | MPOSCOMMANDBYTE 0x00 |
| #define | MPOSERRORDESCBYTE 0x01 |
Message types for protocol. | |
These define the two message types used by the CAN-bootloader to communicate. | |
| #define | MTYPESDOSLAVE 0x0580 |
| #define | MTYPESDOMASTER 0x0600 |
Message command types. | |
data[0] is always the command. MACTYPERESETNODE 0x02 Data length: 1. Response: N/A Data length 1. Response: 8 bytes data[1] = BL_VERSION_MAJOR; data[2] = BL_VERSION_MINOR; data[3] = BL_VERSION_BUILD; data[4] = boot_signature_byte_get(0x00); data[5] = boot_signature_byte_get(0x02); data[6] = boot_signature_byte_get(0x04); data[7] = NODETYPEDEF; Data length 3. data[1] = Address to read (MSB) data[2] = Address to read (LSB) Response: 4 bytes. data[1] = Address read (MSB) data[2] = Address read (LSB) data[3] = Data from address. MACTYPEWRITEEEPROMBYTE 0x56 Data length 4. data[1] = Address to write (MSB) data[2] = Address to write (LSB) data[3] = Data from address. Response: 4 bytes. data[1] = Address written (MSB) data[2] = Address written (LSB) data[3] = Data from address. MACTYPEREADFLASHBYTE 0x5A Same as MACTYPEREADEEPROM Same as MACTYPEREADEEPROM Same as MACTYPEWRITEEEPROM Data length 2. data[1] = Page to select Response: 2 bytes. data[1] = Selected page. MACTYPEWRITEFLASHPAGE 0x5C Data length 1. Response: 2 bytes | |
| #define | MACTYPERESETNODE 0x02 |
| #define | MACTYPESENDBOOTLOADERVERSION 0x50 |
| #define | MACTYPEREADEEPROMBYTE 0x55 |
| #define | MACTYPEWRITEEEPROMBYTE 0x56 |
| #define | MACTYPEREADFLASHBYTE 0x5A |
| #define | MACTYPESELECTFLASHPAGE 0x5B |
| #define | MACTYPEWRITEFLASHPAGE 0x5C |
| #define | MACTYPEREADBYTEFROMFLASHBUFFER 0x5D |
| #define | MACTYPEWRITEBYTETOFLASHBUFFER 0x5E |
Error codes and responses. | |
0xF0 is command error byte. Second byte is error code.
| |
| #define | MACTYPESENDERROR 0xF0 |
| #define | ERRORBOOTLOADERSESSIONNOTOPEN 0x50 |
| #define | ERRORBOOTLOADERINVALIDDATA 0x51 |
Bootloader protocol message definitions. (license: GPLv2 or LGPLv2.1)
| #define ERRORBOOTLOADERINVALIDDATA 0x51 |
Invalid data.
| #define ERRORBOOTLOADERSESSIONNOTOPEN 0x50 |
Session not open (memory access requested without session).
| #define MACTYPEREADBYTEFROMFLASHBUFFER 0x5D |
Read byte from flash page buffer.
| #define MACTYPEREADEEPROMBYTE 0x55 |
Write byte to EEPROM.
| #define MACTYPEREADFLASHBYTE 0x5A |
Read byte from program memory.
| #define MACTYPERESETNODE 0x02 |
Reset node.
| #define MACTYPESELECTFLASHPAGE 0x5B |
Select flash page.
| #define MACTYPESENDBOOTLOADERVERSION 0x50 |
Request/Send bootloader version and ID information
| #define MACTYPESENDERROR 0xF0 |
Send error
| #define MACTYPEWRITEBYTETOFLASHBUFFER 0x5E |
Write byte to flash page buffer.
| #define MACTYPEWRITEEEPROMBYTE 0x56 |
Read byte from EEPROM.
| #define MACTYPEWRITEFLASHPAGE 0x5C |
Write flash page.
| #define MPOSCOMMANDBYTE 0x00 |
Command byte position. Position of the command byte
| #define MPOSERRORDESCBYTE 0x01 |
Error desctiption byte position. Position of the errpr byte
| #define MTYPESDOMASTER 0x0600 |
Communication from master(NMT) -> slave(node).
| #define MTYPESDOSLAVE 0x0580 |
Communication from slave(node) -> master(NMT).
| #define NODE_ADDRESS_MASK 0x007F |
Mask for separating message TYPE and ID from CAN ID.
1.8.13