Using UART with flexcomm3?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using UART with flexcomm3?

2,310 Views
puddletowntom
Contributor III

I had previously used UART with the lpcxpresso 5411 dev board with a basic example that worked communicating serial through the pins 0/1 (port0 pin0 --> Rx, port0 pin1 --> Tx). The example was usart_interrupt_transfer from the sdk folder. This was fine but when I tried to use UART using different pins I had trouble seeing anything transmitted. The new pins I m using are port1 pin4 --> Tx and port1 pin9 --> Rx. 

From the dev board datasheet it says that this is on flexcomm 3. So I made changes to so that instead of using flexcomm0 I m using flexcomm3. So I have a few questions about this.

- For the definitions, do you need USART3 for flexcomm3 (or can you just use USART0 for flexcomm3),

- Have I set up my pinmux.c file attached correctly?

- Am I configuring the USART correctly?,

2 Replies

1,644 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Ronan,

I tried the example usart_interrupt_transfer with the pins you mentioned (port1_pin4 and port1_pin9) and it works fine. 

For the definitions, do you need USART3 for flexcomm3 (or can you just use USART0 for flexcomm3)?

Yes, you need USART3 for flexcomm3, you can't use the USART0 for a flexcomm that isn't flexcomm0. 

Have I set up my pinmux.c file attached correctly?

The PinMuxSet looks fine, you are selecting the correct function for each pin, function 2 for pin 9 and function 5 for pin 4.

Am I configuring the USART correctly?

In the image attached in the line 9 you have the next call to function: 

RESET_PeripheralReset(kFC0_RST_SHIFT_RSTn);

But in this case you are not using anymore the flexcomm0 as  you mentioned before, so you need to replace the parameter of this function in order to reset the flexcomm3 instead:

RESET_PeripheralReset(kFC3_RST_SHIFT_RSTn);

In the example usart_interrupt_transfer in the main you have the function where you attach the clock to the flexcomm0:

/* attach 12 MHz clock to FLEXCOMM0 (debug console) */
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM0);

For your example you need to change the parameter of this function to attach the clock to the flexcomm3 instead, please validate that you have this on your code.

CLOCK_AttachClk(kFRO12M_to_FLEXCOMM3);

Also it's important to mentioned that in the main of the example you are calling the next function:

BOARD_InitDebugConsole();

This function what it does is that it sets the UART0 as a debug console, so this will cause problems in your program as it will try to send and receive the data through UART0 instead of UART3, so please comment this call to function or delete it. 

Finally, please validate that you are connecting the external USART to the correct pins (port1_pin4 and port1_pin9) in the next file (Schematic) in page 6 you will find the schematics. 

Following these steps the example should work fine with any USART you want to use! 

Please let me know if you have any more doubts. 

Have a great day, 

Victor.

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,644 Views
puddletowntom
Contributor III

Hi Victor,

This worked great. It was removing the function BOARD_InitDebugConsole() that did the trick. Also I had to use  RESET_PeripheralReset(kFC3_RST_SHIFT_RSTn); I changed this before, I just forgot to change it in the attachment above.

I am very grateful for your detailed response. I was trying to fix this for a while and now its done.

Thank you,

Ronan