Problem in Interfacing TRK-KEA128 MCU in the CAN BUS

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in Interfacing TRK-KEA128 MCU in the CAN BUS

Jump to solution
1,896 Views
ddpd
Contributor III

I am trying to interface TRK KEA 128 MCU to the CAN BUS. I have another different Microcontroller (TI- Hercules) connected to the CAN bus.

May I know what is the electrical specifications of CANH and CANL signals of TRK-KEA 128 Microcontroller. TI-Hercules MCU has 2.5V CANH and CANL signals.

Can I interface directly to the CAN bus or should I make any changes ?? I tried connecting directly to the CAN bus, but no result.

Also I have connected the TRK KEA-128 MCU with USB . Is it enough to power up the CAN Controller?

Currently I am transmitting data continuously to CAN bus from TI Hercules MCU while I have programmed the TRK-KEA128 MCU for receiving, but unfortunately the MCU doesn't read anything.

I have verified the correctness of TI-Hercules MCU by transmitting and recieving from two different CAN nodes of same MCU.

TI Hercules--------------------------------------------------Freescale TRK-KEA128

CANH(Tx)------------------------->------------------------------>(Rx)CANH

CANL(Tx)------------------------->------------------------------>(Rx)CANL

How do I go forward. Please help me with your suggestions..

Thanks in advance.

0 Kudos
1 Solution
685 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Dino David,

      I am Hui_Ma's colleague, now I would like to provide service for your!

     From your description and the code which you are using, your problem is mainly caused by the MC33901 STB pin controlling.

     Just as MC33901 datasheet said: STB is the input pin to control the device mode. When STB is high or floating, the device is in Standby mode. When STB is low, the device is set in Normal mode.

    So,  if you want to make the MC33901 works in normal mode, you need to give a low signal to STB.

    Because our TRK-KEA128 have several vesions, some versions connect the STB to ground in the hardware, but some versions need to control the STB by KEA128 with pin PTG0. You can check your board SCH version which you can find it from the back of your TRK-KEA128 board, eg SCH-28200 REVD(the newest version), it means you need to refer the schematic version D. This version need to control PTG0 as low to make MC33901 works in normal mode.

    I check your code, your code didn't control pin PTG0, that's why you always get 0.5mv in CANH and CANL.

   Please modify your main function like this:

int main(void)

{

Clk_Init();

MSCAN_ModuleEn();

   GPIOB_PDDR |= (1<<16);    /*! MC33901 STB, Mapped from GPIOB16 */

   GPIOB_PCOR = (1<<16);

TEST_CASE_FUNC(Demo_Transmit_DataFrame);//set different parameter to choose other test case to run

return 0;

}

  After the modification, you will find your CANHand CANL voltage is correct, my test result is as follows:

PNG_2015121414304.png

Beside, I also attach another MSCAN project for your reference, this project can directly work ok on your TRK-KEA128.

Follow picture is the test result of Can_test project, the baud is 100Kbps.

54.jpg

Wish it helps you!

If you still have question, please contact me!

Have a great day,
Jingjing

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

View solution in original post

0 Kudos
15 Replies
684 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Please check below schematics about TRK-KEA128 CAN PHY chip PC33901(MC33901):

TRK-KEA128.png

The P(M)C33901 CAN PHY chip operation voltage is 5V, more detailed electrical specification info please check here.

MC33901.png

Wish it helps.


Have a great day,
Ma Hui

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

0 Kudos
684 Views
ddpd
Contributor III

Thanks for your reply Hui_Ma.

Do I need to connect power supply for the CAN transciever to get powered up?

At present the board is powered up using USB cable and the voltage (CANH/CANL) is only 0.5mv. But as per the specifications the voltage during idle state is 2.5V.

Could you please provide those details.

Thanks

0 Kudos
684 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Could you provide the TI- Hercules using CAN PHY chip part number?

The TRK-KEA128 board using MC33901 CAN_H and CAN_L electrical characteristics please check below table:

2015-12-11_9-38-12.png

