Hello, I am working in mdk5. For my application I am writting code for RS485. While debugging I found that my FCR register is not loading its value. The code I have written is show below. void uart_rs485(void) { SCU_PinConfigure(2,3, SCU_CFG_MODE_FUNC2);// p2_3 for U3_TXD SCU_PinConfigure(2,4, SCU_CFG_MODE_FUNC2);// p2_4 for U3_RXD GPIO_SetDir(4,11,GPIO_DIR_OUTPUT);// Set GIO_B1_RS485_DIR as output
LPC_USART3->LCR = 0x83;// Line Control Register LPC_USART3->FCR =0x07;//FIFO buffer LPC_USART3->FDR =0;// Fractional Divide LPC_USART3->DLM =0;//Divide Latch MSB LPC_USART3->DLL =98;//Divide Latch LSB LPC_USART3->LCR =0x03;//Disable DLAB
} 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; } Please help me in this flow. Thank you in advance
Hi Rajesh, I have a request to you. Please read the each and every line of the answers you get here. If it is not understandable in first read then read it again and again until it is completely making sense to you. yes sometimes it is difficult for us because of the too much english they use in the answers ;).
So from the first response your questions Andy,
Whoever trying to help you here did not find your post as well presented as they like every professionals do. Again too much expectations on us right.. Your code look like you have a map on scribbles. So he is trying to help you to improve in that area. It is not technically solving your URGENT problem. But believe me you will be needing that anytime soon in your career.
Next, from the second answer you got from B Carutt, He asking you to uncomment an important line which seems to directly linked to your problem statement. But he also asking you to check the criticality of all other commented lines because he thinks those commented lines seem to be more than just comments.
Next, From the third answer you got from Westonsupermare Pier, I do not understand the meaning of the sarcasm. If it same to you then just ignore that answer.
Next, from your response, you did some clean up in your copy pasted code. And added some proper(I assume) register settings. But you failed to mention many information here. They do not know what is the result after you modified the code such as 1.Even after your code change still not able to load the FCR reg? and many more may be (i.e micro, hardware info, details of testing method etc).
And a final note from me, in this forum you do not get the right answers always but always learn something if you're willing. I was once in your shoes.