3150 views|0 replies

821

Posts

0

Resources
The OP
 

[GD32E231 DIY Contest] (II): USART0 [Copy link]

This post was last edited by lising on 2019-5-13 22:58 The content of this experiment is serial communication USART0, which sends data to the PC through print output statements and displays it through the PC serial assistant software. Serial communication can facilitate the debugging of related programs of various modules in the later stage. 1. Experimental resources 1. GD32E231C_START evaluation board; 2. Keil v5.27.1.0; 3. GigaDevice.GD32E23x_DFP.1.0.0.pack; 4. GD32E23x_Demo_Suites_V1.0.1; 5. GD32E231C_START development board related documents; 6. Serial port assistant software SSCOM V5.13.1; 7. USB to serial port tool; 2. Experimental process 1. Resource analysis. From the data sheet, we can know that GD32E231C8T6 has two serial ports, USART0 and USART1. The GD32E231C_START evaluation board has brought out USART0 through JP9. For the convenience of the experiment, USART0 is used. In the schematic diagram and data sheet, we can see that USART0 is reused to PA9 and PA10 pins; 2. Hardware connection. Use a USB to serial port tool to connect to USART0 through a Dupont line; 3. The program implementation is modified according to the routine provided by GigaDevice. The program is also relatively simple. It should be noted that when configuring USART0, it is necessary to turn on the clock of USART0 and the clock of GPIOA port where USART0 is located:
  1. rcu_periph_clock_enable(USART0_PORT_CLK); //Turn on the clock of GPIOA port where USART0 is located rcu_periph_clock_enable(RCU_USART0); //Turn on the clock of USART0
复制代码
Another point is to turn on the multiplexing of PA9 and PA10:
  1. gpio_af_set(USART0_PORT, GPIO_AF_1, USART0_TX_PIN | USART0_RX_PIN);
复制代码
In the main loop, data is sent to the serial port every 500ms:
  1. int main(void) { systick_config(); LED_PORT_Init(); USART0_Config(); while(1) { printf("\n\r GD32E231C_START USART0 TEST OK! \r\n"); delay_1ms(500); } }
复制代码
4. Experimental results 3. Summary In the program, it is necessary to pay attention to turning on the serial port clock and the GPIO clock where the serial port is located, and also turn on the port multiplexing function. This experiment only did serial port output, which is convenient for later experiments.

Image 024.png (54.44 KB, downloads: 0)

Image 024.png

Image 025.png (101.31 KB, downloads: 0)

Image 025.png
This post is from GD32 MCU
 

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