I was downloading some examples from this community.
And I did some modifications to fit the board I had.
But my question is at what point an interrupt occurs and sends data.
In the case of GPIO, I understand that it occurs via input, And Time interrupts occur according to the divided clock.
But I don't know the exact point of occurrence of UART interrupt.
I used an LCD with 4800 baud rate.
I didn't know the exact point even when I used step_into (F5) menu of debug menu.
I am attaching my code and operation picture below.
已解决! 转到解答。
Hi,
there are several interrupt sources in LPUART. It is summarized in chapter 53.4.7 Interrupts and status flags of the RM. Also refer to STST and CTRL registers.
In your code you have just RIE bit set, so interrupt will be called after RDRF bit is set, indicating you have received data. You can put reading STAT register in beginning of you interrupt routine to know the interrupt source.
Seems you does not have RX pin configured, it may case module detect RX pin low, making character detection (RDFD set), thus you enter interrupt (unintentionally) and leave it after all is send as you are using polling for transmission.
So set RX pin, probably PC6 pin. You have PC9 and PC7, which both has just TX functionality.
BR, Petr
Hi,
there are several interrupt sources in LPUART. It is summarized in chapter 53.4.7 Interrupts and status flags of the RM. Also refer to STST and CTRL registers.
In your code you have just RIE bit set, so interrupt will be called after RDRF bit is set, indicating you have received data. You can put reading STAT register in beginning of you interrupt routine to know the interrupt source.
Seems you does not have RX pin configured, it may case module detect RX pin low, making character detection (RDFD set), thus you enter interrupt (unintentionally) and leave it after all is send as you are using polling for transmission.
So set RX pin, probably PC6 pin. You have PC9 and PC7, which both has just TX functionality.
BR, Petr
I checked the part where I set the wrong port.
However, I didn't have to provide TX because the LCD of the board I use only provides RX ports.
Well, if I may apply your words, Is it correct that the RX pin of s32k144 is detected unconditionally because the TX of LCD does not exist?
Hi,
if the LCD does not send anything, so RX pin on MCU is not used then keep it pulled high and do not use RX interrupt to send data to LCD. Either use polling or enable TX interrupt when transfer is desired.
BR, Petr