STM32303C_EVAL BSP User Manual: Exported Functions

STM32303C EVAL BSP Drivers

STM32303C_EVAL BSP User Manual
Exported Functions

Functions

uint32_t BSP_EEPROM_Init (void)
 Initializes peripherals used by the EEPROM device selected.
void BSP_EEPROM_SelectDevice (uint8_t DeviceID)
 Select the EEPROM device to communicate.
uint32_t BSP_EEPROM_ReadBuffer (uint8_t *pBuffer, uint16_t ReadAddr, uint32_t *NumByteToRead)
 Reads a block of data from the EEPROM device selected.
uint32_t BSP_EEPROM_WriteBuffer (uint8_t *pBuffer, uint16_t WriteAddr, uint32_t NumByteToWrite)
 Writes buffer of data to the EEPROM device selected.
__weak void BSP_EEPROM_TIMEOUT_UserCallback (void)
 Basic management of the timeout situation.
void EEPROM_I2C_IO_Init (void)
 Initializes peripherals used by the I2C EEPROM driver.
HAL_StatusTypeDef EEPROM_I2C_IO_WriteData (uint16_t DevAddress, uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize)
 Write data to I2C EEPROM driver.
HAL_StatusTypeDef EEPROM_I2C_IO_ReadData (uint16_t DevAddress, uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize)
 Read data from I2C EEPROM driver.
HAL_StatusTypeDef EEPROM_I2C_IO_IsDeviceReady (uint16_t DevAddress, uint32_t Trials)
 Checks if target device is ready for communication.
void EEPROM_SPI_IO_Init (void)
 Initializes the EEPROM SPI and put it into StandBy State (Ready for data transfer).
void EEPROM_SPI_IO_WriteByte (uint8_t Data)
 Write a byte on the EEPROM.
uint8_t EEPROM_SPI_IO_ReadByte (void)
 Read a byte from the EEPROM.
HAL_StatusTypeDef EEPROM_SPI_IO_WriteData (uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize)
 Write data to SPI EEPROM driver.
HAL_StatusTypeDef EEPROM_SPI_IO_ReadData (uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize)
 Read data from SPI EEPROM driver.
HAL_StatusTypeDef EEPROM_SPI_IO_WaitEepromStandbyState (void)
 Wait response from the SPI EEPROM.
void EEPROM_SPI_IO_WriteDummy (void)

Function Documentation

uint32_t BSP_EEPROM_Init ( void  )

Initializes peripherals used by the EEPROM device selected.

Return values:
EEPROM_OK(0) if operation is correctly performed, else return value different from EEPROM_OK (0)

Definition at line 193 of file stm32303c_eval_eeprom.c.

References EEPROM_FAIL, and EEPROM_DrvTypeDef::Init.

uint32_t BSP_EEPROM_ReadBuffer ( uint8_t *  pBuffer,
uint16_t  ReadAddr,
uint32_t *  NumByteToRead 
)

Reads a block of data from the EEPROM device selected.

Parameters:
pBufferpointer to the buffer that receives the data read from the EEPROM.
ReadAddrEEPROM's internal address to start reading from.
NumByteToReadpointer to the variable holding number of bytes to be read from the EEPROM.
Note:
The variable pointed by NumByteToRead is reset to 0 when all the data are read from the EEPROM. Application should monitor this variable in order know when the transfer is complete.
Return values:
EEPROM_OK(0) if operation is correctly performed, else return value different from EEPROM_OK (0) or the timeout user callback.

Definition at line 252 of file stm32303c_eval_eeprom.c.

References EEPROM_FAIL, and EEPROM_DrvTypeDef::ReadBuffer.

void BSP_EEPROM_SelectDevice ( uint8_t  DeviceID)

Select the EEPROM device to communicate.

Parameters:
DeviceIDSpecifies the EEPROM device to be selected. This parameter can be one of following parameters:
  • BSP_EEPROM_M24LR64
  • BSP_EEPROM_M24M01
  • BSP_EEPROM_M95M01
