2025-01-07 03:17 AM - last edited on 2025-01-07 03:35 AM by Andrew Neil
Hello,
I would like to understand the code to carry out my software integration :
/* Configure SD pin detect */
__SD_DETECT_GPIO_CLK_ENABLE();
__HAL_RCC_PWR_CLK_ENABLE();
And This refers to lines of code that I am lost, for the first line for example
#define __SD_DETECT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
And after :
#define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
__IO uint32_t tmpreg; \
SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOGEN); \
/* Delay after an RCC peripheral clock enabling */ \
tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOGEN); \
UNUSED(tmpreg); \
} while(0)
I would just like to configure the SD card to be able to write the code from an example on the evaluation card. My real card is not the evaluation card and I would like the code just necessary. Do you have an example for STM32L5xx with the file .ioc for example.
Thank you
2025-01-08 06:26 AM
@DYann.1 wrote:it works but not all the time and I don't understand very well.!
So spend some time to understand it.
Debug what is going wrong when it fails.
Just testing for "not OK" gives you no insight into what's going wrong:
void SD_Init (void)
{
if (MX_FATFS_Init() != APP_OK) {
Error_Handler();
}
if (PRESENT_SD() != APP_OK) {
Error_Handler();
}
Add some diagnostic output so that you can see what's going on.
Have a variable to catch the return code, and print it.
eg,
printf( "MX_FATFS_Init: " );
result = MX_FATFS_Init();
if( result != APP_OK ) {
printf( "error %d\n", result );
Error_Handler();
}
printf( "OK\n" );
printf( "PRESENT_SD: " );
result = PRESENT_SD();
if( result != APP_OK ) {
printf( "error %d\n", result );
Error_Handler();
}
printf( "OK\n" );
etc, etc, ...
2025-01-08 06:55 AM
@DYann.1 wrote:it works but not all the time
But, near the start of this thread, you said:
@DYann.1 wrote:I have a STM32L552E-EV and I have a program that works very well on this evaluation card
So study that to see how it should work ...
2025-01-08 07:15 AM
@Andrew Neil wrote:So study that to see how it should work ...
I try but it's too difficult for me, I abandon this track and I'm watching the video.
2025-01-08 07:43 AM
@DYann.1 wrote:I try but it's too difficult for me
Maybe explore STM32duino - Arduino on STM32 ?
https://docs.arduino.cc/libraries/stm32duino-examples/
Or just use an Arduino?
2025-01-09 08:34 AM
@SofLit wrote:Not possible to provide ioc file for each case/board.
The video is simple and you can easily follow it. You need just the SDcard detection not the all configuration of FatFs.
Now after watching the video, In my configuration I can't see I don't see the DMA Settings tab, is it normal ?
In the video I can see this tab :
Is this due to the type of microprocessor or the STMCube IDE environment which is not up to date ?
Thank you for your answer