Hello,
I use flexio to configure a uart mode, and receive datas in interrupt by pin D6.The driver code is from EB tresos. Finally I find a strange thing that I can't get each right character when I use rx interrupt.For example, if I set
Can you attach your configuration also?
Hi,
The configuration in the MCL is here:
I find that if i shield someplace, I will get the completely right data:
But I still don't know the real reason. I guess maybe there is something to do with the shift register and timer's configurations and also with the work timing. Could you please explain it more clear?
Thanks!
Hi @Ashlie
Could you let us know which HW target you're working on, and which SW package version you used (RTD package or MCAL package? )
The configuration file I mentioned is .xdm files in EB Tresos that you configure for Uart and MCL modules
Hi @cuongnguyenphu ,
I use S32K144 mcu, and the EB's version is 26.0.1. There is some information I can get from the sw uart module:
But a embarrassing thing is that I don't know how to insert the .xdm files. There are some screenshots I hope it useful:
mcl:
uart rx:
Uart Tx is almost the same as the uart Rx.
Emmmm, I just remember something else. When I use the tx function, it didn't work until I modified a line of code as the follow:
I‘m looking forward to relpy.
Thanks.
Hi @Ashlie ,
Sorry for lately feedback, I've checked your configuration and still have 2 doubts for your issue:
1. As the first issue you described about the way to use Uart_AsyncReceive( 3, &test_rx_data_u8g, 1);, So I can understand that you were using PC to send Tx messages to S32K1 right? but if you config Async to receive 1 byte of the message, how did you program your application to receive the 2nd and other backward characters?
2. Why you need to modify Flexio_Uart_Ip_ConfigureTx() as it set FLEXIO_SHIFTER_MODE_TRANSMIT by default in our release source code?
Hi @cuongnguyenphu ,
1, I've defined "test_uart_rx_isr" as the rx_call_back func, and the usage is as the picture:
Each byte is processed in the func "test_rev_isr" which means that I would process the rx byte every time it came in by the event "UART_EVENT_RX_FULL",
and then started the next rx at the time of "UART_EVENT_END_TRANSFER".
2. I guess maybe there was some kind of accident or something else when generating configuration code by EB tresos which resulted in that I didn't get FLEXIO_SHIFTER_MODE_TRANSMIT in the Flexio_Uart_Ip_ConfigureTx(). That was set disable. At first time I didn't know what happened and why there was no one byte transmited. After I read almost all the code for flexio uart function in MCL, I considered maybe I should try to modified it, and then I got it. It's really a painful experience...
Hi @Ashlie ,
I created and have a quick test with the same Baudrate and Uart source clock as you configured in your project. There's only 1 thing that I used UART_1 to receive msg from PC to my S32K144 board (I don't have board to setup FlexIO communicate with PC)
And I didn't see messy character with this Baudrate happened. I've also changed nothing in RTD resource file. So could you check my attached project to see the issue still happens from your side?
My example will receive input from PC via Uart_1 and store message until user press Enter button.
Hi @cuongnguyenphu ,
I thought you didn't really understand me. It was because I configured the flexio module instead of any uart module as a channel, I got wrong data. I've used UART0, UART1 and UART2(these 3 modules all work well), so I had to use the flexio to configure the fourth uart function.
Maybe I should fill in some details.
1. The number of rx data I got is always less than the number of tx data from PC. For example, if PC sent 0x0a 0x0b 0x0c 0x0d 0x0e, I might get 0x0a 0x0c 0x0e or might be 0x0a 0x0c 0xNN.
2. If I set the number of dealing with rx data is 2 or more, I would get the right 1st, 2nd data, then missing the 3rd data. It's very regular.
Hi @Ashlie ,
Your behavior with FlexIO is normal, because that FlexIO is using Shifter and Timer to receive data.
If your message is continuously, at the time Shifter and Timer are disabled by Flexio_Uart_Ip_StopTransfer(), 2nd byte comes then FlexIO cannot receive it.
But LpUart is different, as in Lpuart it has Data buffer to hold data incoming. So when Interrupt of 1st byte is in progress, 2nd byte would be store in Data buffer, and Lpuart wouldn't miss it.
My suggestion to use Uart_AsyncReceive for both instance Lpuart and FlexIO is specify BufferSize to be received. Then you will not miss characters like your behavior.