Using fsl_uart problem

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

Using fsl_uart problem

Jump to solution
1,780 Views
shauldorf
Contributor V

Doing my initial steps in KDS and Kinetis I faced a problem using “UART to console transaction” via OpenSDA USB link.

 

My project is implemented on FRDM-K64F using: KDS3.0, KSDK1.2+PE and UART based on fsl_uart component.

 

The program logic is based on a working “UART non-blocking driver” demo.

 

When I send predefined char string using “ UART_DRV_SendData(FSL_UARTCOM1, buffStart, byteCountBuff) ” method.

 

The result is that the first character of buffStart string is sent to console in endless loop.

I have same phenomena implementing  “DWF - Kinetis
Design Studio (KDS) using Processor Expert" - Lab4  ( https://community.freescale.com/docs/DOC-101650
).

 

Shaul

Labels (1)
1 Solution
882 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Shaul,

Actually fsl_uart and fsl_lpuart have very similar APIs in KSDK , but as lpuart supports working under low power modes such as stop mode and wait mode, so it has additional APIs for such feature.

The Kinetis SDK v.1.2.0 API Reference Manual.pdf has stated clearly about the callback ,

pastedImage_0.png

so the simplest way to implement the callback is moving the part that is skipped by the callback function in the UART ISR, besides you may also add your custom code in it.

Hope that helps,


Have a great day,
Kan

Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

6 Replies
882 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Shaul,

Would you please send your project for a review? I may use it to reproduce the issue on my FRDM-K64F. Thanks for your patience!


Have a great day,
Kan

Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
882 Views
shauldorf
Contributor V

Hi;

Please see in attached.

Thanks

Shaul

0 Kudos
882 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Shaul,

I just reviewed your project, and found this issue is due to the RxCallback and TxCallback are enabled but left as undefined, disable them both can fix this issue.

pastedImage_0.png

pastedImage_1.png

Please kindly refer to Configuring MKL25 LPSCI with fsl_lpsci Processor Expert bean  for more details regarding RxCallback and TxCallback.

Hope that helps,


Have a great day,
Kan

Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
882 Views
shauldorf
Contributor V

Hello Kan;

Based on yours recommendations I added to the Rx & Tx CallBack functions the necessary instructions.

I is working fine.

But the problem is that I have done it like a parrot without knowing what it does.

I have seen in component list number of uart method some maybe are not applicable for my processor.

Is there any comparison between the different methods?

Some are good for printf and scanf but I have seen that they are not recommended (code size).

Yours solution solve the problem.

Thanks again

Shaul

0 Kudos
882 Views
shauldorf
Contributor V

Hello Kan;

Thanks for your fast and helpful response

Yes without Tx & Rx CallBack it is working, but:

What is a difference between fsl_uart and fsl_lpsci ?

In my project (FRDM-K64F with MK64FN!M0VLL12) I have seen that the lpsci is not applicable.

As a reference I used two Freescale lab presentations:

<https://community.freescale.com/thread/353666> https://community.freescale.com/thread/353666

<https://community.freescale.com/docs/DOC-101650> https://community.freescale.com/docs/DOC-101650

In neither of them there is nothing mentioned to deselect Rx and Tx callback.

Because of this I have made additional experiment.

I build the same UART project again (also with Rx & Tx CallBacks) but “main.c” has been replaced with my “main.c” code that was based on “non_blocking driver example”.

This main.c doesn’t have PE_low_level_init(); and RTOS startup code (all PE restricted areas).

This program works with selected and undefined CallBacks.

This was the reason that I conclude that I Tx and Rx is needed.

Now I’m sure that I made something wrong, but I’m not familiar with those callback, can you please recommend any application or paper how to work with those callbacks?

Thanks again

Shaul

0 Kudos
883 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Shaul,

Actually fsl_uart and fsl_lpuart have very similar APIs in KSDK , but as lpuart supports working under low power modes such as stop mode and wait mode, so it has additional APIs for such feature.

The Kinetis SDK v.1.2.0 API Reference Manual.pdf has stated clearly about the callback ,

pastedImage_0.png

so the simplest way to implement the callback is moving the part that is skipped by the callback function in the UART ISR, besides you may also add your custom code in it.

Hope that helps,


Have a great day,
Kan

Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------