【GD32307E-START】+Return of the GD32F307E development board
[Copy link]
This post was last edited by jinglixixi on 2020-11-9 10:44
I was not accepted the first time I applied, but I was given the opportunity to apply again this time, and I finally got what I wanted. It’s such an honor!
1. Unboxing
The GD32F307E development board still comes in the familiar transparent plastic package, as shown in Figure 1.
Figure 1 GD32F307E development board and packaging
2. Power-on test
The GD32F307E development board has multiple USB interfaces. It seems that only CN100 can provide power for the development board, and the power switch needs to be switched to the LINK side.
Figure 2 Power-on effect
After power on, the computer starts to install the driver, and then there is no significant change. At this time, if the USER key is pressed, LED1 will be lit, and if the USER key is pressed again, LED1 will be turned off, and then it will change repeatedly.
Figure 3 Lighting up LED1
3. Program Analysis
So why does this effect occur?
Let's take a look at its main program:
int main(void)
{
gd_eval_key_init(KEY_WAKEUP, KEY_MODE_EXTI);
gd_eval_led_init(LED1);
while(1){
}
}
From this we can see that it calls an interrupt through the change of the button status to control the state switching of the LED.
So which pins do LED1 and USER key occupy?
From the program and schematic diagram, we can see that LED1 occupies PC6, while the USER key occupies PA0.
The definitions of LED1 and USER key are:
#define LED1_PIN GPIO_PIN_6
#define LED1_GPIO_PORT GPIOC
#define LED1_GPIO_CLK RCU_GPIOC
/* wakeup push-button */
#define WAKEUP_KEY_PIN GPIO_PIN_0
#define WAKEUP_KEY_GPIO_PORT GPIOA
#define WAKEUP_KEY_GPIO_CLK RCU_GPIOA
#define WAKEUP_KEY_EXTI_LINE EXTI_0
#define WAKEUP_KEY_EXTI_PORT_SOURCE GPIO_PORT_SOURCE_GPIOA
#define WAKEUP_KEY_EXTI_PIN_SOURCE GPIO_PIN_SOURCE_0
#define WAKEUP_KEY_EXTI_IRQn EXTI0_IRQn
typedef enum
{
KEY_WAKEUP = 0,
KEY_TAMPER = 1,
KEY_USER = 2
} key_typedef_enum;
typedef enum
{
KEY_MODE_GPIO = 0,
KEY_MODE_EXTI = 1
} keymode_typedef_enum;
Figure 4 Schematic diagram of LED1 and USER key
4. Development environment construction
In order to test routines and program development, it is essential to build a development environment. Taking KEIL as an example, the construction steps are as follows:
1) Install KEIL software, I chose V5.23;
2) Download and install the upgrade packages GigaDevice.GD32F30x_DFP.1.0.1 and GigaDevice.GD32F30x_AddOn.1.0.1 to add chip support, as shown in Figure 5;
3) To generate the target file HEX, set it up as shown in Figure 6;
4) To debug and download, you need to set the debugging tool type and burning algorithm as shown in Figure 7 and Figure 9;
5) To generate the target file, the program needs to be compiled and downloaded. The results are shown in Figures 10 and 11.
Figure 5 Adding chip support
Figure 6 Generate target file
Figure 7 Setting the debugging tool type
Figure 8 Activating the debugging tool
Figure 9 Setting the burning algorithm
Figure 10 Compilation completed
Figure 11 Downloading
After completing the construction and download test of the development environment, the subsequent testing and development work will be much easier, otherwise everything will be in vain!
|