AtMega CAN Bootloader
Well documented CAN-based bootloader for AtMega processors
loaderconfiguration.h File Reference
#include <avr/io.h>

Go to the source code of this file.

Macros

CAN bus speed.

Determines the speed for the can bus.

This options determines the speed for the CAN bus. For autobauding use the definition CAN_AUTOBAUD or 0.

#define CAN_BAUDRATE   250
 
CAN transciever enable.

CAN transciever hardware enable control.

If your CAN transciever has enable/disable functionality that can be controlled by GPIO, use these defines to set the correct port and IO for that. This will enable the transciever only after init has been completed succesfully. If you use autobauding, the transciever will be enable immediately after startup.

#define CANRS_PORT   PORTD
 
#define CANRS_DDR   DDRD
 
#define CANRS_PIN   PIND0
 
CAN chip hardware config.

Pin definitions for the on chip can hardware.

Set these per processor. Default is AtMega64C1 and equivalent.

#define CAN_PORT_IN   PINC
 
#define CAN_PORT_DIR   DDRC
 
#define CAN_PORT_OUT   PORTC
 
#define CAN_INPUT_PIN   2
 
#define CAN_OUTPUT_PIN   3
 
CAN chip MOB config.

Message object buffer definitions.

Set these per processor. Default is AtMega64C1 and equivalent. The number of TX buffers is determined by subtracting the amount of RX buffers from the total amount.

#define NB_MOB   6
 
#define NB_RX_MOB   4
 
Can based debug message filtering.

Filter CAN based debug messages (ID 0x80)

Keep this define to use a software filter to filter out CAN debug messages used by the full protocol. Delete this in your own implementation or if you wish to receive all messages.

Version information for bootloader.

Bootloader version information.

Change these to modify your bootloader version number that is reported in the response message from the node when a session open is requested.

Note
Remember to update the documentation version also when incrementing this.
#define BL_VERSION_MAJOR   0
 
#define BL_VERSION_MINOR   1
 
#define BL_VERSION_BUILD   0
 
Node type definition (node identification byte).

Change this to identify the module type you are about to flash. Can be any uint8_t value. This will also be reported in the response message from the node.

Todo:
Enum?
#define NODETYPEDEF   0x00
 
Calculated number of flash pages.

Calculated number of flash pages calculated by dividing the flash end by the amount of bytes in a page.

#include <avr/io.h>
Note
Processor defintion files should make this work on all Atmega devices.
#define SPM_MAXPAGES   (FLASHEND / SPM_PAGESIZE)
 
EEPROM parameter placement.

Change these to decide where to place the node ID and bootloader activation byte in the EEPROM memory.

#define EEPROM_BOOTLOADER_ENABLE_ADDRESS   (uint8_t *)(0)
 
#define EEPROM_BOOTLOADER_ENABLE_ADDRESS_LEN   1
 
#define EEPROM_NODEID_ADDRESS   (uint8_t *)(EEPROM_BOOTLOADER_ENABLE_ADDRESS + EEPROM_BOOTLOADER_ENABLE_ADDRESS_LEN)
 
#define EEPROM_NODEID_ADDRESS_LEN   1
 

Detailed Description

Can bootloader configuration. (license: GPLv2 or LGPLv2.1)

Version
0.1.0
Author
Tuomas Huuki tuoma.nosp@m.s.hu.nosp@m.uki@p.nosp@m.roxi.nosp@m.mia.f.nosp@m.i
See also
http://proximia.fi

Macro Definition Documentation

◆ BL_VERSION_BUILD

#define BL_VERSION_BUILD   0

Bootloader build version.

◆ BL_VERSION_MAJOR

#define BL_VERSION_MAJOR   0

Bootloader version major.

◆ BL_VERSION_MINOR

#define BL_VERSION_MINOR   1

Bootloader version minor.

◆ NODETYPEDEF

#define NODETYPEDEF   0x00

Node type.