Return values:
EEPROM_OK(0) if operation is correctly performed, else return value different from EEPROM_OK (0)

Definition at line 216 of file stm32303c_eval_eeprom.c.

References BSP_EEPROM_M24LR64, BSP_EEPROM_M24M01, BSP_EEPROM_M95M01, EEPROM_I2C_Drv, and EEPROM_SPI_Drv.

Basic management of the timeout situation.

Return values:
None.

Definition at line 426 of file stm32303c_eval_eeprom.c.

Referenced by EEPROM_I2C_WaitEepromStandbyState(), and EEPROM_SPI_WaitEepromStandbyState().

uint32_t BSP_EEPROM_WriteBuffer ( uint8_t *  pBuffer,
uint16_t  WriteAddr,
uint32_t  NumByteToWrite 
)

Writes buffer of data to the EEPROM device selected.

Parameters:
pBufferpointer to the buffer containing the data to be written to the EEPROM.
WriteAddrEEPROM's internal address to write to.
NumByteToWritenumber of bytes to write to the EEPROM.
Return values:
EEPROM_OK(0) if operation is correctly performed, else return value different from EEPROM_OK (0) or the timeout user callback.

< If NumByteToWrite < EEPROM_PAGESIZE

< If NumByteToWrite < EEPROM_PAGESIZE

< If the number of data to be written is more than the remaining space in the current page:

< Write the data contained in same page

< Write the remaining data in the following page

Definition at line 273 of file stm32303c_eval_eeprom.c.

References EEPROM_FAIL, EEPROM_OK, EEPROMPageSize, and EEPROM_DrvTypeDef::WritePage.

void EEPROM_I2C_IO_Init ( void  )

Initializes peripherals used by the I2C EEPROM driver.

Return values:
None

Definition at line 1347 of file stm32303c_eval.c.

References I2Cx_Init().

Referenced by EEPROM_I2C_Init().

HAL_StatusTypeDef EEPROM_I2C_IO_IsDeviceReady ( uint16_t  DevAddress,
uint32_t  Trials 
)

Checks if target device is ready for communication.

Note:
This function is used with Memory devices
Parameters:
DevAddressTarget device address
TrialsNumber of trials
Return values:
HALstatus

Definition at line 1385 of file stm32303c_eval.c.

References I2Cx_IsDeviceReady().

Referenced by EEPROM_I2C_Init(), and EEPROM_I2C_WaitEepromStandbyState().

HAL_StatusTypeDef EEPROM_I2C_IO_ReadData ( uint16_t  DevAddress,
uint16_t  MemAddress,
uint8_t *  pBuffer,
uint32_t  BufferSize 
)

Read data from I2C EEPROM driver.

Parameters:
DevAddressTarget device address
MemAddressInternal memory address
pBufferPointer to data buffer
BufferSizeAmount of data to be read
Return values:
HALstatus

Definition at line 1373 of file stm32303c_eval.c.

References I2Cx_ReadBuffer().

Referenced by EEPROM_I2C_ReadBuffer().

HAL_StatusTypeDef EEPROM_I2C_IO_WriteData ( uint16_t  DevAddress,
uint16_t  MemAddress,
uint8_t *  pBuffer,
uint32_t  BufferSize 
)

Write data to I2C EEPROM driver.

Parameters:
DevAddressTarget device address
MemAddressInternal memory address
pBufferPointer to data buffer
BufferSizeAmount of data to be sent
Return values:
HALstatus

Definition at line 1360 of file stm32303c_eval.c.

References I2Cx_WriteBuffer().

Referenced by EEPROM_I2C_WritePage().

void EEPROM_SPI_IO_Init ( void  )

Initializes the EEPROM SPI and put it into StandBy State (Ready for data transfer).

Return values:
None

Definition at line 1152 of file stm32303c_eval.c.

References EEPROM_CS_GPIO_CLK_ENABLE, EEPROM_CS_GPIO_PORT, EEPROM_CS_HIGH, EEPROM_CS_PIN, and SPIx_Init().

