Skip to main content
TLung.1
Associate II
September 24, 2020
Question

STM32H7 SD CARD got HAL_SD_CARD_RECEIVING

  • September 24, 2020
  • 1 reply
  • 840 views

Hi All,

I am using SD card store something log on H743 with mbed. But I encounter a problem which will poll the strange status "HAL_SD_CARD_RECEIVING".

I can initial without any issue. Also can write a shot address and read. But when I write a continuous data for 1MB, it will fail at random address. Please check below:

test_addr=0;
HAL_SD_WriteBlocks(&hsd2, aTxBuffer, test_addr, 1,2000);
if( polling() )//polling state until HAL_SD_CARD_TRANSFER
	record_fail();//pass to write
 
test_addr+=512;
HAL_SD_WriteBlocks(&hsd2, aTxBuffer, test_addr, 1,2000);
if( polling() )//polling state until HAL_SD_CARD_TRANSFER
	record_fail();//pass to write
 
test_addr+=512;
HAL_SD_WriteBlocks(&hsd2, aTxBuffer, test_addr, 1,2000);
if( polling() )//polling state until HAL_SD_CARD_TRANSFER
	record_fail();//pass to write
 
test_addr+=512;
HAL_SD_WriteBlocks(&hsd2, aTxBuffer, test_addr, 1,2000);
if( polling() )//polling state until HAL_SD_CARD_TRANSFER
	record_fail(); // <----------fail to write, return HAL_SD_CARD_RECEIVING
 
test_addr+=512;
HAL_SD_WriteBlocks(&hsd2, aTxBuffer, test_addr, 1,2000);
if( polling() )//polling state until HAL_SD_CARD_TRANSFER
	record_fail(); // <----------fail to write, return HAL_SD_CARD_RECEIVING

The fail address is random. I don't know why cause the issue happen. Does anyone have idea?

Tery

This topic has been closed for replies.

1 reply

TLung.1
TLung.1Author
Associate II
September 30, 2020

I resolved the issue by decrease clock rate from 50M to 20M.

//peripheral 200M

From hsd2.Init.ClockDiv = 2;

to hsd2.Init.ClockDiv = 5;