View previous topic :: View next topic |
Author |
Message |
hoangkhuong
Joined: 16 Mar 2012 Posts: 31
|
CAN bus error with dsPic30f4011 |
Posted: Mon May 07, 2012 2:40 am |
|
|
Hello everyone,
My previous post didn't ask the right question, therefore it has not been replied. Sorry for posting in a clumsy way.
I am trying to make a CAN communication between dsPic30f4011 and CANalyzer (So far, I can do CAN communication between 2 dsPics) and the problem I am facing is:
1/ I put a counter in the code to indicate the number of transmission it makes and the counter shows 3 times of transmission from the dsPic, I vaguely remember reading somewhere that CAN controller on dspic will only transfer 3 times if it does not recognize suitable signal on CAN bus. Please correct me if I am wrong.
2/ The CAN_Tx and CAN_Rx pins are always high when connected to CANalyzer. If I do CAN communication with another dsPic, they will only be high when transmit or receive messages, so I don't know what could be the problem here.
I guess the problem could be in baud rate and bit timing setting, but I already tried various values but nothing seems to work. I hope someone could help me figure out where to fix this problem.Thanks very much. |
|
|
hoangkhuong
Joined: 16 Mar 2012 Posts: 31
|
|
Posted: Tue May 15, 2012 1:06 am |
|
|
Can somebody help me, please ? |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Tue May 15, 2012 1:28 am |
|
|
In the default configuration the CAN module in PICs can buffer up three messages for sending. The ECAN module can be configured to have more transmit buffers.
If there are no other CAN nodes to receive the transmitting module will resend over and over.
You cannot connect CAN_Tx and CAN_Rx directly to a CANalyzer. You must use an interface IC such as the MCP2551 and termination resistor to convert to the correct CAN voltage levels and to implement the half-duplexing.
RF Developer |
|
|
hoangkhuong
Joined: 16 Mar 2012 Posts: 31
|
|
Posted: Tue May 15, 2012 1:39 am |
|
|
Thanks for your reply. I did not connect directly but use a transceiver mcp2551. I did communicate successfully between two dsPic. Now what I do is changing one dsPic with CANalyzer so basically, my circuit would be like this:
dsPic - mcp2551 - CAN_H+CAN_L - CANcaseXL (hardware) - CANalyzer (software on PC) |
|
|
|