Product Comparison: USB I2C | USB SPI | USB GPIO

USB PIC Bootloader. User Manual


7.3.10. BOOT_WRITE_EEPROM command

BOOT_WRITE_EEPROM command is used to write data into microcontroller EEPROM memory.

Before sending the given command you have to fill in boot_cmd_write_eeprom structure:

typedef struct
{
   unsigned char cmd;  /* command code, see BOOT_xxx constants */
   unsigned char echo;  /* echo is used to link between command and response */
   unsigned char addr;  /* EEPROM address to start write to */
   unsigned char size;  /* size of EEPROM data to write */
   unsigned char data[BOOT_CMD_SIZE - 6];
} boot_cmd_write_eeprom;

Fields assignment:

cmd

Command code; the given field must be initialized by BOOT_WRITE_EEPROM constant value.

echo

Package ID. Its value is selected arbitrarily before the command is sent. In the simplest case it is a counter value, increased by one while sending every new command. Bootloader does not analyze this field value. It simply copies it into response. Therefore, when response received, PC program can connect this response to previously sent command.

addr

The address from which EEPROM memory write starts.

size

The size of the data block to write (in bytes).

echo

Data to be written into the microcontroller EERPOM memory.

After this command is processed, Bootloader sends response with code BOOT_WRITE_EEPROM.