AnsweredAssumed Answered

Bug in \STM32Cube_FW_F1_V1.6.0\STM3210C_EVAL

Question asked by Evgeni Sosnin on Jul 18, 2017

Hi I have built the project STM32Cube_FW_F1_V1.6.0\Projects\STM3210C_EVAL\Applications\FatFs\FatFs_uSD, but he was off with a bug in FatFs study showed that when the functions

BSP_SD_WriteBlocks uint8_t(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout)

BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout)


STM32Cube_FW_F1_V1.6.0\Drivers\BSP\STM3210C_EVAL\stm3210c_eval_sd.c
there were bugs I've attached the corrected file

 

I found 1 error when read sector function

static void SPIx_ReadData(const uint8_t *Data, uint16_t DataLength)

error reading 8 bytes, that it was not necessary to fill the buffer with 0xFF

in stm3210c_eval.c

 

/**
* @brief SPI Read Data from device
* @param Data: value to be read
* @param DataLength: length of data
*/

 

static void SPIx_ReadData(const uint8_t *Data, uint16_t DataLength)
{
 HAL_StatusTypeDef status = HAL_OK;
uint8_t *pData = (uint8_t*)Data;
memset(pData, 0xFF, DataLength);

 

//todo определил что эта функция читает данные с ошибкой
// каждый 8 байт читается ошибочно

status = HAL_SPI_Receive(&heval_Spi, (uint8_t*) Data, DataLength, SpixTimeout);
if(status != HAL_OK)
{
/* Execute user timeout callback */
SPIx_Error();
}

}

Attachments

Outcomes