Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Using systick. STM32F769, STM32IDE

Status
Not open for further replies.

Pastel

Member level 3
Joined
Jun 30, 2019
Messages
55
Helped
2
Reputation
4
Reaction score
1
Trophy points
8
Activity points
969
Hello!

I have the following problem:
A few years ago, I was using CubeMX to configure my programs and it worked fine.
Basically what I always do is setup a systick of 1 ms, and build the whole program on that
time grid.
Now in the latest version of Cube MX, which is now integrated into STM32IDE, I'm trying
to do the same, but the generated code doesn't include the systick setup.
I have tried to add the systick configuration manually in SystemClock_Config:

Code:
  //    Systick frequency configuration
  HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
  //    Configure the systick
  HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
  //    SysTick_IRQn interrupt configuration
  HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);

Then I also added the following code in SysTick_Handler so that the callback is
called. NB: I have added the whole function to display the context, but a single line
only was added.

Code:
void SysTick_Handler(void)
{
  /* USER CODE BEGIN SysTick_IRQn 0 */

  /* USER CODE END SysTick_IRQn 0 */
  HAL_IncTick();
  HAL_SYSTICK_IRQHandler();    // <--- This line has been added
  /* USER CODE BEGIN SysTick_IRQn 1 */

  /* USER CODE END SysTick_IRQn 1 */
}

The HAL_SYSTICK_IRQHandler just calls HAL_SYSTICK_Callback which is a weak function.
When I declare it again in main's user area, I get an interrupt if I setup a breakpoint.

The problem: in my previous experience with STM32, I used to get the interrupt at 1ms intervals
forever. But this time, I get the interrupt only 3 times, and after that the program finishes in
the error handler which is an infinite loop

So my question is simple: does anybody know how to setup the systick interrupt in the latest
version oft STM32CubeIDE? Am I missing something?

Thanks!
 

Hello again!

Sorry for the mess, I found what's wrong. In fact, I have configured the Cube to handle
an SD card. But the error handling of the SD card is pretty bad, there is only an infinite
loop. In my case, as no card was inserted, I had a card initialization failure, therefore
an infinite loop. I don't understand why I could get interrupt because the card init
failed, so I didn't even configure the Systick, but anyway if I disable the card init, everything
works fine.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top