I wrote simple test program using on “Term” component.
do {
Term1_SendStr("Press any key\r\n");
Term1_KeyPressed();
Term1_ReadChar(&ch);
Term1_SendStr("\nYou pressed:\r\n");
Term1_SendChar(ch);
Term1_SendStr("\n**************\r\n");
} while(1);
This component is not supported by KSDK1.2 (on FRDM-K64F) so I select "Processor Expert" option.
Using:
SendStr() is working but ReadChar() is not working
making necessary modifications (CP{U type to 100 pin package and PinSetting Switch Configuration) ,
The test is working perfect
Is there any explanation for this behavior?
Shaul
Solved! Go to Solution.
Hello Mark
Your work around (solution) is working well.
Based on my little experience it might be helpful to add to
fsl library “Term” component.
Thanks’ for your effort.
Shaul :smileyhappy:
Hi,
can you please send both of your two projects so that i can test it directly on my side?
thanks!
Have a great day,
Zhang Jun
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello,
The problem is caused by routing of the RxD pin of the AsynchroSerial component (inherited by the Term component), see the following screenshot:
When you select the PTB16 pin in the RxD item (and also generate project and build the application again), the application will work properly.
Best Regards,
Marek Neuzil
Hello Marek
Attached my not working screenshot
Sorry it doesn’t help
Shaul
Hello,
I am sorry but the application does work properly on my target board. I have also checked the generate code and it is the same. It seems that the issue is caused by your target board. The UART device is sensitive for precise clock source. I have noticed that you are using FEI mode of the MCG (internal oscillator of the MCU). Try to use an external crystal that is available on the FRDM-K64F target board. For example you can use the 50MHz external clock that is provided for RMII (external crystal is used that is stable and precise). You can set the PBE mode of the MCG and directly use this clock source for core and bus clock. See for example the attached application.
Please note, that your target board can be also damaged. If you have another FRDM-K64F target board try to use this other board to verify the functionality of the UART device and OpenSDA (OpenSDA provides virtual serial COM port on your host computer).
Best Regards,
Marek Neuzil
Hello Marek
There is no problem using your or my programs. You build your program using processor option.
I found the problem when I used Board option (see in attached fig).
I'm attaching zip project with your main.c. The "Term1_ReadChar(&ch)" read is not working.
Thanks
Shaul
Hello Shaul,
I am sorry I don't understand you. I have used the same application that does not work on your host computer with FRDM-K64F target board. But the same application works on my host computer and target board properly.
Do you use OpenSDA debug connection? Do you use Segger j-link or PEMicro OpenSDA debug connection (firmware)?
What version of FRDM-K64F target board are you using?
Best Regard,
Marek Neuzil
Hello Shaul,
Thank you for the project. I have been able to reproduce the problem. The issue is caused by the AsynchroSerial component (inherited in the Term component) when two or more clock configurations are defined in the project (in the CPU component).
In this case the initialization code does not contain calling of the ReceiveBlock for the read buffer, i.e. there is not any buffer for receiving data and all characters are dropped in the inherited Serial_LDD component driver.
If you freeze the code of the Inhr1:AsynchroSerial component and add the following code (marked by bold) in the HWEnDi() function in the Inhr1.c program module the receiving of data will works.
static void HWEnDi(void)
{
if (EnMode) { /* Enable device? */
(void)ASerialLdd1_Enable(ASerialLdd1_DeviceDataPtr); /* Enable device */
(void)ASerialLdd1_ReceiveBlock(ASerialLdd1_DeviceDataPtr, &BufferRead, 1U); /* Receive one data byte */
} else {
(void)ASerialLdd1_Disable(ASerialLdd1_DeviceDataPtr); /* Disable device */
}
}
I will report this issue to the Processor Expert development team.
Best Regards,
Marek Neuzil
Marek Thanks’
I’m traveling with imitated internet access, on my back I will check yours work around.
Shaul
Hello Mark
Your work around (solution) is working well.
Based on my little experience it might be helpful to add to
fsl library “Term” component.
Thanks’ for your effort.
Shaul :smileyhappy:
Hello Shaul,
In my personal view, i recommend you use the ""Processor", for i fund the "Board" is not perfect about all of the function .
Hope it helps
Alice