2170 views|4 replies

2870

Posts

4

Resources
The OP
 

NUCLEO_G431RB Review - Timer Test [Copy link]

Since I had some time to play around with the NUCLEO_G431RB development board I applied for these days, I found some problems.

Thanks to EEWORLD and ST for providing development boards.

First, let me introduce the development environment, STM32CUBEMAX 5.40 board, keil 5.27 IDE.

1. Turn on the external crystal oscillator

2. Set the system clock


You can see the frequency of the peripherals. Both APB1 and APB2 are 168M. There should be no problem.

3. Set timer TIM6

The timing division is 1M, PreScaler = 168 - 1, the timer count is 1000, counter Period = 1000

If the interrupt is turned on and the system automatically reloads, the interrupt timer will be once every 1m.

4. Enable interrupts in the main program

HAL_TIM_Base_Init(&htim6);
HAL_TIM_Base_Start_IT(&htim6);

5. Modify the interrupt function TIM6_DAC_IRQHandler

Add timing variable sysclk++;

Then check the value of sysclk in the loop, sysclk > 500, flip the LED polarity

HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);

The operation is now complete, compile->download->reset. Start testing.

I found that the LED lights up very slowly, about once every 100ms. So I used the function

uint32_t sysclock = HAL_RCC_GetSysClockFreq();

After outputting the system frequency, SysClock=16000000. That's not right. I checked the clock frequency set to 168M, but it's not right. I opened the setting code and found no problem. So I suspect that there is something wrong with the HAL library code of STM32G431.

In addition, it was found that the settings and codes of TIM7 and TIM6 are the same.

HAL_TIM_Base_Start_IT(&htim7);

The program crashed. I don't know why. I tested the problem, please pay attention to it.




This content is originally created by bigbat , a user of EEWORLD forum. If you want to reprint or use it for commercial purposes, you need to obtain the author's consent and indicate the source

stm32tim62.png (161.88 KB, downloads: 0)

stm32tim62.png
This post is from stm32/stm8

Latest reply

The host did not operate on the callback function Write the code directly in void TIM6_DAC_IRQHandler(void).   Details Published on 2019-12-16 22:45
 

1366

Posts

6

Resources
2
 

Can you please send me the code project so I can see what the problem is with the API?

This post is from stm32/stm8

Comments

Thank you, I sent the project file. The driver part was deleted in the file because this part of the code is automatically generated. Firmware library STM32Cube FW_G4 V1.1.0 Others are STM32CUBE 5.40 keil 5.27 IDE  Details Published on 2019-12-6 15:38
 
Personal signature

1084534438 欢迎交流  [加油,一切皆有可能]

 

2870

Posts

4

Resources
3
 

The file is too big, so I kept the main part. This is the project file and the program I wrote.

test64.zip (78.55 KB, downloads: 5)



This post is from stm32/stm8
 
 

2870

Posts

4

Resources
4
 
RCSN posted on 2019-12-6 13:55 Please send me the code project so I can see what the problem is with the API? You haven't found the specific cause of the problem yet

Thank you, I sent the project file. The driver part was deleted in the file because this part of the code is automatically generated. Firmware library

STM32Cube FW_G4 V1.1.0

The others are STM32CUBE 5.40 keil 5.27 IDE

This post is from stm32/stm8
 
 
 

39

Posts

1

Resources
5
 

The host did not operate on the callback function

Write the code directly in void TIM6_DAC_IRQHandler(void).

This post is from stm32/stm8
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list