I am using MKE02Z64VLD2 and MKL02Z32VFM4 micros on the same board, and they are communicating using UART null modem (Just Tx and Rx are connected).
I am transmitting 6 bytes of data from KL02 to KE02, The below is array of data i am sending for different 18 events which will occur on KL02
{0x00, 0x01, 0x00, 0x01, 0x00, 0x01}, | ||
{0x00, 0x02, 0x00, 0x02, 0x00, 0x02}, | ||
{0x01, 0x00, 0x01, 0x00, 0x01, 0x00}, | ||
{0x02, 0x00, 0x02, 0x00, 0x02, 0x00}, | ||
{0x01, 0x04, 0x01, 0x00, 0x01, 0x00}, | ||
{0x01, 0x04, 0x00, 0x01, 0x00, 0x01}, | ||
{0x01, 0x04, 0x01, 0x02, 0x03, 0x04}, | ||
{0x01, 0x04, 0x01, 0x02, 0x00, 0x00}, | ||
{0x01, 0x04, 0x00, 0x00, 0x02, 0x01}, | ||
{0x01, 0x04, 0x00, 0x00, 0x00, 0x01}, | ||
{0x01, 0x04, 0x02, 0x00, 0x00, 0x00}, | ||
{0x01, 0x04, 0x00, 0x02, 0x00, 0x00}, | ||
{0x01, 0x04, 0x00, 0x00, 0x02, 0x00}, | ||
{0x01, 0x04, 0x00, 0x00, 0x00, 0x02}, | ||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, | ||
{0x00, 0x00, 0x00, 0x00, 0x02, 0x00}, | ||
{0x00, 0x00, 0x00, 0x03, 0x00, 0x00}, | ||
{0x00, 0x04, 0x00, 0x00, 0x00, 0x00} |
The issue I am facing here is , whenever the data contains two or more 0x00 in the packet the KE02 micro does not receive 6 bytes instead it received 5 bytes and even the received 5 bytes are not correct, I might receive 0x00, 0xC0, 0x00, 0x0E, 0x01. Which were not expected.
I am using interrupt service to send and receive bytes on both micros.
Anyone has faced such issue earlier, please help me.
解決済! 解決策の投稿を見る。
Hi Isaac Avila,
We could solve the issue by using external clock instead of internal clock, which was causing some timing issue.
KL02 internal clock was having tolerance/inaccuracy issues.
In HW for KL02 microcontroller we had to remove crystal capacitors and resistors to make external clock functional
Thanks for your help.
Hi umsankar
Could you please provide me your project and tell me used IDE (CW, KDS, etc)?
Regards,
Isaac
Hello Umsankar
I tried to test your code on FRDM-KE02Z and FRDM-KL02Z to communicate each other. I just connected RX and TX (cross connection) on both boards
(PTB1 (UART0_TX) of FRDM-KL02Z to PTC6 (UART1_RX) of FRDM-KE02Z,
PTB2 (UART0_RX) of FRDM-KL02Z to PTC7 (UART1_TX) of FRDM-KE02Z
and connect GND signal, just as shows next image).
And I had no problems on transmitting and receiving the same bytes (As you can see, i added another row of data and it was received correctly).
This makes me think there is a hardware issue in your custom board.
As UART’s clock is taken from internal references, could you please validate voltage level and verify ground potential is the same for both MCUs?
If issue persists, it would be useful to give more information about your hardware.
Best Regards,
Isaac Avila
Hi Isaac Avila,
We could solve the issue by using external clock instead of internal clock, which was causing some timing issue.
KL02 internal clock was having tolerance/inaccuracy issues.
In HW for KL02 microcontroller we had to remove crystal capacitors and resistors to make external clock functional
Thanks for your help.
I am glad you found the root cause for this issue, i was starting to test yesterday but could not advance too much.
It was a pleasure to help you,
Best Regards,
Isaac Avila
Hi Isaac Avila,
Thanks for spending time and providing the feedback on this.
The above experiment you did and code I have provided works communicating from KE02 to KL02, but the actual problem was to communicate from KL02 to KE02.
I repeated the experiment with custom board with KL02 processor and FRDM-KE02Z board and i still face the issue of not communicating properly from KL02 to KE02.
Please find the attached code which will communicate from KL02 to KE02,
Since I don't have KL02 freescale demo board , can you please run the attached firmware on the above setup you have and let me know if you see the correct bytes.
Thanks again for your help.
-Umasankar K