10188 views|11 replies

1366

Posts

6

Resources
The OP
 

GD32F350---First experience [Copy link]

 
This is my first time playing with GD32, so I may not be familiar with it. Forum friends have posted photos one after another, so I don't need to post them here. I will run some clock outputs of GD32 and use ticks to light up the lights. However, I have a problem here. The demo I created myself is strange. It runs at full speed when debugging, but it seems that nothing happens when it runs at full speed without the emulator. It is burned into the internal flash. The attachment is my code. I hope forum friends can help me verify whether this problem exists. I refer to the official demo example, ticking 500ms to flip the LED light, and the serial port outputs the system clock frequency SYS, AHB, APB1, APB2 frequency. And you can use the button to flip the two external lights. Since this demo board does not have an external crystal oscillator soldered, it has to switch to the internal crystal oscillator. Switching to the internal crystal oscillator is actually simple. Just enable __SYSTEM_CLOCK_108M_PLL_IRC8M_DIV2 in system_gd32f3x0.c. But we have to analyze how the GD32 clock tree is allocated in the code. Like STM32, in the startup file, the clock will be initialized before entering main, that is, SystemInit. The first sentence in its function is to enable the internal crystal oscillator, and then wait for the internal crystal oscillator to be ready. If it is completed, the clock unit RCU is reset, and then some clock division operations are performed. Next, we enter system_clock_config, where we will enter the corresponding function according to the enabled macro. Here we use the internal clock IRC8M, and we can also use IRC48, but the system clock from PLL is 96M. So we enable __SYSTEM_CLOCK_108M_PLL_IRC8M_DIV2 Next, we analyze system_clock_108m_irc8m, which is about the clock configuration of AHB, APB2, APB1, SYS, etc. Let's analyze it carefully here, RCU_CFG0 |= RCU_AHB_CKSYS_DIV1; in the reference manual, configuration register 0 is (RCU_CFG0), RCU_AHB_CKSYS_DIV1, which means 1 division, which means no division. The macro is defined in the library function as follows, that is, to configure the fourth to seventh bits of RCU_CFG0, which are the relevant operation bits of AHB. In the reference manual, we can know that configuration as 0xxx selects SYS clock without division, which is the same as the system clock, both are 108M. Next, the clock configuration of APB2 and APB1 is 2 division. Then configure PLL to 108M, enable PLL, use PLL as the system clock, and wait for PLL to be ready. This completes a clock configuration. GD tries to make some comments in the library functions concise, so that users can quickly get started with these interfaces


11.png (163.87 KB, downloads: 0)

11.png
This post is from GD32 MCU

Latest reply

Without the emulator, can yours run? Have you found the problem?  Details Published on 2018-8-29 13:14
Personal signature

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

 

1366

Posts

6

Resources
2
 
In the above description, it will be printed out on the serial port to see if the configuration is complete. To see if the configuration is complete, we need to obtain the frequency parameters of these clocks. The official interface, rcu_clock_freq_get, is also provided. Different clocks are also defined through enumeration. So we can add printf in main to print these parameters In Mian, the three lights, two buttons, and a serial port on the board are initialized respectively. When the button is pressed, two lights flip. The demo here has enabled the tick timer, 1ms tick, and a light is also running in the tick interrupt, flipping once every 500ms.

This post is from GD32 MCU
 
Personal signature

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

 
 

1366

Posts

6

Resources
3
 
Download the code and run it. The log printed out by the serial port shows that the clock configuration is accurate.
This post is from GD32 MCU
 
Personal signature

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

 
 

1366

Posts

6

Resources
4
 
See the gif for the effect. However, when debugging, the HUB chip and CH340T are a little hot, and sometimes the simulation is suddenly disconnected. When you open it again, it prompts that the device cannot be found and you have to plug it again. I haven't looked at the sch schematic yet. I just received it today, so I will first understand the clock aspect, and then use some peripherals according to my own project.

212.gif (3.29 MB, downloads: 0)

212.gif
This post is from GD32 MCU
 
Personal signature

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

 
 

1366

Posts

6

Resources
5
 
  The attachment is as follows. If you have this board, please help verify whether it can run without simulation.

MySunDevice.7z

4.15 MB, 阅读权限: 5, downloads: 29

demo

This post is from GD32 MCU

Comments

The simulated running light is running, then the simulation is restarted without running.  Details Published on 2018-8-28 17:20
 
Personal signature

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

 
 

138

Posts

0

Resources
6
 
Haven't got the board yet
This post is from GD32 MCU

Comments

Got it, please help verify it.  Details Published on 2018-8-27 09:19
 
 
 

1366

Posts

6

Resources
7
 
wtliu posted on 2018-8-27 09:03 I haven't got the board yet
If you have it, please help verify it
This post is from GD32 MCU
 
Personal signature

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

 
 

7171

Posts

195

Resources
8
 
RCSN posted on 2018-8-26 23:05 The attachment is as follows. I hope those who have this board can also help verify whether it can run without simulation
The simulation of the running light is running, then the simulation is unplugged and restarted, but it does not run
This post is from GD32 MCU
 
 
 

5217

Posts

239

Resources
9
 
RCSN, the competition submission tag is used after the work is completed and the relevant materials are sorted out for submission. Please use the tags for normal posts according to the situation: experience sharing, problem discussion, and material sharing
This post is from GD32 MCU
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
 
 
 

1305

Posts

0

Resources
10
 
It hasn't started yet, so keep an eye on it and test it when you have time so that any problems can be solved later.
This post is from GD32 MCU
 
 
 

158

Posts

0

Resources
11
 
Without the emulator, can yours run? Have you found the problem?
This post is from GD32 MCU

Comments

OK, see my latest post, there is source code  Details Published on 2018-8-29 13:23
 
 
 

1366

Posts

6

Resources
12
 
anger0925 posted on 2018-8-29 13:14 Without the emulator, can yours run? Have you found the problem?
Yes, see my latest post, there is source code
This post is from GD32 MCU
 
Personal signature

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

 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

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