View previous topic :: View next topic |
Author |
Message |
mglsoft
Joined: 18 Feb 2008 Posts: 48
|
CAN BUS autobaud ?? |
Posted: Mon Feb 18, 2008 6:00 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
mglsoft
Joined: 18 Feb 2008 Posts: 48
|
|
Posted: Wed Feb 20, 2008 11:28 am |
|
|
Any idea?? ![Laughing](images/smiles/icon_lol.gif) _________________ MGLSOFT |
|
![](templates/subSilver/images/spacer.gif) |
newguy
Joined: 24 Jun 2004 Posts: 1903
|
|
Posted: Wed Feb 20, 2008 11:46 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
mglsoft
Joined: 18 Feb 2008 Posts: 48
|
|
Posted: Wed Feb 20, 2008 12:54 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
newguy
Joined: 24 Jun 2004 Posts: 1903
|
|
Posted: Wed Feb 20, 2008 1:06 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
![](templates/subSilver/images/spacer.gif) |
mglsoft
Joined: 18 Feb 2008 Posts: 48
|
|
Posted: Wed Feb 20, 2008 5:59 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
mglsoft
Joined: 18 Feb 2008 Posts: 48
|
|
Posted: Thu Feb 21, 2008 6:37 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|