2021-08-17 07:35 AM
Are there example MX projects? The IDE has xcellent example projects?
Solved! Go to Solution.
2021-08-19 11:29 AM
Hello @JBonn ,
Thanks for having reported.
In fact, STM32CubeMX tool comes with the Example selector feature allowing you to browse a large set of examples and to start a new project from a selected example for some STM32 MCUs/MPUs. Thanks to the filter panel it is possible to filter down the example list (you can use TIM/ timer as a keyword):
Otherwise, you'll find a table resuming the available examples in the STM32Cube MCU Package examples for STM32L4 Serie Application Note:
Trying to directly answer your question; configure timer 3 for 40ms interrupts in STM32L476, you'll find hereafter some simple steps to de the configuration using CubeMX:
/* USER CODE BEGIN 2 */
HAL_TIM_Base_Start_IT(&htim3);
/* USER CODE END 2 */
//....
/* USER CODE BEGIN 4 */
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim)
{
HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
}
/* USER CODE END 4 */
(I've used LD2 as the PA5 is the output for green Led)
Normally following those steps everything will work correctly.
Furthermore, you can refer to the STM32 Timers representation covering the main features of Timers for more details.
Hope this helps you.
Khouloud.
2021-08-19 11:29 AM
Hello @JBonn ,
Thanks for having reported.
In fact, STM32CubeMX tool comes with the Example selector feature allowing you to browse a large set of examples and to start a new project from a selected example for some STM32 MCUs/MPUs. Thanks to the filter panel it is possible to filter down the example list (you can use TIM/ timer as a keyword):
Otherwise, you'll find a table resuming the available examples in the STM32Cube MCU Package examples for STM32L4 Serie Application Note:
Trying to directly answer your question; configure timer 3 for 40ms interrupts in STM32L476, you'll find hereafter some simple steps to de the configuration using CubeMX:
/* USER CODE BEGIN 2 */
HAL_TIM_Base_Start_IT(&htim3);
/* USER CODE END 2 */
//....
/* USER CODE BEGIN 4 */
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim)
{
HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
}
/* USER CODE END 4 */
(I've used LD2 as the PA5 is the output for green Led)
Normally following those steps everything will work correctly.
Furthermore, you can refer to the STM32 Timers representation covering the main features of Timers for more details.
Hope this helps you.
Khouloud.
2021-08-19 11:49 AM