Referenced by EEPROM_SPI_Init().

uint8_t EEPROM_SPI_IO_ReadByte ( void  )

Read a byte from the EEPROM.

Return values:
uint8_t(The received byte).

Definition at line 1189 of file stm32303c_eval.c.

References SPIx_Read().

HAL_StatusTypeDef EEPROM_SPI_IO_ReadData ( uint16_t  MemAddress,
uint8_t *  pBuffer,
uint32_t  BufferSize 
)

Read data from SPI EEPROM driver.

Parameters:
MemAddressInternal memory address
pBufferPointer to data buffer
BufferSizeAmount of data to be read
Return values:
HAL_StatusTypeDefHAL Status

< Select the EEPROM: Chip Select low

< Send "Write to Memory " instruction

< Send MemAddress high nibble address byte to write to

< Send WriteAddr medium nibble address byte to write to

< Send WriteAddr low nibble address byte to write to

< while there is data to be read

< Read a byte from the EEPROM

< Point to the next location where the byte read will be saved

Definition at line 1269 of file stm32303c_eval.c.

References EEPROM_CMD_READ, EEPROM_CS_HIGH, EEPROM_CS_LOW, SPIx_Read(), and SPIx_Write().

Referenced by EEPROM_SPI_ReadBuffer().

HAL_StatusTypeDef EEPROM_SPI_IO_WaitEepromStandbyState ( void  )

Wait response from the SPI EEPROM.

Return values:
HAL_StatusTypeDefHAL Status

< Select the EEPROM: Chip Select low

< Send "Read Status Register" instruction

< Loop as long as the memory is busy with a write cycle

< Send a dummy byte to generate the clock needed by the EEPROM and put the value of the status register in EEPROM Status variable

< Deselect the EEPROM: Chip Select high

Definition at line 1304 of file stm32303c_eval.c.

References EEPROM_CMD_RDSR, EEPROM_CS_HIGH, EEPROM_CS_LOW, EEPROM_WIP_FLAG, SPIx_Read(), and SPIx_Write().

Referenced by EEPROM_SPI_IO_WriteData(), and EEPROM_SPI_WaitEepromStandbyState().

void EEPROM_SPI_IO_WriteByte ( uint8_t  Data)

Write a byte on the EEPROM.

Parameters:
Databyte to send.
Return values:
None

Definition at line 1179 of file stm32303c_eval.c.

References SPIx_Write().

HAL_StatusTypeDef EEPROM_SPI_IO_WriteData ( uint16_t  MemAddress,
uint8_t *  pBuffer,
uint32_t  BufferSize 
)

Write data to SPI EEPROM driver.

Parameters:
MemAddressInternal memory address
pBufferPointer to data buffer
BufferSizeAmount of data to be read
Return values:
HAL_StatusTypeDefHAL Status

< Enable the write access to the EEPROM

< Select the EEPROM: Chip Select low

< Send "Write Enable" instruction

< Deselect the EEPROM: Chip Select high

< Select the EEPROM: Chip Select low

< Send "Write to Memory " instruction

< Send MemAddress high nibble address byte to write to

< Send MemAddress medium nibble address byte to write to

< Send MemAddress low nibble address byte to write to

< while there is data to be written on the EEPROM

< Send the current byte

< Point on the next byte to be written

< Wait the end of EEPROM writing

< Disable the write access to the EEROM

< Send "Write Disable" instruction

< Deselect the EEPROM: Chip Select high

Definition at line 1207 of file stm32303c_eval.c.

References EEPROM_CMD_WRDI, EEPROM_CMD_WREN, EEPROM_CMD_WRITE, EEPROM_CS_HIGH, EEPROM_CS_LOW, EEPROM_SPI_IO_WaitEepromStandbyState(), and SPIx_Write().

Referenced by EEPROM_SPI_WritePage().

void EEPROM_SPI_IO_WriteDummy ( void  )
Generated on Wed May 31 2017 10:00:44 for STM32303C_EVAL BSP User Manual by   doxygen 1.7.6.1