Classes |
struct | CANmsg |
| Structure to store an incoming or outgoing CAN messages. More...
|
union | CANmsg::msg_data |
Defines |
#define | BAUD_RATE_PRESCALER 1 |
#define | CAN_BRP 0x02 |
#define | CAN_CONFIG_MODE 0b10000000 |
#define | CAN_DISABLE_MODE 0b00100000 |
#define | CAN_LISTEN_MODE 0b01100000 |
#define | CAN_LOOPBACK_MODE 0b01000000 |
#define | CAN_MODE CAN_MODE_LEGACY |
#define | CAN_NORMAL_MODE 0b00000000 |
#define | CAN_PHSEG1 0x01 |
#define | CAN_PHSEG2 0x02 |
#define | CAN_PROPSEG 0x06 |
#define | CAN_SAM 0x00 |
#define | CAN_SEG2PHTS 0x00 |
#define | CAN_SJW 0x01 |
#define | CANTX_DRIVE CANTX_DRIVE_VDD |
#define | CFGS 6 |
#define | EEPGD 7 |
#define | GIE 7 |
#define | PHASE_SEGMENT_1 6 |
#define | PHASE_SEGMENT_2 6 |
#define | PROPAGATION_SEGMENT 7 |
#define | RD 0 |
#define | RECEIVE_BUFFER_MODE RECEIVE_STANDARD_MESSAGES |
#define | RXFUL 7 |
#define | SAMPLE_TIMES SAMPLE_THRICE |
#define | SEG2PHTS SEG2PHTS_FREE |
#define | SYNC_JUMP_WIDTH SYNC_JUMP_WIDTH_2X |
#define | TXREQ 3 |
#define | WR 1 |
#define | WREN 2 |
Enumerations |
enum | BOOTLOADER_COMMAND {
WRITE_FLASH_DATA_COMMAND = 0x00,
READ_FLASH_COMMAND = 0x01,
ERASE_FLASH_COMMAND = 0x02,
RESET_COMMAND = 0x03,
READ_VERSION_COMMAND = 0x04,
WRITE_FLASH_ADDRESS_COMMAND = 0x05,
MAGIC_PACKET = 0x0A,
WRITE_FLASH_DATA_COMMAND = 0x00,
READ_FLASH_COMMAND = 0x01,
ERASE_FLASH_COMMAND = 0x02,
RESET_COMMAND = 0x03,
READ_VERSION_COMMAND = 0x04,
WRITE_FLASH_ADDRESS_COMMAND = 0x05,
START_FLASH_WRITE_COMMAND = 0x06,
MAGIC_PACKET = 0x0A
} |
enum | CAN_MODE_VALUES { CAN_MODE_LEGACY = 0b00000000,
CAN_MODE_ENHANCED_LEGACY = 0b01000000,
CAN_MODE_ENHANCED_FIFO = 0b10000000
} |
enum | CAN_WAKE_VALUES { CAN_WAKE_ENABLE = 0b00000000,
CAN_WAKE_DISABLE = 0b10000000
} |
enum | CANTX_DRIVE_VALUES { CANTX_DRIVE_VDD = 0b00100000,
CANTX_DRIVE_TRI_STATE = 0b00000000
} |
enum | ECAN_RX_MSG_FLAGS {
ECAN_RX_OVERFLOW = 0b00001000,
ECAN_RX_INVALID_MSG = 0b00010000,
ECAN_RX_XTD_FRAME = 0b00100000,
ECAN_RX_RTR_FRAME = 0b01000000,
ECAN_RX_DBL_BUFFERED = 0b10000000
} |
enum | RECEIVE_BUFFER_MODE_VALUES { RECEIVE_ALL_MESSAGES = 0b01100000,
RECEIVE_EXTENDED_MESSAGES = 0b01000000,
RECEIVE_STANDARD_MESSAGES = 0b00100000
} |
enum | SAMPLE_TIMES_VALUES { SAMPLE_ONCE = 0b00000000,
SAMPLE_THRICE = 0b01000000
} |
enum | SEG2PHTS_VALUES { SEG2PHTS_FREE = 0b10000000,
SEG2PHTS_CALC = 0b00000000
} |
enum | SYNC_JUMP_WIDTH_VALUES { SYNC_JUMP_WIDTH_1X = 0b00000000,
SYNC_JUMP_WIDTH_2X = 0b01000000,
SYNC_JUMP_WIDTH_3X = 0b10000000,
SYNC_JUMP_WIDTH_4X = 0b11000000
} |
Functions |
static void | acknowledge_packet (void) |
static void | can_init (void) |
static void | erase_flash (void) |
static void | handle_can_msg (void) |
void | main (void) |
static int8u | read_eeprom (int8u address) |
static void | read_flash (void) |
void | send_bootloader_hello_message (void) |
static void | sendCanMsg (void) |
void | serious_error (void) |
void | VIntH (void) |
void | VIntL (void) |
static int8u | we_should_boot (void) |
static void | write_eeprom (void) |
static void | write_flash_address (void) |
static void | write_flash_data (void) |
Variables |
struct CANmsg | CanMsgR |
| Structure to store CAN message just received.
|
struct CANmsg | CanMsgT |
| Structure to store CAN message to be transmitted.
|
int8u | motor_id = 0xFF |
| motor_id will be read from the EEPROM at boot time.
|
int8u | position = 0x00 |
| this is the position of the current FLASH_WRITTING operation ( 0 <= position <= 32)
|
This function writes to the EEPROM memory The only goal of this function is to write something different than 0xFF at the last memory location in EEPROM. This happens right after a flashing operation has been successfull, to make sure that at the following reboot of the PIC18F, it will boot directly to the user application and not stay in bootloader mode.
This function writes 0x42 to the last byte (address 0xFF).
- Author:
- Yann Sionneau
Definition at line 463 of file boot.c.