我在cortex-m3编程一个基本的uart回声, 但我在腻子上变得光滑
使用100 MHz时钟频率用于cortex-m3
波特率57600
giberish输出可能是什么原因, uart 波特率与cortex-m3时钟频率有多重或某种关系,或者Amba总线频率与波特率有某种关系
程序如下 - >
#include "drivers/mss_uart/mss_uart.h"
mss_uart_instance_t * const gp_my_uart = &g_mss_uart0;
/*==============================================================================
* main function.
*/
int main()
{
size_t rx_size;
uint8_t rx_buff[1];
/* Turn off the watchdog */
SYSREG->WDOG_CR = 0;
/*--------------------------------------------------------------------------
* Initialize and configure UART.
*/
MSS_UART_init(gp_my_uart,
MSS_UART_57600_BAUD,
MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY | MSS_UART_ONE_STOP_BIT);
/*--------------------------------------------------------------------------
* Send greeting message over the UART.
*/
MSS_UART_polled_tx_string(gp_my_uart,(const uint8_t*)"\n\r\n\r**********************************************************************\n\r");
MSS_UART_polled_tx_string(gp_my_uart,(const uint8_t*)"******************** SmartFusion2 MMUART Example *********************\n\r");
MSS_UART_polled_tx_string(gp_my_uart,(const uint8_t*)"**********************************************************************\n\r");
MSS_UART_polled_tx_string(gp_my_uart,(const uint8_t*)"Characters typed will be echoed back.\n\r");
/*--------------------------------------------------------------------------
* Echo back any characters received.
*/
for (;;)
{
rx_size = MSS_UART_get_rx(gp_my_uart, rx_buff, sizeof(rx_buff));
if( rx_size > 0 )
{
MSS_UART_polled_tx(gp_my_uart, rx_buff, sizeof(rx_buff));
}
}
}