资源简介
使用NucleiStudio打开工程, 代码实现了GD32VF103串口0的发送, printf支持, 接收中断, DMA等, 具体参考我的博客: GD32VF103_串口发送_printf_接收中断_DMA

代码片段和文件信息
/*!
\file main.c
\brief running led
\version 2019-6-5 V1.0.0 firmware for GD32VF103
*/
/*
Copyright (c) 2019 GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms with or without modification
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS“
AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT
INDIRECT INCIDENTAL SPECIAL EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING BUT
NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE DATA OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY
WHETHER IN CONTRACT STRICT LIABILITY OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#include “gd32vf103.h“
#include “systick.h“
#include
void uart0_config(uint32_t baudrate) {
rcu_periph_clock_enable(RCU_GPIOA); //enable GPIO clock PA9/PA10
rcu_periph_clock_enable(RCU_USART0); //enable USART clock
gpio_init(GPIOA GPIO_MODE_AF_PP GPIO_OSPEED_50MHZ GPIO_PIN_9); //PA9--TX0
gpio_init(GPIOA GPIO_MODE_IN_FLOATING GPIO_OSPEED_50MHZ GPIO_PIN_10); //PA10--RX0
//USART0: 115200-8-1-N
usart_deinit(USART0);
usart_baudrate_set(USART0 baudrate);
usart_word_length_set(USART0 USART_WL_8BIT);
usart_stop_bit_set(USART0 USART_STB_1BIT);
usart_parity_config(USART0 USART_PM_NONE);
usart_hardware_flow_rts_config(USART0 USART_RTS_DISABLE);
usart_hardware_flow_cts_config(USART0 USART_CTS_DISABLE);
usart_receive_config(USART0 USART_RECEIVE_ENABLE);
usart_transmit_config(USART0 USART_TRANSMIT_ENABLE);
usart_enable(USART0);
}
void usart0_transmit_arr(uint8_t arr[] uint32_t length) {
for(uint32_t i=0; i usart_data_transmit(USART0 arr[i]);
while (usart_flag_get(USART0 USART_FLAG_TBE)== RESET);
}
}
/* retarget the C library printf function to the USART */
int _put_char(int ch)
{
usart_data_transmit(USART0 (uint8_t)ch );
while ( usart_flag_
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-10-30 21:42 gd32vf_usart_test0\
文件 36235 2019-10-30 21:28 gd32vf_usart_test0\.cproject
文件 846 2019-10-30 21:27 gd32vf_usart_test0\.project
目录 0 2019-10-30 21:27 gd32vf_usart_test0\.settings\
文件 2245 2019-10-30 21:27 gd32vf_usart_test0\.settings\language.settings.xm
目录 0 2019-10-30 21:27 gd32vf_usart_test0\Application\
文件 2445 2019-10-30 21:27 gd32vf_usart_test0\Application\gd32vf103_libopt.h
文件 7361 2019-10-30 22:56 gd32vf_usart_test0\Application\main.c
文件 1825 2019-10-30 21:27 gd32vf_usart_test0\Application\main.h
文件 2295 2019-10-30 21:27 gd32vf_usart_test0\Application\systick.c
文件 1839 2019-10-30 21:27 gd32vf_usart_test0\Application\systick.h
目录 0 2019-10-30 23:00 gd32vf_usart_test0\Debug\
目录 0 2019-10-30 23:00 gd32vf_usart_test0\Debug\Application\
文件 1492 2019-10-30 22:56 gd32vf_usart_test0\Debug\Application\subdir.mk
文件 212798 2019-10-30 22:56 gd32vf_usart_test0\Debug\gd32vf_usart_test0.map
文件 3199 2019-10-30 22:56 gd32vf_usart_test0\Debug\makefile
文件 239 2019-10-30 21:42 gd32vf_usart_test0\Debug\ob
目录 0 2019-10-30 23:00 gd32vf_usart_test0\Debug\Peripherals\
目录 0 2019-10-30 23:00 gd32vf_usart_test0\Debug\Peripherals\Source\
文件 3874 2019-10-30 22:56 gd32vf_usart_test0\Debug\Peripherals\Source\subdir.mk
文件 1449 2019-10-30 22:56 gd32vf_usart_test0\Debug\Peripherals\subdir.mk
目录 0 2019-10-30 21:42 gd32vf_usart_test0\Debug\RISCV\
目录 0 2019-10-30 23:00 gd32vf_usart_test0\Debug\RISCV\drivers\
文件 1438 2019-10-30 22:56 gd32vf_usart_test0\Debug\RISCV\drivers\subdir.mk
目录 0 2019-10-30 23:00 gd32vf_usart_test0\Debug\RISCV\env_Eclipse\
文件 2830 2019-10-30 22:56 gd32vf_usart_test0\Debug\RISCV\env_Eclipse\subdir.mk
目录 0 2019-10-30 23:00 gd32vf_usart_test0\Debug\RISCV\stubs\
文件 2009 2019-10-30 22:56 gd32vf_usart_test0\Debug\RISCV\stubs\subdir.mk
文件 771 2019-10-30 22:56 gd32vf_usart_test0\Debug\sources.mk
目录 0 2019-10-30 23:00 gd32vf_usart_test0\Debug\Utilities\
目录 0 2019-10-30 23:00 gd32vf_usart_test0\Debug\Utilities\LCD_common\
............此处省略91个文件信息
- 上一篇:Sublime风格的IDEA配置文件
- 下一篇:DDOS压力测试工具
相关资源
- MQTT+串口(usart)透传
- STM32F103 USART+DMA
- 4_USART串口通信(空闲中断+DMA.zip
- stm32f105-usart-DMA收发demo
- FreeModbus_Slave+STM32F407+USART2代码亲测可
- 单片机串口printf函数自实现第二版
- CP2102驱动WIN7、WIN10、32位、64位
- Keil5下的STM32F407程序
- USART基于hal库stm32f407串口通讯.rar
- STM32_USART 多机通信学习笔记
- STM32F103采用DMA实现USART2接收和发送
- STM32F103采用DMA实现USART3接收和发送
- 基于SM32F103C8T6的环境传感器
- STM32F407串口1-6 CAN1&2测试例程
- STM32F103 ADC+USART
- FreeModbus_For_STM32_USART1_RS485移植分享
- 串口接收字符串控制LED
- Computer Organization and Design RISC-V Editio
- hypertrm超级终端Win7
- STM32F103_FREERTOS_MPU6050DMP_USART_Timer输入捕
- STM32F103RCT6单片机在串口屏上打印正弦
- 22. USART_CircleBuffer 串口接收环形缓冲区
- stm32 5个串口初始化实现串口缓存,前
- STM32L051C8T6_USART1.zip
- RISC-V 二值化 CNN 芯片加速器进行人员
- STM32 与陶晶驰hmi通信.rar
- STM32_USART_向PC机发送数据
- STM32-串口1收发+串口2
- riscv-privileged-spec-v1.7中文版
- riscv-spec-v2.1中文版
评论
共有 条评论