You mentioned the CAN_H and CAN_L voltage is 2.5V, that is normal CAN bus recessive voltage.

Wish it helps.
Have a great day,
Ma Hui

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

0 Kudos
684 Views
ddpd
Contributor III

Please find the schematics of TI hercules tms570ls3137 board below

pastedImage_1.png

As per the electrical characteristics of TRK-KEA128, the voltage should be 2.5v on CANH and CANL pins in recessive state but when I measure it is only 0.5mv.

And do I need to connect power supply along with USB ??

0 Kudos
684 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

The TRK-KEA128 5V power could get from USB VBUS power, the Jumper J13 need shunt 1-2, more detailed info please check below picture:

2015-12-11_10-34-51.png

Customer can connect USB port J16 provide power to the TRK-KEA128 board.

Wish it helps.
Have a great day,
Ma Hui

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

0 Kudos
684 Views
ddpd
Contributor III

Yes I can measure the voltage across all the TP's as 5V when the board is powered up using USB.

But when I measure the voltage across CANH/CANL with respect to ground it is only 0.5mv.

Could you please measure the voltage across CANH/CANL lines to clarify.

Do I need to do anything in Software.

Please find my code for transmission which is referred from an example as given in your website.

I am getting error while Transmit_CAN_MB  function is called

int main(void)

