当前位置:首页 > 公众号精选 > 嵌入式微处理器
[导读]基于ST的对应型号缺货,大家都纷纷测试国内的替代芯片,我也想试一把。看到GD32E230C8T6理论上可以替代STM32F103C8T6,在这次去X商城买料的时候,我顺便买了片样片,并要了个免费的最新系统样板PCB。到货后,马不停蹄开工,焊好。焊好后,去官网下载资料:(资料下载请...


基于ST的对应型号缺货,大家都纷纷测试国内的替代芯片,我也想试一把。看到GD32E230C8T6理论上可以替代STM32F103C8T6,在这次去X商城买料的时候,我顺便买了片样片,并要了个免费的最新系统样板PCB。

到货后,马不停蹄开工,焊好。



焊好后,去官网下载资料:(资料下载请点击阅读原文内下载)

MDK PACK:  GD32E23x_AddOn_V1.1.0.rar (1.77 MB,)
规格书:  GD32E230xx_Datasheet_Rev1.4.pdf (2.44 MB)
用户手册:  GD32E23x_yonghushouce_Rev1.4.pdf (8.4 MB)
固件手册:  GD32E23x_gujiankushiyongzhinan_Rev1.0.pdf (5.69 MB)
BSP:  GD32E23x_Firmware_Library_V1.1.1.rar (861.82 KB)
对应开发板资料:  GD32E23x_Demo_Suites_V1.0.1.rar (4.06 MB)
为了放心,我还是粗略的看了下它的规格书:

主要描述(除了内核M23,其他外设几乎没啥变动)


当前选用的C8T6(容量还是跟ST的保持一致,国产的就不能大些么~)


引导模式:



其中有一点不一样的就是,它的BOOT1由原来的映射引脚,变成了寄存器的一个配置位!




我们用跳帽把BOOT0连到GND,选择内部FLASH启动~
//////////////////////////////////////////////////////////////
我们看下我们最小系统的原理图:



不能再简陋了,就是最小系统加4个LED,2个KEY(其中只有WAKEUP能编程用)。
我们连接它的串口,好让调试信息输出:

查看数据手册得:



还是PA9/PA10与ST的一样。

我们打开GD32E23x_Demo_Suites_V1.0.1\GD32E230C_EVAL_Demo_Suites,这个板型号跟我的最新系统一致,就用它的程序进行更改:



我们发现在它的gd32e230c_eval文件里,几乎包含了我们想要的外设,但是引脚有少许差异,修改下:

/*! \file gd32e230c_eval.h \brief definitions for GD32E230C_EVAL's leds, keys and COM ports hardware resources
\version 2019-02-19, V1.0.0, firmware for GD32E23x*/
/* Copyright (c) 2019, GigaDevice Semiconductor Inc.
All rights reserved.
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.*/
#ifndef GD32E230C_EVAL_H#define GD32E230C_EVAL_H
#ifdef cplusplus
extern "C" {#endif
#include "gd32e23x.h"
/* exported types */typedef enum { LED1 = 0, LED2 = 1, LED3 = 2, LED4 = 3}led_typedef_enum;
typedef enum { KEY_WAKEUP = 0, //KEY_TAMPER = 1,}key_typedef_enum;
typedef enum { KEY_MODE_GPIO = 0, KEY_MODE_EXTI = 1}keymode_typedef_enum;

/* eval board low layer led */#define LEDn 4U
#define LED1_PIN GPIO_PIN_10#define LED1_GPIO_PORT GPIOB#define LED1_GPIO_CLK RCU_GPIOB
#define LED2_PIN GPIO_PIN_11#define LED2_GPIO_PORT GPIOB#define LED2_GPIO_CLK RCU_GPIOB
#define LED3_PIN GPIO_PIN_8#define LED3_GPIO_PORT GPIOA#define LED3_GPIO_CLK RCU_GPIOA
#define LED4_PIN GPIO_PIN_9#define LED4_GPIO_PORT GPIOA#define LED4_GPIO_CLK RCU_GPIOA
/* eval board low layer button */ #define KEYn 1U //2U
/* 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 EXTI_SOURCE_GPIOA#define WAKEUP_KEY_EXTI_PIN_SOURCE EXTI_SOURCE_PIN0#define WAKEUP_KEY_EXTI_IRQn EXTI0_1_IRQn
/* tamper push-button *///#define TAMPER_KEY_PIN GPIO_PIN_13//#define TAMPER_KEY_GPIO_PORT GPIOC//#define TAMPER_KEY_GPIO_CLK RCU_GPIOC//#define TAMPER_KEY_EXTI_LINE EXTI_13//#define TAMPER_KEY_EXTI_PORT_SOURCE EXTI_SOURCE_GPIOC//#define TAMPER_KEY_EXTI_PIN_SOURCE EXTI_SOURCE_PIN13//#define TAMPER_KEY_EXTI_IRQn EXTI4_15_IRQn
/* eval board low layer COM */#define COMn 1U
/* definition for COM, connected to USART0 */#define EVAL_COM USART0#define EVAL_COM_CLK RCU_USART0
#define EVAL_COM_TX_PIN GPIO_PIN_9#define EVAL_COM_RX_PIN GPIO_PIN_10
#define EVAL_COM_GPIO_PORT GPIOA#define EVAL_COM_GPIO_CLK RCU_GPIOA#define EVAL_COM_AF GPIO_AF_1
/* function declarations *//* configure led GPIO */void gd_eval_led_init(led_typedef_enum lednum);/* turn on selected led */void gd_eval_led_on(led_typedef_enum lednum);/* turn off selected led */void gd_eval_led_off(led_typedef_enum lednum);/* toggle the selected led */void gd_eval_led_toggle(led_typedef_enum lednum);/* configure key */void gd_eval_key_init(key_typedef_enum keynum, keymode_typedef_enum keymode);/* return the selected key state */uint8_t gd_eval_key_state_get(key_typedef_enum keynum);/* configure COM port */void gd_eval_com_init(uint32_t com);
#ifdef cplusplus}#endif
#endif /* GD32E230C_EVAL_H */

main函数修改如下:


/*! \file main.c \brief running LED \version 2019-02-19, V1.0.0, firmware for GD32E23x*//* Copyright (c) 2019, GigaDevice Semiconductor Inc. All rights reserved. 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 "gd32e23x.h"#include "gd32e230c_eval.h"#include "systick.h"#include /*! \brief main function \param[in] none \param[out] none \retval none*/int main(void){//时钟初始化 systick_config();//初始化LED gd_eval_led_init(LED1); gd_eval_led_init(LED2); gd_eval_led_init(LED3); gd_eval_led_init(LED4); gd_eval_led_off(LED1); gd_eval_led_off(LED2); gd_eval_led_off(LED3); gd_eval_led_off(LED4);//初始化按键 gd_eval_key_init(KEY_WAKEUP,KEY_MODE_GPIO);//初始化串口0 gd_eval_com_init(EVAL_COM);while(gd_eval_key_state_get(KEY_WAKEUP)==SET) {printf("please press wakeup_key to continue!\r\n"); delay_1ms(200); }while(1){/* turn on LED1, turn off LED4 */ gd_eval_led_on(LED1); gd_eval_led_off(LED4); delay_1ms(1000);/* turn on LED2, turn off LED1 */ gd_eval_led_on(LED2); gd_eval_led_off(LED1); delay_1ms(1000);/* turn on LED3, turn off LED2 */ gd_eval_led_on(LED3); gd_eval_led_off(LED2); delay_1ms(1000);/* turn on LED4, turn off LED3 */ gd_eval_led_on(LED4); gd_eval_led_off(LED3); delay_1ms(1000); }}/* retarget the C library printf function to the USART */int fputc(int ch, FILE *f){ usart_data_transmit(USART0, (uint8_t) ch);while(RESET == usart_flag_get(USART0, USART_FLAG_TBE));return ch;}

编译下载,查看现象:


按下WAKEUP键后,继续执行到WHILE里面:


LED轮流亮灭~

好了,就到这~
总体而言没发现啥特别,上手也不难,库写的可读写也可以。
总而言之,国产MCU与国外的差距越来越小了~

END
来文系21ic坛友qjp1988113原创撰写
嵌入式ARM

扫描二维码,关注更多精彩内容

本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除。
换一批
延伸阅读

9月2日消息,不造车的华为或将催生出更大的独角兽公司,随着阿维塔和赛力斯的入局,华为引望愈发显得引人瞩目。

关键字: 阿维塔 塞力斯 华为

加利福尼亚州圣克拉拉县2024年8月30日 /美通社/ -- 数字化转型技术解决方案公司Trianz今天宣布,该公司与Amazon Web Services (AWS)签订了...

关键字: AWS AN BSP 数字化

伦敦2024年8月29日 /美通社/ -- 英国汽车技术公司SODA.Auto推出其旗舰产品SODA V,这是全球首款涵盖汽车工程师从创意到认证的所有需求的工具,可用于创建软件定义汽车。 SODA V工具的开发耗时1.5...

关键字: 汽车 人工智能 智能驱动 BSP

北京2024年8月28日 /美通社/ -- 越来越多用户希望企业业务能7×24不间断运行,同时企业却面临越来越多业务中断的风险,如企业系统复杂性的增加,频繁的功能更新和发布等。如何确保业务连续性,提升韧性,成...

关键字: 亚马逊 解密 控制平面 BSP

8月30日消息,据媒体报道,腾讯和网易近期正在缩减他们对日本游戏市场的投资。

关键字: 腾讯 编码器 CPU

8月28日消息,今天上午,2024中国国际大数据产业博览会开幕式在贵阳举行,华为董事、质量流程IT总裁陶景文发表了演讲。

关键字: 华为 12nm EDA 半导体

8月28日消息,在2024中国国际大数据产业博览会上,华为常务董事、华为云CEO张平安发表演讲称,数字世界的话语权最终是由生态的繁荣决定的。

关键字: 华为 12nm 手机 卫星通信

要点: 有效应对环境变化,经营业绩稳中有升 落实提质增效举措,毛利润率延续升势 战略布局成效显著,战新业务引领增长 以科技创新为引领,提升企业核心竞争力 坚持高质量发展策略,塑强核心竞争优势...

关键字: 通信 BSP 电信运营商 数字经济

北京2024年8月27日 /美通社/ -- 8月21日,由中央广播电视总台与中国电影电视技术学会联合牵头组建的NVI技术创新联盟在BIRTV2024超高清全产业链发展研讨会上宣布正式成立。 活动现场 NVI技术创新联...

关键字: VI 传输协议 音频 BSP

北京2024年8月27日 /美通社/ -- 在8月23日举办的2024年长三角生态绿色一体化发展示范区联合招商会上,软通动力信息技术(集团)股份有限公司(以下简称"软通动力")与长三角投资(上海)有限...

关键字: BSP 信息技术
关闭
关闭