Hi,
I try to get UART3 on LPC4088 working, already got UART TX working well, but RX stops in RBR register. I checked the Rx pin with the oscilloscope and there is some data incoming. I configured UART with 115200Baud at 120MHz CCLK so I think the Baud isn't the problem.
When I compile the program and step into it the LSR register get the value 0x60 (0b0110 0000) and the program stuck in the while loop, so I obviously received a framing error, parity error or break interrupt. I attached some simple UART config.
I use Hterm as Terminal to send to the MCU
Best Tim
Hi Tim,
It is quite a coincidence that I am conducting 485 communication experiment these days, and using a lot of UART. So, maybe I can offer some sugggestions from my experience.
After config and initialization of the gpio and uart peripherals, have you checked your irq_init functions?
And when you operate the RX and TX signals, have you checked your header-files of uart and IRQ?
I think the two points are made mistake easily or even be ignored, please check here.
Let me know your results.
Best Regards,
Adrian
Hi Tim,
Based on your description I have some observations that may help debug this issue that you are having. When reading your LSR register you have 0x60, this means that your transmitter register is also empty, therefore nothing is being sent and consequently your while loop will remain as nothing is received.
Can you please check the status of the 1) DLAB prior to reading the LSR register(from the code your provided I can see you clear this bit at the end of initialization, but I'd like to make sure that nothing is changing it prior to your UART3_receiving), 2) try hardcoding a value into THR and then calling your receive function (here you should be able to confirm if you are properly sending and receiving).
In that section you should essentially do the following:
UART3 -> THR = data_to_send;
UART3->LCR DLAB status?/* not necessary if you confirm that it is 0 prior to reading the next line*/
read_register_value = UART->LSR; (check if thr has data or not)
data_to_read = UART->RBR;
data_to_send == data_to_read?
Also you mention that you are able to see some data incoming. Can you please elaborate, when do you see this? and is it what you were expecting for that moment?
Let me know the results.
Best Regards,
Sabina
Hi Sabina,
thank you for your reply. After UART initialization I checked the register values:
LSR = 0x60
LCR = 3
FCR = 193
IIR = 193
RBR = 0
I followed your example and THR works, the value was sent correctly. But the RBR register stays 0.
After my UART init I send a welcome screen to my pc and is receive that correctly. I used for that the UART_send function from CMSIS. I also tried that with UART_read but no luck with that.
My terminal program is HTERM with rx configuration 115200Baud, 8 Data, 1 Stop, 0 Parity
Best Regards
Tim
Hi Tim,
As newsxzu@hotmail.com mentions it possible that it may with your handler for when you are receiving. You can check the UART example for the LPC4088 in the LPCOpen folder. This way you can see how the handler is implemented there and compare with yours to see if you are missing anything.
If you are using MCUXpresso this folder is automatically included you can find it in the following path in your PC:
C:\nxp\MCUXpressoIDE_11.0.0_2516\ide\Examples\LPCOpen
You will see many zip folders for different LPC families. Select the one for 4088 and within you will see an example called, "periph_uart".
Also you mention your FCR is 193(1100 0001b), so from the register it looks like you need 14 characters to enable a rx trigger.Try with 0x0 and see if by inputing one character you get an expected reaction.
Hope this helps.
Best Regards,
Sabina