Skip to main content
Associate III
August 8, 2024
Solved

FATFS not working with BSP_LCD functions (stm32469i_discovery_lcd.h) on stm32f469i-Discovery

 

Hi everyone,

I'm currently working on developing an audio player with a display interface on the STM32F469I-Discovery board. I've got both the audio and the display working on their own. However, when I try to use both at the same time, I get an FR_DISK_ERR on f_lseek in audioplayer.c at line 42.

I thought I'd give you a quick overview of my setup:

Audio Codec = CS43L22
Display = Integrated LCD

What I've Tried:
Audio Playback: It works perfectly when the display is not in use.
Display Interface: It functions correctly when audio playback is not active.
Simultaneous Operation: I get an FR_DISK_ERR during f_lseek operation in the audio player code.


Error Details:
File: audioplayer.c
Line: 42
Function: f_lseek

 

The code is provided in a zipped file in the appendix below.

 

Thank you very much :D 

    This topic has been closed for replies.
    DerFreakerBest answer
    Associate III
    August 8, 2024

    Sooo... after a few hours of debugging I finally managed to find the problem.


    So in file stm32469i_discovery_lcd.c on line 342

     hltdc_eval.LayerCfg->ImageWidth = lcd_x_size;
     hltdc_eval.LayerCfg->ImageHeight = lcd_y_size;
     /* LCD clock configuration */
     /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
     /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 384 Mhz */
     /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 384 MHz / 7 = 54.857 MHz */
     /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_2 = 54.857 MHz / 2 = 27.429 MHz */
     //PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
     PeriphClkInitStruct.PLLSAI.PLLSAIN = 384;
     PeriphClkInitStruct.PLLSAI.PLLSAIR = 7;
     PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
     HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);


    Just comment this FUCxxx and never touch it again :D

    //PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;

     

    I hope I can help someone with this, if so please let me know lol.

    1 reply

    DerFreakerAuthorBest answer
    Associate III
    August 8, 2024

    Sooo... after a few hours of debugging I finally managed to find the problem.


    So in file stm32469i_discovery_lcd.c on line 342

     hltdc_eval.LayerCfg->ImageWidth = lcd_x_size;
     hltdc_eval.LayerCfg->ImageHeight = lcd_y_size;
     /* LCD clock configuration */
     /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
     /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 384 Mhz */
     /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 384 MHz / 7 = 54.857 MHz */
     /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_2 = 54.857 MHz / 2 = 27.429 MHz */
     //PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
     PeriphClkInitStruct.PLLSAI.PLLSAIN = 384;
     PeriphClkInitStruct.PLLSAI.PLLSAIR = 7;
     PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
     HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);


    Just comment this FUCxxx and never touch it again :D

    //PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;

     

    I hope I can help someone with this, if so please let me know lol.