KE02 and KL02 micro to micro UART communication issues

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

KE02 and KL02 micro to micro UART communication issues

Jump to solution
1,210 Views
umsankarkalluru
Contributor III

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.

Labels (1)
0 Kudos
1 Solution
853 Views
umsankarkalluru
Contributor III

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.

View solution in original post

6 Replies
853 Views
isaacavila
NXP Employee
NXP Employee

Hi umsankar

Could you please provide me your project and tell me used IDE (CW, KDS, etc)?

Regards,

Isaac

0 Kudos
853 Views
umsankarkalluru
Contributor III

Hi Isaac,

Please find the attached workspace for two micro controllers.

I am using KDS 2.0 as workspace and I am using clock source as low power internal clock.

0 Kudos
853 Views
isaacavila
NXP Employee
NXP Employee

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).

Board Connection.jpg

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).

Uart_Data[].jpgThis 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

0 Kudos
854 Views
umsankarkalluru
Contributor III

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.

853 Views
isaacavila
NXP Employee
NXP Employee

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

0 Kudos
853 Views
umsankarkalluru
Contributor III

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

0 Kudos