當(dāng)前位置:首頁 > 公眾號精選 > 嵌入式微處理器
[導(dǎo)讀]基于ST的對應(yīng)型號缺貨,大家都紛紛測試國內(nèi)的替代芯片,我也想試一把??吹紾D32E230C8T6理論上可以替代STM32F103C8T6,在這次去X商城買料的時(shí)候,我順便買了片樣片,并要了個(gè)免費(fèi)的最新系統(tǒng)樣板PCB。到貨后,馬不停蹄開工,焊好。焊好后,去官網(wǎng)下載資料:(資料下載請...


基于ST的對應(yīng)型號缺貨,大家都紛紛測試國內(nèi)的替代芯片,我也想試一把??吹?a href="/tags/GD32E230" target="_blank">GD32E230C8T6理論上可以替代STM32F103C8T6,在這次去X商城買料的時(shí)候,我順便買了片樣片,并要了個(gè)免費(fèi)的最新系統(tǒng)樣板PCB。

到貨后,馬不停蹄開工,焊好。



焊好后,去官網(wǎng)下載資料:(資料下載請點(diǎn)擊閱讀原文內(nèi)下載)

MDK PACK:??GD32E23x_AddOn_V1.1.0.rar?(1.77 MB,)
規(guī)格書:??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)
對應(yīng)開發(fā)板資料:??GD32E23x_Demo_Suites_V1.0.1.rar?(4.06 MB)
為了放心,我還是粗略的看了下它的規(guī)格書:

主要描述(除了內(nèi)核M23,其他外設(shè)幾乎沒啥變動)


當(dāng)前選用的C8T6(容量還是跟ST的保持一致,國產(chǎn)的就不能大些么~)


引導(dǎo)模式:



其中有一點(diǎn)不一樣的就是,它的BOOT1由原來的映射引腳,變成了寄存器的一個(gè)配置位!




我們用跳帽把BOOT0連到GND,選擇內(nèi)部FLASH啟動~
//////////////////////////////////////////////////////////////
我們看下我們最小系統(tǒng)的原理圖:



不能再簡陋了,就是最小系統(tǒng)加4個(gè)LED,2個(gè)KEY(其中只有WAKEUP能編程用)。
我們連接它的串口,好讓調(diào)試信息輸出:

查看數(shù)據(jù)手冊得:



還是PA9/PA10與ST的一樣。

我們打開GD32E23x_Demo_Suites_V1.0.1\GD32E230C_EVAL_Demo_Suites,這個(gè)板型號跟我的最新系統(tǒng)一致,就用它的程序進(jìn)行更改:



我們發(fā)現(xiàn)在它的gd32e230c_eval文件里,幾乎包含了我們想要的外設(shè),但是引腳有少許差異,修改下:

/*! \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函數(shù)修改如下:


/*! \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){//時(shí)鐘初始化 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;}

編譯下載,查看現(xiàn)象:


按下WAKEUP鍵后,繼續(xù)執(zhí)行到WHILE里面:

?
LED輪流亮滅~

好了,就到這~
總體而言沒發(fā)現(xiàn)啥特別,上手也不難,庫寫的可讀寫也可以。
總而言之,國產(chǎn)MCU與國外的差距越來越小了~

END
來文系21ic壇友qjp1988113原創(chuàng)撰寫
嵌入式ARM

掃描二維碼,關(guān)注更多精彩內(nèi)容

本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請及時(shí)聯(lián)系本站刪除。
換一批
延伸閱讀

9月2日消息,不造車的華為或?qū)⒋呱龈蟮莫?dú)角獸公司,隨著阿維塔和賽力斯的入局,華為引望愈發(fā)顯得引人矚目。

關(guān)鍵字: 阿維塔 塞力斯 華為

加利福尼亞州圣克拉拉縣2024年8月30日 /美通社/ -- 數(shù)字化轉(zhuǎn)型技術(shù)解決方案公司Trianz今天宣布,該公司與Amazon Web Services (AWS)簽訂了...

關(guān)鍵字: AWS AN BSP 數(shù)字化

倫敦2024年8月29日 /美通社/ -- 英國汽車技術(shù)公司SODA.Auto推出其旗艦產(chǎn)品SODA V,這是全球首款涵蓋汽車工程師從創(chuàng)意到認(rèn)證的所有需求的工具,可用于創(chuàng)建軟件定義汽車。 SODA V工具的開發(fā)耗時(shí)1.5...

關(guān)鍵字: 汽車 人工智能 智能驅(qū)動 BSP

北京2024年8月28日 /美通社/ -- 越來越多用戶希望企業(yè)業(yè)務(wù)能7×24不間斷運(yùn)行,同時(shí)企業(yè)卻面臨越來越多業(yè)務(wù)中斷的風(fēng)險(xiǎn),如企業(yè)系統(tǒng)復(fù)雜性的增加,頻繁的功能更新和發(fā)布等。如何確保業(yè)務(wù)連續(xù)性,提升韌性,成...

關(guān)鍵字: 亞馬遜 解密 控制平面 BSP

8月30日消息,據(jù)媒體報(bào)道,騰訊和網(wǎng)易近期正在縮減他們對日本游戲市場的投資。

關(guān)鍵字: 騰訊 編碼器 CPU

8月28日消息,今天上午,2024中國國際大數(shù)據(jù)產(chǎn)業(yè)博覽會開幕式在貴陽舉行,華為董事、質(zhì)量流程IT總裁陶景文發(fā)表了演講。

關(guān)鍵字: 華為 12nm EDA 半導(dǎo)體

8月28日消息,在2024中國國際大數(shù)據(jù)產(chǎn)業(yè)博覽會上,華為常務(wù)董事、華為云CEO張平安發(fā)表演講稱,數(shù)字世界的話語權(quán)最終是由生態(tài)的繁榮決定的。

關(guān)鍵字: 華為 12nm 手機(jī) 衛(wèi)星通信

要點(diǎn): 有效應(yīng)對環(huán)境變化,經(jīng)營業(yè)績穩(wěn)中有升 落實(shí)提質(zhì)增效舉措,毛利潤率延續(xù)升勢 戰(zhàn)略布局成效顯著,戰(zhàn)新業(yè)務(wù)引領(lǐng)增長 以科技創(chuàng)新為引領(lǐng),提升企業(yè)核心競爭力 堅(jiān)持高質(zhì)量發(fā)展策略,塑強(qiáng)核心競爭優(yōu)勢...

關(guān)鍵字: 通信 BSP 電信運(yùn)營商 數(shù)字經(jīng)濟(jì)

北京2024年8月27日 /美通社/ -- 8月21日,由中央廣播電視總臺與中國電影電視技術(shù)學(xué)會聯(lián)合牽頭組建的NVI技術(shù)創(chuàng)新聯(lián)盟在BIRTV2024超高清全產(chǎn)業(yè)鏈發(fā)展研討會上宣布正式成立。 活動現(xiàn)場 NVI技術(shù)創(chuàng)新聯(lián)...

關(guān)鍵字: VI 傳輸協(xié)議 音頻 BSP

北京2024年8月27日 /美通社/ -- 在8月23日舉辦的2024年長三角生態(tài)綠色一體化發(fā)展示范區(qū)聯(lián)合招商會上,軟通動力信息技術(shù)(集團(tuán))股份有限公司(以下簡稱"軟通動力")與長三角投資(上海)有限...

關(guān)鍵字: BSP 信息技術(shù)
關(guān)閉
關(guān)閉