USART interrupt exampls

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

USART interrupt exampls

1,028 Views
zhangeh10594
Contributor III

Recently I‘m writing the code for USART in interrupt mode,and I was refer to the examples of the SDK.But I can't find the Timing and Control aspect of the code。In other words, when send the last words to the FIFO,or other upper layer interrupt to react,how  much can I set the hold time to wait.

the second question:pastedImage_1.pngwhat the differences with this folders,and please told me if I want to write my code about USART with FIFO interrupt,which one can I refer to。

My MCU is LPC55S69,and my board is LPC55S69-EVK。

Labels (1)
0 Kudos
Reply
1 Reply

883 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello,

 

The differences in each folder are explained in the readme.txt of each example. You can find this document under the folder "doc" of each example. However I will give brief description of three principal ones.

 

  • The DMA_Transfer echoes the data sent every 8 characters. That means that it will wait until the 8 character is written to send the complete 8 characters back. In addition this example sends data using the DMA module. It is a non-blocking function, which returns right away.
  • The interrupt example will send back all the characters that are sent by the PC via UART. So essentially when an interrupt is triggered, the data is saved in a buffer. However in the main function there is a while loop which is checking the buffer, if there is data it sends it out.
  • The polling example is similar to the interrupt, except it is reading and writing in a cycle. The read function reads the RX register using a blocking method. It polls the RX register, waits for the RX register to be full or for the RX FIFO to have data and then read data from the RX register. The write function also uses a blocking method to write to the TX register. It  polls the TX register, waits for it to be empty or  for the TX FIFO to have room and writes data to the TX buffer.

 

From your description in your question, I believe you are referring to hardware flow control. Hardware flow control allows you to control when data can be sent or received with a sort of handshake. Basically on one side you have an RTS(Ready to send) signal which informs that they have data to send out. On the other side you have CTS(Clear to send) signal, and this informs that they are ready to receive. This way you have more control of the USART communication. You can find more information regarding this in Chapter 34 of the reference manual.

 

Please let me know if this answers your questions.

Have a great day!

Sabina