AnsweredAssumed Answered

RS485 using LPC1857

Question asked by NELVI JOHN on Mar 17, 2017
Latest reply on Mar 27, 2017 by Kerry Zhou

Hi all,

I am a beginner to MDK5 from Keil. This is the first time I am working on LPC1857. I have created a web page using the HTTP server sample code from Keil. Now I want to receive values using RS485. So, I am using Uart3 of my LPC1857 for this purpose. The code I have written is given below.

void uart_rs485(void) { SCU_PinConfigure(2,3, SCU_CFG_MODE_FUNC2); SCU_PinConfigure(2,4, SCU_CFG_MODE_FUNC2); GPIO_SetDir(4,11,GPIO_DIR_OUTPUT); LPC_USART3->LCR = 0x83; LPC_USART3->FCR =0x07; LPC_USART3->FDR =0; LPC_USART3->DLM =0; LPC_USART3->DLL =98; LPC_USART3->LCR =0x03;  } void uart_rs485_transmit(void) { GPIO_PinWrite(4,11,1);//Making Transmit Enable high if(LPC_USART3->LSR & 0x20) { LPC_USART3->THR = 83; } }  void uart_rs485_receive(void) { 
GPIO_PinWrite(4,11,0);//Receive Enable a = LPC_USART3->RBR; }

While debugging I came to know that FCR is not loading its value. What might be the reason. Besides, is it require to provide power to the uart unit? Is there any sample code for that? Please help me in this flow.

Outcomes