K70 UART using interrupt ISR in MQX

cancel
Showing results for 
Search instead for 
Did you mean: 

K70 UART using interrupt ISR in MQX

Jump to solution
443 Views
vibhu
Contributor III

Hi Guys,

I am new to freescale controller and MQX. I downloaded and installed MQX v4.1. I am using keil uvision IDE. I was able to program the twr-k7f120m board with the hello world and gpio programs and it is working fine. I also tried a normal uart; communication using _io_write and _io_read and it is also working fine. 

Now I want to implement UART using interrupt method. I suppose the above method which I tested was polling method.

Can anyone help me if there is any example for using interrupts and #isr; in the controller ?

Thanks in advance :smileyhappy:

Thanks :smileyhappy:

Vibhu. 

0 Kudos
1 Solution
225 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Vibhu:

There are two types of uart drivers in MQX, the interrupt mode and polled mode.

If you need to use interrupt mode, please enable relative uart in user_config.h.  Let's take uart a for example.

....

#define BSPCFG_ENABLE_TTYA       0   //poll mode
#define BSPCFG_ENABLE_ITTYA      1   // interrupt mode.
.....

Then fopen the uart channel. and receive and send data.

There is an example in MQX package,  the rs485 demo demonstrates how to transmit and receive data through rs485 data's channel (ittyd:).

Please refer to the demo for more details.

Freescale_MQX_4_2\mqx\examples\rs485

Regards

Daniel

View solution in original post

4 Replies
225 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Vibhu:

Please refer to below thread. I hope it helps

https://community.nxp.com/message/1158581 

Regards

Daniel

0 Kudos
225 Views
vibhu
Contributor III

Hi Daniel,

Thank you for your reply.

I referred the thread that you mentioned. I can use the default interrupt method itself. It is not a requirement for me to write a custom interrupt code. So do you have example for using the default interrupt method or how to use it ?

As mentioned in that thread by m4l490n 

I can use fopen to open the port and fread and fwrite then wont it be polling ? How can I assure it uses interrupt method ? I am a little bit confused.

Can anyone give me a bit clarity on this one please !

Thanks :smileyhappy:

Vibhu.

0 Kudos
225 Views
vibhu
Contributor III

Can Any one please help on the interrupt part ?

0 Kudos
226 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Vibhu:

There are two types of uart drivers in MQX, the interrupt mode and polled mode.

If you need to use interrupt mode, please enable relative uart in user_config.h.  Let's take uart a for example.

....

#define BSPCFG_ENABLE_TTYA       0   //poll mode
#define BSPCFG_ENABLE_ITTYA      1   // interrupt mode.
.....

Then fopen the uart channel. and receive and send data.

There is an example in MQX package,  the rs485 demo demonstrates how to transmit and receive data through rs485 data's channel (ittyd:).

Please refer to the demo for more details.

Freescale_MQX_4_2\mqx\examples\rs485

Regards

Daniel

View solution in original post