How Can I do Can-Bus Communication with Processor Expert

cancel
Showing results for 
Search instead for 
Did you mean: 

How Can I do Can-Bus Communication with Processor Expert

913 Views
ugurozkan52
Contributor II

158475_158475.pngasd.png

Hi Friends, I have two piece Trk-kea128 boards. I am using Code Warrior and Processor Expert .

I want to Can-Bus communication between two boards.

When I pressed button TRK-1 will send message and When TRK-2 received true message The led will turn on.

 

Regards,

Uğur

Labels (1)
0 Kudos
7 Replies

376 Views
secpro2hyd
Contributor I

Hi,

I am also working on similar task with freedom ke06z boards. 

 I have two MKE06Z boards with me. One is Evaluation board and one is custom board.

I have connected the CAN_H and CAN_L pins of the evaluation board to CAN_H and CAN_L of the custom board.

I am planning to make an LED to blink on custom board when I press a button on evaluation board.

 

On evaluation board I have created a project on KDS. In this project I have added CAN_LDD component. In the typical usage I see a program Sending data frame with interrupt service. I have just copied that code.

Similarly on the custom board side I have created another project and in that project also I have added CAN_LDD component and here I copied the code Receiving data frame with interrupt service.

 

I flash the both codes to their respective boards. I never see LED blinking on my custom board when I press a button on evaluation board. The interrupts never occured in both projects.

Am I doing it on right way?. 

Pls someone suggest the correct way?. I am not able to find where Im doing mistake. 

0 Kudos

376 Views
ugurozkan52
Contributor II

Hi Alice,

I didn't add Gpio_LDD because I am writing code of loopback but It isn't working.

Can_Tx <======> Can_Rx short circuit

I am using Can_LDD and Bit_IO and Console_IO.

My code is here.

can loop back.PNG

can events c.PNG

can companent.PNG

I am sorry for I couldn't answer early.

Have a great day,

Uğur

0 Kudos

376 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ugur,

I have checked your project and test on my side .

Please change these place :

1) Please enable the CAN interrupt, or you can not use the interrupt function , so the flag of

"DataFrameTxFlg" can not set to "TRUE" :

pastedImage_0.png

2) The array of " InputData[]" is start from "0", not "1" , so please configure the code to "

pastedImage_1.png

Then re-build the project ,the LED can light , i have test it on my board .

Hope it helps


Have a great day,
Alice

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

0 Kudos

376 Views
ugurozkan52
Contributor II

Hi Alice,

I wrote this code but I couldn't add button code. how can i add button code?

can trans.PNG

Regards,

Have a great day,

Ugur

0 Kudos

376 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ugur,

You can  add one "GPIO_LDD" component , then configure the gpio to your button pin.

Hope it helps


Have a great day,
Alice

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

0 Kudos

376 Views
ugurozkan52
Contributor II

Hi Alice,

I didn't add Gpio_LDD because I am writing code of loopback but It isn't working.

Can_Tx <======> Can_Rx short circuit

I am using Can_LDD and Bit_IO and Console_IO.

My code is here.

can loop back.PNG

I am sorry for I couldn't answer early.

Have a great day,

Uğur

0 Kudos

376 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ugur,

You can configure the GPIO interrupt to send message ;

in the CAN receive interrupt to set on the LED.

About the CAN send and receive configuration, please refer to the

"Typical Usage" :

pastedImage_0.png

Hope it helps


Have a great day,
Alice

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

0 Kudos