CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

CAN bus error with dsPic30f4011

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hoangkhuong



Joined: 16 Mar 2012
Posts: 31

View user's profile Send private message

CAN bus error with dsPic30f4011
PostPosted: Mon May 07, 2012 2:40 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue May 15, 2012 1:06 am     Reply with quote

Can somebody help me, please ?
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Tue May 15, 2012 1:28 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue May 15, 2012 1:39 am     Reply with quote

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)
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group