uart examples in sdk 2.0

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

uart examples in sdk 2.0

798 Views
roymessinger
Contributor V

In the sdk 2.0 there are 5 examples of UART. I've spent few hours but got lost regarding the different variations of UART, especially the interrupt versions.

Can you explain when do I use each UART interrupt example?

I mean, 3 versions of interrupt exist. When do i use the ring buffer (rb)?

What is the diff between uart_interrupt_transfer_frdm_k64 and uart_interrupt_frdm_k64?

Labels (1)
Tags (2)
0 Kudos
3 Replies

526 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Roy,

Regarding the difference among the 5 uart examples, this is the basic mechanism for the 5 examples.

1)Polling_transfer: it uses the polling mode for uart receiver and transmitter by checking the UARTx_S1 register.

2)interrupt example: it use the interrupt mode for uart receiver, in the ISR of receiver, read data from UARTx_D register, write the data to a ring buffer. If there is new data in the ring buffer, transmit it by polling mode. In the mode, the ISR is open to user, user can access the ISR of uart receiver and transmitter.

3)interrupt_transfer: it uses the interrupt mode to receive/transmit data, but the Uart ISR is NOT open to user, the ISR is encapsulated. When the specified number of data has been transmitted or received, a callback function is called, in the callback function, user can write application code.

4)interrupt_ring_buffer_transfer: it is similar to interrupt_transfer example, but it uses ring buffer.

5)edma_transfer: it uses dma mechanism to transfer data instead of interrupt mode as the name implies.

Hope it can help you

BR

XiangJun Rong

0 Kudos

526 Views
roymessinger
Contributor V

Ok, Thank you very much for that. 

Can you clarify regarding the names you wrote?

The SDK contains:

uart_interrupt (is this no.2 at your reply?),

uart_interrupt_rb_transfer(no.4 at your reply),

uart_polling(no.1), 

uart_interrupt_transfer (is this no.3 at your reply?),

1. In case I want to use interrupt mode, which is preferred? I guess it's rather vague question, but what is the meaning of the ISR is encapsulated or not?

Obviously I want to write an application in which according the received data I will do this and that. Why do I need to care about the ISR?

Thanks,

0 Kudos

526 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

 Hi,

I atatch the screenshot of the example code:

BR

Xiangjun Rong

pastedImage_1.png

0 Kudos