cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4R9I-DISCO SD storage not working

Du1
Senior

I have a TouchGFX project created from TouchGFX for the STM32L4R9I-DISCOVERY and I'm editing the code to enable storage for playing audio. However, when I enable Storage_Init(MSD_DISK_UNIT); either from main.c or using the mmi_interpreter with: MMI_Interpreter_STORAGE_Services(MEDIA_STORAGE_INIT, (void*) MSD_DISK_UNIT); 

My LCD stops displaying the graphics I've created. 

Has anyone seen this before? Is there timing conflicts trying to enable the SD storage feature eventhough the code is written and available?

2 REPLIES 2
Martin KJELDSEN
Chief III

Hi @Du​,

What's your application doing once the LCD stops displaying? What kind of debugging have you done so far?

Hi @Martin KJELDSEN​ ,

The original generated code from TouchGFX created this:

...
  main_mmi_init(mmiInitMode);
 
  /* Start scheduler */
  osKernelStart ();
...

When I edit to add this:

...
  main_mmi_init(mmiInitMode);
  Storage_Init(MSD_DISK_UNIT);
 
  /* Start scheduler */
  osKernelStart ();
...

it crashes and the LCD shows colorful dots like when the LCD is not properly initialized.

If I add this:

  main_mmi_init(mmiInitMode);
  Storage_Init(MSD_DISK_UNIT);
#ifdef UARTDEBUG
  char UserTxBuffer[] = "SD Mounted\r\n";
  HAL_UART_Transmit(&UartHandle, (uint8_t*)UserTxBuffer, sizeof(UserTxBuffer), HAL_MAX_DELAY);
#endif 
  /* Start scheduler */
  osKernelStart ();

then the LCD is back to normal and my application is running like it should.

Since I was unsuccessful in creating a SW4STM32 project to enable STLINK debugging, I decided to use UART4 to send out debug statements on a hyper terminal.

Thanks for looking into this! It's not a high priority since it's working now with that debug statement, but just curious what could be happening.