Skip to main content
Visitor II
November 12, 2025
Question

sdcard interfacing with stm32f411ceu6

  • November 12, 2025
  • 1 reply
  • 205 views

Post edited by ST moderator to be inline with the community rules for the code sharing. In next time please use </> button to paste your code. Please read this post: How to insert source code.

i am trying to interface stm32f411ceu6 with sdcard  using spi ,and i have successfully interfaced it but when i try to run this code using freertos by using another timer as timebase source it not works 

below code is in interrupt .c file . i wanted to use freertos just to make task but i dont know why my code not works when i enable freertos from stmcubemx

 
void SysTick_Handler(void)
{
 /* USER CODE BEGIN SysTick_IRQn 0 */
 if(Timer1 > 0)
 Timer1--;
 if(Timer2 > 0)
 Timer2--;
 /* USER CODE END SysTick_IRQn 0 */

 HAL_IncTick();

 /* USER CODE BEGIN SysTick_IRQn 1 */
 /* USER CODE END SysTick_IRQn 1 */

}
    This topic has been closed for replies.

    1 reply

    Super User
    November 12, 2025

    Welcome to the forum.

    Please see How to write your question to maximize your chances to find a solution for best results.

    In particular, please give details of your hardware, your tools, etc.

     


    @Shubham-8080 wrote:

    below code is in interrupt .c file . i wanted to use freertos just to make task but i dont know why my code not works when i enable freertos from stmcubemx

     
    void SysTick_Handler(void)
    {
     /* USER CODE BEGIN SysTick_IRQn 0 */
     if(Timer1 > 0)
     Timer1--;
     if(Timer2 > 0)
     Timer2--;
     /* USER CODE END SysTick_IRQn 0 */
    
     HAL_IncTick();
    
     /* USER CODE BEGIN SysTick_IRQn 1 */
     /* USER CODE END SysTick_IRQn 1 */
    
    }

    So what, exactly, does "not working" mean?

    • What were you expecting it to do ?
    • What is it actually doing ?
    • What debugging have you done to find why it's "not working" ?

    How To Debug.

     

    You haven't shown your definitions of the two timer variables. They are being updated in an interrupt handler, so are they volatile ?

    Visitor II
    November 27, 2025

    no they are not volatile.

    • What were you expecting it to do ?
      i trying to develop code in which sdcard driver code must be thread safe when i integrate it with freertos program.
    • What is it actually doing ?
      the driver i am currently using it is not working when i try to use it with freertos code it shows only the sdcard mount successfully and it is not able to create the file and add some content in it .
    • What debugging have you done to find why it's "not working" ?
      currently i am debugging using debug message on uart.