LPUART_IRQHandler is not getting working for the first one byte.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPUART_IRQHandler is not getting working for the first one byte.

跳至解决方案
1,540 次查看
angaraltangerel
Contributor II

I'm a beginner in MCUXPresso and FRDM or kinetis microcontrollers. 

I'm trying to use a LPUART RX interrupt handler. But If I send a single character it doesn't work.

for example If I send 

'A' the interrupt handler doesn't work.

next

'B' interrupt handler works but LPUART_ReadByte returns 'A' (last byte).

I think it's FIFO related problem but I'm still not sure how to fix it.

OR

RxData Register doesn't get full. (I tried changing uart data bit size and stop bits but still doesn't work).

Experts please help me.

Thank you in advance.

Here is my LPUART init code.

pastedImage_1.png

0 项奖励
1 解答
1,335 次查看
angaraltangerel
Contributor II

Hello Edgar Eduardo.

I'm using MKE15Z256VLL7 (FRDM - KE02Z board).

I'm using getDefaultConfig

(which has

config.txFifoWatermark = 0;
config.rxFifoWatermark = 0; ) I've also tried adding these lines but still interrupt gets triggered at the second byte. 

:smileysad:

Regards.

在原帖中查看解决方案

0 项奖励
4 回复数
1,336 次查看
angaraltangerel
Contributor II

Hello Edgar Eduardo.

I'm using MKE15Z256VLL7 (FRDM - KE02Z board).

I'm using getDefaultConfig

(which has

config.txFifoWatermark = 0;
config.rxFifoWatermark = 0; ) I've also tried adding these lines but still interrupt gets triggered at the second byte. 

:smileysad:

Regards.

0 项奖励
1,335 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Angar,

Are you using MKE15Z device in a FRDM-KE02 board? I wouldn't recommend this, as KE15 and KE02 are not fully compatible devices.

Now, assuming that you are using SDK for KE15Z and that you already checked the lpuart_interrupt example, then, the way you received data will depend in your interrupt handler and in your while loop, for instance, the example implements a loopback, I would recommend you to check this example and verify if your interrupt is correctly triggered.

Best regards

0 项奖励
1,335 次查看
angaraltangerel
Contributor II

Hi Jorge. 

I'm sorry what i meant was FRDM - KE15Z. yeah I checked the example. But still the interrupt gets triggerred only after it receives the 2nd byte. ..

0 项奖励
1,335 次查看
EdgarLomeli
NXP Employee
NXP Employee

Hello Angar.


Try adding that instructions before calling LPUART_Init

config.txFifoWatermark = 0;
config.rxFifoWatermark = 0;

Watermark levels determinate how many bytes receive and transmit before executing IRQ handler.

Which MCU are you using?

Some Kinetis MCU's don't have FIFO functionality and the last corrections aren't going to fix your issue.      

Let me know your results.

Regards.

0 项奖励