STSW-STLKT01: SENSORTILE_SD Private Functions

STSW-STLKT01

STSW-STLKT01
SENSORTILE_SD Private Functions

Functions

uint8_t BSP_SD_Init (void)
 Initialize the SD card. More...
 
uint8_t BSP_SD_GetCardInfo (SD_CardInfo *pCardInfo)
 Returns information about specific card. More...
 
uint8_t BSP_SD_ReadBlocks (uint32_t *p32Data, uint64_t Sector, uint16_t BlockSize, uint32_t NumberOfBlocks)
 Reads block(s) from a specified address in an SD card, in polling mode. More...
 
uint8_t BSP_SD_WriteBlocks (uint32_t *p32Data, uint64_t Sector, uint16_t BlockSize, uint32_t NumberOfBlocks)
 Writes block(s) to a specified address in an SD card, in polling mode. More...
 
void HAL_SPI_TxCpltCallback (SPI_HandleTypeDef *hspi)
 TxRx Transfer completed callback. More...
 
uint8_t BSP_SD_GetStatus (void)
 Returns the SD status. More...
 
uint8_t BSP_SD_Erase (uint32_t StartAddr, uint32_t EndAddr)
 Erases the specified memory area of the given SD card. More...
 
static uint8_t SD_GetCSDRegister (SD_CSD *Csd)
 Read the CSD card register. Reading the contents of the CSD register in SPI mode is a simple read-block transaction. More...
 
static uint8_t SD_GetCIDRegister (SD_CID *Cid)
 Read the CID card register. Reading the contents of the CID register in SPI mode is a simple read-block transaction. More...
 
static uint8_t SD_SendCmd_wResp (uint8_t Cmd, uint32_t Arg, uint8_t Crc)
 Send 5 bytes command to the SD card and get response. More...
 
static uint8_t SD_SendCmd (uint8_t Cmd, uint32_t Arg, uint8_t Crc, uint8_t Response)
 Send 5 bytes command to the SD card and get response. More...
 
static SD_Info SD_GetDataResponse (void)
 Get SD card data response. More...
 
static uint8_t SD_GoIdleState (void)
 Put SD in Idle state. More...
 

Detailed Description

Function Documentation

◆ BSP_SD_Erase()

uint8_t BSP_SD_Erase ( uint32_t  StartAddr,
uint32_t  EndAddr 
)

Erases the specified memory area of the given SD card.

Parameters
StartAddrStart byte address
EndAddrEnd byte address
Return values
SDstatus

Definition at line 756 of file SensorTile_sd.c.

◆ BSP_SD_GetCardInfo()

uint8_t BSP_SD_GetCardInfo ( SD_CardInfo pCardInfo)

Returns information about specific card.

Parameters
cardinfopointer to a SD_CardInfo structure that contains all SD card information.
Return values
TheSD Response:
  • MSD_ERROR : Sequence failed
  • MSD_OK : Sequence succeed

Definition at line 185 of file SensorTile_sd.c.

◆ BSP_SD_GetStatus()

uint8_t BSP_SD_GetStatus ( void  )

Returns the SD status.

Parameters
None
Return values
TheSD status.

Definition at line 678 of file SensorTile_sd.c.

◆ BSP_SD_Init()

uint8_t BSP_SD_Init ( void  )

Initialize the SD card.

Parameters
None
Return values
TheSD Response:
  • MSD_ERROR : Sequence failed
  • MSD_OK : Sequence succeed

Definition at line 151 of file SensorTile_sd.c.

◆ BSP_SD_ReadBlocks()

uint8_t BSP_SD_ReadBlocks ( uint32_t *  p32Data,
uint64_t  Sector,
uint16_t  BlockSize,
uint32_t  NumberOfBlocks 
)

Reads block(s) from a specified address in an SD card, in polling mode.

Parameters
pDataPointer to the buffer that will contain the data to transmit
ReadAddrAddress from where data is to be read
BlockSizeSD card data block size, that should be 512
NumOfBlocksNumber of SD blocks to read
Return values
SDstatus

Definition at line 208 of file SensorTile_sd.c.

◆ BSP_SD_WriteBlocks()

uint8_t BSP_SD_WriteBlocks ( uint32_t *  p32Data,
uint64_t  Sector,
uint16_t  BlockSize,
uint32_t  NumberOfBlocks 
)

Writes block(s) to a specified address in an SD card, in polling mode.

Parameters
pDataPointer to the buffer that will contain the data to transmit
WriteAddrAddress from where data is to be written
BlockSizeSD card data block size, that should be 512
NumOfBlocksNumber of SD blocks to write
Return values
SDstatus

Definition at line 287 of file SensorTile_sd.c.

◆ HAL_SPI_TxCpltCallback()

void HAL_SPI_TxCpltCallback ( SPI_HandleTypeDef *  hspi)

TxRx Transfer completed callback.

Parameters
hspiSPI handle
Note
This example shows a simple way to report end of DMA TxRx transfer, and you can add your own implementation.
Return values
None

Definition at line 368 of file SensorTile_sd.c.

◆ SD_GetCIDRegister()

static uint8_t SD_GetCIDRegister ( SD_CID Cid)
static

Read the CID card register. Reading the contents of the CID register in SPI mode is a simple read-block transaction.

Parameters
Cidpointer on an CID register structure
Return values
SDstatus

Definition at line 499 of file SensorTile_sd.c.

◆ SD_GetCSDRegister()

uint8_t SD_GetCSDRegister ( SD_CSD Csd)
static

Read the CSD card register. Reading the contents of the CSD register in SPI mode is a simple read-block transaction.

Parameters
Csdpointer on an SCD register structure
Return values
SDstatus

< Reserved

Definition at line 381 of file SensorTile_sd.c.

◆ SD_GetDataResponse()

static SD_Info SD_GetDataResponse ( void  )
static

Get SD card data response.

Parameters
None
Return values
TheSD status: Read data response xxx0<status>1
  • status 010: Data accecpted
  • status 101: Data rejected due to a crc error
  • status 110: Data rejected due to a Write error.
  • status 111: Data rejected due to other error.

Definition at line 629 of file SensorTile_sd.c.

◆ SD_GoIdleState()

static uint8_t SD_GoIdleState ( void  )
static

Put SD in Idle state.

Parameters
None
Return values
SDstatus

Definition at line 688 of file SensorTile_sd.c.

◆ SD_SendCmd()

static uint8_t SD_SendCmd ( uint8_t  Cmd,
uint32_t  Arg,
uint8_t  Crc,
uint8_t  Response 
)
static

Send 5 bytes command to the SD card and get response.

Parameters
CmdThe user expected command to send to SD card.
ArgThe command argument.
CrcThe CRC.
ResponseExpected response from the SD card
Return values
SDstatus

Definition at line 605 of file SensorTile_sd.c.

◆ SD_SendCmd_wResp()

static uint8_t SD_SendCmd_wResp ( uint8_t  Cmd,
uint32_t  Arg,
uint8_t  Crc 
)
static

Send 5 bytes command to the SD card and get response.

Parameters
CmdThe user expected command to send to SD card.
ArgThe command argument.
CrcThe CRC.
ResponseExpected response from the SD card
Return values
SDstatus

Definition at line 592 of file SensorTile_sd.c.

Generated by   doxygen 1.8.13