FlexIO uart Rx not getting any character?

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

FlexIO uart Rx not getting any character?

2,399 Views
klau
Contributor II

Hi Dear Reader(s),

I am trying to modify the FlexIO UART Tx demo program to include the Rx function, however I am getting any character.

I would very much like to get some helps with my modifications, please see the attached files.

Thanks,
Kevin

0 Kudos
Reply
9 Replies

2,051 Views
klau
Contributor II

Hi Lei,

Could you please post your code that can be run on the s32K144 evaluation board (see below link)?

https://www.nxp.com/docs/en/quick-reference-guide/S32K144EVB-QSG.pd

I am very busy on other urgent issues, and I can not spend lot of time on this now. But I can look at or test it if you have proved that the codes work on lower baud rate (1900b/s and 9600b/s).

Thanks,

Kevin

0 Kudos
Reply

2,051 Views
liulei1
Contributor II

I modified the code. Now there is no problem in communication between 1900b/s and 9600b/s. The data I received at 115200 is wrong. What is the reason?

0 Kudos
Reply

2,051 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

Please, refer to the link below, there can be found an answer.

https://community.nxp.com/thread/501287

You can follow the community request which you have created. 

It is not necessary to copy your questions into this community request.

Thank you.

Best Regards,

Diana

0 Kudos
Reply

2,051 Views
liulei1
Contributor II

Hello, I modified the code, now send and receive can be successful. When I receive a byte, there is no problem. When I receive a string of data, there will be FLEXIO - > SHIFTERR = 0x02. This is the time when only the first byte is correct and the next byte is wrong. Here is my receiver function.

void FLEXIO_IRQHandler (void)
{

char byte;
if(FLEXIO->SHIFTSTAT==0x03)
{
byte = (FLEXIO->SHIFTBUF[1] >> 24 ) & 0xFF;
}
if(FLEXIO->SHIFTERR==0x02)
{
FLEXIO->SHIFTERR=0x02;
FLEXIO->TIMSTAT=0x02;
}
}

0 Kudos
Reply

2,051 Views
liulei1
Contributor II

Yes, I used your previous code, and then I compared the routines in S32ds, and found that there are some different configurations. I modified the register, but still can not achieve sending and receiving.

I also use this microcontroller, S32K144EVB。

0 Kudos
Reply

2,051 Views
klau
Contributor II

Hi Dear Reader(s),

I am developing my FLEX IO Uart on the s32K144 evaluation board based on a demo program FlexIO, and I am using the below evaluation board,

https://www.nxp.com/docs/en/quick-reference-guide/S32K144EVB-QSG.pdf

And I first turned FlEXIO_D0 to do Tx to verify that I have timer & shifter work correctly.

Then I followed recommendation on 

https://www.nxp.com/docs/en/application-note/AN12174.pdf

to double check my settings.


I still could not get any byte even I saw these bytes appear on Rx line (FLEX_D0).

Could you tell me from my attached zip file FlexIO_Uart_s32k144.zip if I have correctly set up FLEX_D0 to do Rx in

"

/* setup FLEX_D0 to receive */
   FLEXIO_UART_D_receive_init();

"

If I did, do I read from the correct buffer

"byte = (FLEXIO->SHIFTBUF[1] >> 24 ) & 0xFF;"

Both the above mentioned are in the file FlexIO.c.

Thank you very much!!

Kevin

0 Kudos
Reply

2,051 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi Kevin,

I have made a test code for the S32K144 FlexIO UART using your code and code from AN12174. (see attachment)

The main issue in your code was in the wrong clock select for the FlexIO. The SIRCDIV2_CLK was selected, but the SIRC clock was not configurated.

The second thing was in the wrong configuration of PINSEL.

I believe it helps.

Best Regards,

Diana

0 Kudos
Reply

2,051 Views
liulei1
Contributor II

Dear Diana,

I configure the registers according to the configuration method you sent, but I still can't receive the data and can send the data normally.

0 Kudos
Reply

2,051 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

Have you tried to use the test code attached in my previous case "S32K144_FlexIOUart.zip"? There is a possibility that you are using the wrong code (code with mistakes).

Using the test code I can transmit and receive the data, please see the image below. 

I'm using S32K144EVB and the PTD0 should be connected with PTC6 and PTD1 with PTC7 in the case we need to use the terminal.

pastedImage_1.png

Which MCU do you use?

I can see that you have created the new request with your code. I will check it, however, it will be better when you share your whole project.

Best Regards,

Diana

0 Kudos
Reply