2016-09-19 12:55 AM
2016-09-22 05:04 AM
Hi
is any one there ? i asking a simple Question how use a DMA for SD card Read and write ?.RegardsRajesh2016-09-22 05:05 AM
2016-09-22 06:42 AM
is any one there ? i asking a simple Question how use a DMA for SD card Read and write ?
This is a user forum, it appears evident there isn't anyone here right now who can answer your specific question in the context it is being framed, that's how forums work, sometime they can be like an empty room, other times it is full of people who can't answer their own basic questions, and aren't interested in others issues. There are other avenues to seek help, the Online Support process, talking with your local ST staff or FAE, or engaging a contractor/consultant.2016-09-22 07:24 AM
Hi d.rajesh.001,
I am analyzing your request. Your description of the issue is general . Try to apply the following: * You should Add a check after read/write operation using HAL_SD_CheckWriteOperation() to check the completion of the write or read process by SD. (You can refer to SD example in STM32cube and follow implementation there) * If the issue still exist try to debug and localize where the code hangs/stop and the kind of message gives. You did not precise the version of the drivers / STM32cube you are using . Is-It the last version ? -Hannibal-2016-09-22 09:18 AM
Sir,
You did not precise the version of the drivers / STM32cube you are using . Is-It the last version ?
I am using the code demonstration code which has came with the product and i'am not using the STM32 cubemx.In main header i have found the details below * @file main.c * @author MCD Application Team * @version V1.0.1 * @date 25-June-2015 * @brief This file provides main program functions here i have given the below code i have tried in tat you can see the ''uint8_t buffer[512];
''
that declared inside the main which leads to read null data at SD read output at DMA mode.The problem solves if it declared above main i.e Global to main function why this happens ?.
01.
int
main(
void
)
02.
{
03.
/* Configure the MPU attributes as Write Through */
04.
MPU_Config();
05.
/* Enable the CPU Cache */
06.
CPU_CACHE_Enable();
07.
/* STM32F7xx HAL library initialization:
08.
- Configure the Flash ART accelerator on ITCM interface
09.
- Configure the Systick to generate an interrupt each 1 msec
10.
- Set NVIC Group Priority to 4
11.
- Global MSP (MCU Support Package) initialization
12.
*/
13.
HAL_Init();
14.
SystemClock_Config();
15.
BSP_LED_Init(LED1);
16.
BSP_LED_Off(LED1);
17.
uartInit();
18.
SDdetectInit();
19.
BSP_SD_Init();
20.
21.
uint8_t buffer[512];
22.
uint32_t count =63;
23.
24.
HAL_Delay(500);
25.
26.
27.
if
( BSP_SD_ReadBlocks_DMA((uint32_t*)buffer,(uint64_t) (512L*count), (uint32_t) 512, (uint32_t) 1) != MSD_OK)
28.
{
29.
HAL_UART_Transmit(&UartHandle,
''Read failed''
,
sizeof
(
''Read failed''
),500);
30.
}
31.
else
32.
{
33.
HAL_UART_Transmit(&UartHandle,buffer,512,500);
34.
}
similarly i have problem when i have interfaced with FAT FS it was not working It gives DMA readout timer expires.01.
void
fatfile_read(
void
)
02.
{
03.
04.
FRESULT res;
/* FatFs function common result code */
05.
uint32_t byteswritten, bytesread;
/* File write/read counts */
06.
if
(FATFS_LinkDriver(&SD_Driver, SDPath) == 0)
07.
{
08.
if
(f_mount(&SDFatFs, (TCHAR
const
*)SDPath, 0) != FR_OK)
09.
{
10.
Error_Handler();
11.
}
12.
else
13.
{
14.
if
(f_open(&MyFile,
''STM32.TXT''
, FA_READ) != FR_OK)
15.
{
16.
Error_Handler();
17.
}
18.
else
19.
{
20.
res = f_read(&MyFile, rtext,
sizeof
(rtext), (UINT*)&bytesread);
21.
getStringFromWord(rtext,bytesread);
22.
if
((bytesread == 0) || (res != FR_OK))
23.
{
24.
25.
}
26.
else
27.
{
28.
29.
}
30.
}
31.
f_close(&MyFile);
32.
}
33.
}
34.
// FATFS_UnLinkDriver(SDPath);
35.
36.
}
And fatfs was not working with DMA.
Thanks and regards
Rajesh
2016-09-22 09:54 AM
Hi d.rajesh.001,
It is normal; you are not respecting here the C coding specification. You want to put data on a local buffer with a scope on stuck through DMA which is not affordable. You should user a global variable with a scope on heap to allow DMA successfully transfer the data from SD to memory buffer. -Hannibal-