Skip to content

Commit

Permalink
Added 256 Bytes read/write support
Browse files Browse the repository at this point in the history
  • Loading branch information
glegrain committed Jun 23, 2017
1 parent 6c91c69 commit 785d08b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Inc/bootloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ 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 nob, uint8_t *pData);
void BL_ReadMemory_Command(uint32_t address, uint32_t nob, uint8_t *pData);
void BL_Go_Command(uint32_t address);
void BL_WriteMemory_Command(uint32_t address, uint8_t nob, uint8_t *pData);
void BL_WriteMemory_Command(uint32_t address, uint32_t nob, 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);
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ 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 nob, uint8_t *pData);
void BL_ReadMemory_Command(uint32_t address, uint32_t nob, uint8_t *pData);
void BL_Go_Command(uint32_t address);
void BL_WriteMemory_Command(uint32_t address, uint8_t nob, uint8_t *pData);
void BL_WriteMemory_Command(uint32_t address, uint32_t nob, 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);
Expand Down
10 changes: 5 additions & 5 deletions Src/bootloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ uint16_t BL_GetID_Command(void)
/**
* @brief Read data from any valid memory address
* @param address: start address
* @param nob: number of bytes to be read
* @param nob: number of bytes to be read from 1 to 256
* @param pData: pointer to destination data buffer
* @retval None
*/
void BL_ReadMemory_Command(uint32_t address, uint8_t nob, uint8_t *pData)
void BL_ReadMemory_Command(uint32_t address, uint32_t nob, uint8_t *pData)
{
uint8_t cmd_frame[3];
uint8_t addr_frame[5];
Expand Down Expand Up @@ -157,8 +157,8 @@ void BL_ReadMemory_Command(uint32_t address, uint8_t nob, uint8_t *pData)
wait_for_ack();

/* Send data frame: number of Bytes to be read (1 Byte) + checksum (1 Byte) */
nob_frame[0] = (nob - 1U);
nob_frame[1] = (nob - 1U) ^ 0xFFU;
nob_frame[0] = (uint8_t) (nob - 1U);
nob_frame[1] = (uint8_t) (nob - 1U) ^ 0xFFU;
HAL_SPI_Transmit(SpiHandle, nob_frame, 2U, 1000U);

/* Wait for ACK or NACK frame */
Expand Down Expand Up @@ -208,7 +208,7 @@ void BL_Go_Command(uint32_t address)
* @param pData: pointer to source data pointer
* @retval None
*/
void BL_WriteMemory_Command(uint32_t address, uint8_t nob, uint8_t *pData)
void BL_WriteMemory_Command(uint32_t address, uint32_t nob, uint8_t *pData)
{
uint8_t cmd_frame[3];
uint8_t addr_frame[5];
Expand Down

0 comments on commit 785d08b

Please sign in to comment.