{

  Led_init();

  uint8 err_status;    //To store the return value of the driver APIs.

  uint8 data[9] = { 8, 0, 0xff, 0, 0xff, 0, 0xff,0, 0xff };  //data to be transmitted

  uint8 buffer_status[2] = {0, 0};

  uint8 CAN_status[3];

  Clk_Init();

  SIM_SCGC |= SIM_SCGC_MSCAN_MASK; //takt CAN module

  MSCAN_ModuleEn();

  EnableInterrupts;

  //err_status = Wakeup_CAN(0);

  //if(!ERR_OK == err_status) {

  //printf("ERROR during wake up %d\n", err_status);

  //}

  //printf("no error after wake up\n");

  err_status = Init_CAN (0,FAST) ; //Initialize msCAN module 0

#if def

  if(!ERR_OK == err_status) {

  printf("ERROR during initialisation %d\n", err_status);

  }

  printf("no error after initialisation\n");

#endif

  while ((CAN_status[0] & SYNCH) == 0)//Wait for msCAN channel 0 synchronized to CAN Bus

  {

  err_status = Check_CAN_Status(0, CAN_status);

  }

#if def

  if(!ERR_OK == err_status) {

  printf("ERROR during synchronisation %d\n", err_status);

  }

  printf("no error after synchronisation\n");

#endif

  for(;;)

  {

  delay_ms(500);

  //Set msCAN module 0 buffer 1 to be TXDF and the corresponding message object is object 0

  if (Config_CAN_MB (0, 1, TXDF, 0)== ERR_OK) //ch=0, num_of_data_buf=1, mode=transivier, id=(0)=0x80

  {

  if(Load_CAN_MB(0, 1, data) == ERR_OK) //Id  0x080,  msCANID.h

  {

  //Transmit message buffer

  err_status = Transmit_CAN_MB (0, 1);      // Send msCAN module 0 buffer 1

  if (err_status != ERR_OK)

  GPIOA_PDOR ^= 1 << 17; //if error led2 on

  }

  }

0 Kudos
684 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I do a test with TRK-KEA128 board with MSCAN driver for Kinetis EA devices software.

I measure the CAN_H voltage is 2.464V and CAN_L voltage is also 2.464V (CAN bus recessive voltage).

2015-12-11_16-34-34.png

Wish it helps.
Have a great day,
Ma Hui

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

0 Kudos
684 Views
ddpd
Contributor III

I did the same thing but I am getting only 0.5mv. I even tried with another TRK-KEA128 MCU. The result is same.

Before loading with CAN driver and after loading with CAN driver, the voltage seems to be same (0.5mv)

I even used the same code as given by you

Please help me.

0 Kudos
684 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I measure the voltage at J15 jumper without connect to CAN bus. If you measure the voltage with the same situation?

If so, I think you need to contact with your local NXP distributor to return and warranty the boards:

Returns and Warranty Information|NXP

The distributor network could be found below:

Distributor Network|NXP

Wish it helps.
Have a great day,
Ma Hui

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

0 Kudos
684 Views
ddpd
Contributor III

Yes I am measuring the voltage without connecting to CAN bus. I have 3 different boards. The result is same for all the boards.

Is it really the problem of boards?

Or should I connect it to CAN bus?

0 Kudos
685 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Three boards with the same issue seems not a hardware issue.

For I will be out of office next week, I will let my colleague continue to support this issue.

Thank you for the understanding.

Wish it helps.
Have a great day,
Ma Hui

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

0 Kudos
685 Views
ddpd
Contributor III

Yes. I guess it shouldn't be a hardware problem. I kindly request you to redirect the issue to your colleagues since you are not available.

Thanks for your reply and updates.

Once again I will mention the steps which I followed.

1. With the new development board, when powered up using USB,  4 LED's were blinking by default. I measured the voltage at J15 CANH(pin 1)/CANL(pin 2). It showed 0.5mv.

2. I guess CAN module is in sleep mode. That might be the reason for showing only 0.5mv.

3. So I flashed the code as given before(I have attached the code) for testing the CAN controller. The voltage measured is 0.5mv itself (no change from the previous reading). The voltage measurement is without connecting to CAN bus.

Observation: The CAN transciever chip MC33901 pin 8 (STB) is high which means the CAN transciever is in Stand by mode.. How do I switch to Normal Mode??

Please correct me if I this is not the correct way.

Thanks in advance

0 Kudos
685 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi David,

I guess you are using Rev D TRK-KEA128 while Hui was working on REV B, there is some difference between these two version, REV D uses PTG0 pin to control the STB of MC33901, while REV B ties it directly to GND, so you have to set PTG0 as GPIO output function and set it to low, so that it makes MC33901 in normal mode.

pastedImage_0.png


Have a great day,
Kan

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

0 Kudos
685 Views
ddpd
Contributor III

Thanks Kan, Jingjing. Finally it worked.

0 Kudos
686 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Dino David,

      I am Hui_Ma's colleague, now I would like to provide service for your!

     From your description and the code which you are using, your problem is mainly caused by the MC33901 STB pin controlling.

     Just as MC33901 datasheet said: STB is the input pin to control the device mode. When STB is high or floating, the device is in Standby mode. When STB is low, the device is set in Normal mode.

    So,  if you want to make the MC33901 works in normal mode, you need to give a low signal to STB.

    Because our TRK-KEA128 have several vesions, some versions connect the STB to ground in the hardware, but some versions need to control the STB by KEA128 with pin PTG0. You can check your board SCH version which you can find it from the back of your TRK-KEA128 board, eg SCH-28200 REVD(the newest version), it means you need to refer the schematic version D. This version need to control PTG0 as low to make MC33901 works in normal mode.

    I check your code, your code didn't control pin PTG0, that's why you always get 0.5mv in CANH and CANL.

   Please modify your main function like this:

int main(void)

{

Clk_Init();

MSCAN_ModuleEn();

   GPIOB_PDDR |= (1<<16);    /*! MC33901 STB, Mapped from GPIOB16 */

   GPIOB_PCOR = (1<<16);

TEST_CASE_FUNC(Demo_Transmit_DataFrame);//set different parameter to choose other test case to run

return 0;

}

  After the modification, you will find your CANHand CANL voltage is correct, my test result is as follows:

PNG_2015121414304.png

Beside, I also attach another MSCAN project for your reference, this project can directly work ok on your TRK-KEA128.

Follow picture is the test result of Can_test project, the baud is 100Kbps.

54.jpg

Wish it helps you!

If you still have question, please contact me!

Have a great day,
Jingjing

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

0 Kudos