CAN communication

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

CAN communication

999 Views
443115228
Contributor II

Hi,

      I'm using AN4975 software to excise CAN communication on MTRCKTSPNZVM128 board.

捕获.PNG

      the main function is as follows:

void main(void) {
 int id;
 unsigned char data[8];
  
 PLL_init();
 CAN_init();
 CAN_set_rx_callback(&processCANMessage);
  
 EnableInterrupts;
  
 //send a test message
 id = 0x5A;
 data[0] = 0xBB;
 data[1] = 0xDD;
 CAN_send(id, &data[0], 2);
  
 for(;;) {
  
  __RESET_WATCHDOG();
 }
}

捕获2.PNG

I have connected the  J3  jumper ,debug the example code and run it,but  I can't see anything on my oscilloscope.

please give me some advice ~~

Tags (2)
0 Kudos
Reply
3 Replies

850 Views
lama
NXP TechSupport
NXP TechSupport

Could you please test attached file? I used it on the board together with PCAN-USB Pro and I was able to receive messages.

Best regards,

Ladislav

0 Kudos
Reply

850 Views
443115228
Contributor II

Hi lama:

     Thanks for your response.

     I just tested your code ,but I still can't see the waveform.

     I detected the voltage of CANH and CANL ,both of them are 2.5V. 

0 Kudos
Reply

850 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

how do you measure the CANH and CANL?

Have you checked  CANTx?

If you have nothing connected to the CAN connector then CAN should be in error passive mode because sending does not receive acknowledge so it tries to send message in a cycle.

If you measure this by multimeter then you will measure average value. You should use oscilloscope to see what is at the pins. At the beginning what you can see at CAN Tx.

I would suggest following procedure I usually use in the case of such issues.

1) Set CAN into loopback mode to be sure your routines are correct. (Receive what you have sent)

2) Switch off loopback mode, disable Rx routine and check whether you have correct signal at the CANTx pin of the MCU. Check bit rate, correct values, frame,...

3) Connect transceiver or measure behavior at transceiver output whether it mirror behavior at CANTx pin.

Best regards,

Ladislav

0 Kudos
Reply