Guillaume Legrain

STM32 SPI Bootloader host

Blog Post created by Guillaume Legrain Employee on May 2, 2017

This example project acts as a STM32 bootloader SPI host to communicate with another STM32 MCU configured to boot in system memory. The code provided in this example can be programmed onto a STM32L476RG-Nucleo and will use SPI1 as a default interface. The bootloader library can be used with any other STM32 MCU.

 

The project can be found on my GitHub repository.

 

Library functions:

 

void     BL_Init(SPI_HandleTypeDef *hspi);
void     BL_Get_Command(uint8_t *pData);
uint8_t  BL_GetVersion_Command(void);
uint16_t BL_GetID_Command(void);
void     BL_ReadMemory_Command(uint32_t address, uint8_t ***, uint8_t *pData);
void     BL_Go_Command(uint32_t address);
void     BL_WriteMemory_Command(uint32_t address, uint8_t ***, uint8_t *pData);
void     BL_EraseMemory_Command(uint16_t nb, uint8_t code);
void     BL_WriteProtect_Command(uint8_t nb, uint8_t *codes);
void     BL_WriteUnprotect_Command(void);
void     BL_ReadoutProtect_Command(void);
void     BL_ReadoutUnprotect_Command(void);


NUCLEO Setup:
Nucleo setup

Outcomes