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 autobaud ??

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



Joined: 18 Feb 2008
Posts: 48

View user's profile Send private message

CAN BUS autobaud ??
PostPosted: Mon Feb 18, 2008 6:00 pm     Reply with quote

Hello to all!!
I have interest in making a routine that detects the baudrate in the BUS CAN.
I didn't find a similar topic here in the forum.
If somebody has a help or he/she can explain how to make it, I will thank him eternally.
I try to develop myself a sniffer for the BUS CAN.

From already thanks to who can offer me their help.
_________________
MGLSOFT
mglsoft



Joined: 18 Feb 2008
Posts: 48

View user's profile Send private message

PostPosted: Wed Feb 20, 2008 11:28 am     Reply with quote

Any idea?? Laughing Laughing
_________________
MGLSOFT
newguy



Joined: 24 Jun 2004
Posts: 1900

View user's profile Send private message

PostPosted: Wed Feb 20, 2008 11:46 am     Reply with quote

I'm not sure if this would work. I'm not 100% sure, but I'm not sure that a node, even if not transmitting, might screw up the bus if it's not set to the same baud rate as the bus.

If it doesn't, I'd do things like this:

[initial powerup sets baud to xxxx]
- connect to bus, and set timer timeout in 1 sec (some length of time that is guaranteed to contain messages on the bus)
- if a can bus error occurs in that time, take CAN module offline and set baud to xxxx + 1 (well, not "1", but some sensible increment above xxxx)
- repeat the process until there are no longer any bus errors

If there are a few standard baud rates in use, try them first, then try other non-standard rates.
mglsoft



Joined: 18 Feb 2008
Posts: 48

View user's profile Send private message

PostPosted: Wed Feb 20, 2008 12:54 pm     Reply with quote

Thanks Newguy.
One more question.
Which is more desirable?
Start scanning with a minor and increasing baudrate or vice versa.
Thank you for your time.
_________________
MGLSOFT
newguy



Joined: 24 Jun 2004
Posts: 1900

View user's profile Send private message

PostPosted: Wed Feb 20, 2008 1:06 pm     Reply with quote

No idea what is better. You'll have to start tinkering. I'd look up what the maximum frequency error (%) the CAN bus can tolerate. That should be somewhere in the original Bosch CAN specification which is available from the Bosch website. Whatever that maximum error is will dictate the baud rate increment you'll have to use in your search.

Just be aware that this isn't a trivial problem. Setting the PIC's onboard CAN's baud rate is not really straightforward as there are 3 registers that must be adjusted while keeping critical timings straight.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Feb 20, 2008 1:21 pm     Reply with quote

I never do it with a CAN bus but with LIN which is easiest because it has a know sync frame.

In the following link you will find some usefull guidelines for a CAN autobaud.
http://www.osdir.com/ml/hardware.bus.can/2004-11/msg00029.html


Humberto
mglsoft



Joined: 18 Feb 2008
Posts: 48

View user's profile Send private message

PostPosted: Wed Feb 20, 2008 5:59 pm     Reply with quote

Ok.
Thanks to the two responses.

Searching the Web with the text of POST, I found a document that talks about the characteristics of a CAN transceiver that provides hardware facilities to conduct the search for the correct baudrate.

The explanation in the text of its datasheet, is not applicable 100% to my query, but it gives me two ideas.
1 .- must not be allowed to hardware CAN reply to a mistake during the search of baudrate.
2 .- I must start with the lowest speed increasing and go (makes sense, since every bit found in less time than expected, therefore takes less time to generate the error).

Here they get the link to the data sheet.

http://focus.ti.com/lit/ds/symlink/sn65hvd235.pdf


Thanks Newguy

Muchas gracias Humberto.
_________________
MGLSOFT
mglsoft



Joined: 18 Feb 2008
Posts: 48

View user's profile Send private message

PostPosted: Thu Feb 21, 2008 6:37 am     Reply with quote

Sorry.
Forgot to mention that the data mention this on page 18 of that document.
It happens that tries to copy the text in the forum, but errors occurred, and then forget to mention the page.
_________________
MGLSOFT
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