hi dialog
@file periph_setup.c void periph_init(void)
==============================================
SetBits16(CLK_PER_REG, UART1_ENABLE, 1);
uart_init(UART_BAUDRATE_115K2, 3);
=============================================
add group【driver】 \src\plf\refip\src\driver\uart\uart.c
Build target 'template'
compiling uart.c...
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(290): error: #101: "uint32_t" has already been declared in the current scope
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(290): error: #65: expected a ";"
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(296): error: #18: expected a ")"
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(346): error: #18: expected a ")"
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(370): error: #18: expected a ")"
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(398): error: #20: identifier "i" is undefined
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(424): error: #18: expected a ")"
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(440): error: #757: variable "uint32_t" is not a type name
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(443): error: #757: variable "uint32_t" is not a type name
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(445): error: #18: expected a ")"
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(451): error: #757: variable "uint32_t" is not a type name
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(469): error: #757: variable "uint32_t" is not a type name
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(472): error: #757: variable "uint32_t" is not a type name
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(474): error: #18: expected a ")"
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(481): error: #757: variable "uint32_t" is not a type name
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(510): error: #18: expected a ")"
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(517): warning: #174-D: expression has no effect
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(517): error: #65: expected a ";"
..\..\..\..\ src \ plf \ refip \ uart \ \ src \驱动程序uart.c(518): error: #20: identifier "idd" is undefined
compiling uart_ext_wkup.c...
compiling uart_init.c...
".\out\template.axf" - 18 Errors, 1 Warning(s).
Target not created
Hi libra_13179,
You can use the uart functions without including the uart.c file.The code for the uart exists in the ROM, the errors you get are probably because of the conflicts of symbols.
Thanks MT_dialog.
I need to chang the baund rate to 2400,How to change?
Hi RandyYu,
The uart is normally initialized in the periph_init() via the uart_init() function which takes as a parameter the desired baudrate of the UART module. If you choose UART_BAUDRATE_2K4 instead of the default, it should work on 2400 baud rate.
Thanks MT_dialog
how to use printf?
Hi RandyYu,
In case you want to use print function with a simple project there are a lot of examples in the peripheral examples project.If you would like to use the printing functions with a BLE project i strongly suggest to use the arch_console.h that includes the arch_printf() and other usefull printing functions. You can find the changes in order to use these functions in the following posts.
http://support.dialog-semiconductor.com/ble-app-uart-debug-messages
Also fogot to mention on the previous post you have to add the uart2.c file.
Thanks MT_dialog