Hello,
I have problem with transmit data by UART.
When I try transmit one byte, I see in debug mode how changed register TXDAT UART0 (0x4006401C). But recepient not get this data I use FTDI232 usb to ttl
My code:
usart_config_t user_config;
volatile uint32_t g_systickCounter;
void SysTick_Handler(void)
{
if (g_systickCounter != 0U)
{
g_systickCounter--;
}
}void SysTick_DelayTicks(uint32_t n)
{
g_systickCounter = n;
while(g_systickCounter != 0U)
{
}
}int main(void) {
// /* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();
// /* Init FSL debug console. */
BOARD_InitDebugConsole();
if(SysTick_Config(SystemCoreClock / 1000U))
{
while(1)
{
}
}USART_GetDefaultConfig(&user_config);
user_config.baudRate_Bps = 9600U;
user_config.enableTx = true;
user_config.enableRx = true;USART_Init(USART0, &user_config, DEFAULT_SYSTEM_CLOCK);
uint8_t ch=65;
while(1) {
USART_WriteByte(USART0, ch);
SysTick_DelayTicks(1000U);
}
return 0 ;
}
Pin init
void BOARD_InitPins(void)
{
/* Enables clock for switch matrix.: 0x01u */
CLOCK_EnableClock(kCLOCK_Swm);/* USART0_TXD connect to P0_4 */
SWM_SetMovablePinSelect(SWM0, kSWM_USART0_TXD, kSWM_PortPin_P0_4);/* USART0_RXD connect to P0_0 */
SWM_SetMovablePinSelect(SWM0, kSWM_USART0_RXD, kSWM_PortPin_P0_0);/* SWCLK connect to P0_3 */
SWM_SetFixedPinSelect(SWM0, kSWM_SWCLK, true);/* SWDIO connect to P0_2 */
SWM_SetFixedPinSelect(SWM0, kSWM_SWDIO, true);/* Disable clock for switch matrix. */
CLOCK_DisableClock(kCLOCK_Swm);
}
When I wrong?
Hi Yurii Korman,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
I was wondering if you can tell which SDK demo and board you tested on, I'd like to replicate this phenomenon on my site.
I'm looking forward to your reply.
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Jeremyzhou,
Thanks for your reply, I use SDK with version 2.4.0, for LPCXpresso824MAX.
And use example from documentation MCUXpresso SDK API Reference Manual: USART: Universal Asynchronous Receiver/Transmitter Driver
Hi Yuri Korman,
Thanks for your reply.
Actually, I hasn't found some errors in the previous code.
Whether you have run some UART demos in the SDK library before, if yes, I'd highly recommend you to modify these demos for your goal.
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------