Issue UART_RETRY_TIMES

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

Issue UART_RETRY_TIMES

1,349 Views
Transidico
Contributor III

Good evening,

I am using LPUART1 in LPUART_WriteBlocking and LPUART_ReadBlocking mode. I need it to exit the wait mode if my UART does not receive anything within a certain number of seconds. I have noticed that there is a parameter called UART_RETRY_TIMES that can be used to set a timeout. However, when I set this parameter, I notice that a timeout is not set, but the UART no longer works correctly. Could you tell me how I can exit blocking mode with a timeout?

Thank you.

Best regards

 

0 Kudos
Reply
3 Replies

1,294 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @Transidico 

May I ask which chip you are using?

BR

Harry

0 Kudos
Reply

1,282 Views
Transidico
Contributor III

Hi Harry,

thanks for reply. The chip that i use is MCXC242.

Do you have some suggestions?

Thanks in advice.

 

Best regards

0 Kudos
Reply

1,267 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @Transidico 

LPUART_ReadBlocking() and WriteBlocking() of MCXC242 do not support timeout exit.
UART_RETRY_TIMES is only used internally for the 'retry check flag' and is not a timeout mechanism.
If you want UART to exit blocking after a few seconds of no data, I think you can use LPUART_ReadBlocking combined with a software timer.

BR

Harry

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2238219%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EIssue%20UART_RETRY_TIMES%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2238219%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EGood%20evening%2C%3C%2FP%3E%3CP%3EI%20am%20using%20LPUART1%20in%20LPUART_WriteBlocking%20and%20LPUART_ReadBlocking%20mode.%20I%20need%20it%20to%20exit%20the%20wait%20mode%20if%20my%20UART%20does%20not%20receive%20anything%20within%20a%20certain%20number%20of%20seconds.%20I%20have%20noticed%20that%20there%20is%20a%20parameter%20called%20UART_RETRY_TIMES%20that%20can%20be%20used%20to%20set%20a%20timeout.%20However%2C%20when%20I%20set%20this%20parameter%2C%20I%20notice%20that%20a%20timeout%20is%20not%20set%2C%20but%20the%20UART%20no%20longer%20works%20correctly.%20Could%20you%20tell%20me%20how%20I%20can%20exit%20blocking%20mode%20with%20a%20timeout%3F%3C%2FP%3E%3CP%3EThank%20you.%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2246663%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Issue%20UART_RETRY_TIMES%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2246663%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F240937%22%20target%3D%22_blank%22%3E%40Transidico%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMay%20I%20ask%20which%20chip%20you%20are%20using%3F%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EHarry%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2248300%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Issue%20UART_RETRY_TIMES%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2248300%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F240937%22%20target%3D%22_blank%22%3E%40Transidico%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELPUART_ReadBlocking()%20and%20WriteBlocking()%20of%20MCXC242%20do%20not%20support%20timeout%20exit.%3CBR%20%2F%3EUART_RETRY_TIMES%20is%20only%20used%20internally%20for%20the%20'retry%20check%20flag'%20and%20is%20not%20a%20timeout%20mechanism.%3CBR%20%2F%3EIf%20you%20want%20UART%20to%20exit%20blocking%20after%20a%20few%20seconds%20of%20no%20data%2C%20I%20think%20you%20can%20use%20LPUART_ReadBlocking%20combined%20with%20a%20software%20timer.%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EHarry%3C%2FP%3E%3C%2FLINGO-BODY%3E