UART not working

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

UART not working

1,321 次查看
coder1610
Contributor I

I want to use LPC804M101JDH24 for serial communication. I have attached code which is not working.

It seems that the character is not received. I have used PIO0_4 and PIO0_0 as TX and RX and linked all necessary header files as well.

Please suggest what is wrong in code.

Thanks in advance.

0 项奖励
回复
3 回复数

1,215 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

You gave us only part of code, I do not know if you understand how to initialize the SWM:

Enable_Periph_Clock(CLK_SWM);

SWM->PINASSIGN_DATA[0]=0x0000;

SWM->PINASSIGN_DATA[0]|=4<<0|0<<8;

xiangjun_rong_1-1713331624280.png

Then PIO0_4  will function as UIART0_TXD, PIO0_0 will function as UART0_RXD

If the uart0  receiver can not get char, pls check the baud rate.

Hope it can help you

BR

XiangJun Rong

 

 

0 项奖励
回复

1,198 次查看
coder1610
Contributor I

Well I have included swm.h file, which is attached here.

Also, baud rate is 9600 which is not an issue.

Please help.

Thank you.

0 项奖励
回复

1,191 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Pls write a code to repeat to output char, then connect a scope to an scope and check if you can see the waveform and check the baud rate.

Hope it can help you

BR

XiangJun Rong

0 项奖励
回复