0
\$\begingroup\$

i began reading about Can Bus for my final year project

i have to send a file to be flashed into the microcontroller using the CAN BUS . I have found that the maximum bitRate that can be achieved is 1Mb/s but there is a lot of things to consider like the ack. time and the spacing between frames.

So , how can i know the maximum bitRate supported in the CAN BUS . It is possible to get 1mb/s as the maximum bitRate , how this can be accomplished.

The micro-controller i'm using is MPC 5748 Datasheet here

Any help will be appreciated, thanks.

\$\endgroup\$
4
\$\begingroup\$

You already wrote that the maximum data rate is 1Mbit/s, but this is the raw rate.

A CAN message (data frame) looks like this on the scope:

enter image description here
(Source)

and consists of this sections with their length in bits:

Start-of-frame                            1
Identifier (green)                       11
Remote transmission request (RTR) (blue)  1
Identifier extension bit (IDE)            1
Reserved bit (r0)                         1
Data length code (DLC) (yellow)           4
Data field (red)                       0–64
CRC                                      15
CRC delimiter                             1
ACK slot                                  1
ACK delimiter                             1
End-of-frame (EOF)                        7  
Inter-frame bits                          3

(Source)

i.e. there are 46 "management" bits for up to 64 data bits. This reduces your net data rate to about 580kBit/s.

The sender sends a recessive 0 in the ACK slot, and the receiver will pull it to a dominant 1 when the message was received correctly. This means the acknowledge mechanism already is part of this data frame, and doesn't cost additional bandwidth.

The Inter-frame bits are the minimum distance between two frames, so the next frame can follow directly. However, if there is more traffic on the bus, the data rate can be drastically reduced. Keep in mind: Whoever has to send a message checks if someone else is talking and if not, starts to talk. If two devices start to talk at the same time, they will notice this, abort, wait a little and try again. (It's really like several people talking to each other. Some tend to say just a few words, pause for a second, and speak again. You sometimes can't jump in to say what you want...)

Finally, all devices must be set to 1MBit/s, and the maximum length of the cable is limited to 40m.

Apart from this, you need to find out what data rate your MCU can handle. It's possible that the CAN module of the MCU can handle a bus speed of 1MBit/s, but that the MCU can not copy the data from the module before the next module arrives. In this cases, you need to implement pauses between the frames.

\$\endgroup\$
  • \$\begingroup\$ How have you determinated that the limit is 580kBit/s \$\endgroup\$ – The Beast Feb 4 '16 at 16:35
  • \$\begingroup\$ 64 bits data + 46 bits management = 110 bits per frame. 1Mbit/110 = 9091 frames/second. Times 64 "usable data bits" is 581.82kBit/s. This a purely theoretical maximum. \$\endgroup\$ – Hans Feb 4 '16 at 16:46
  • \$\begingroup\$ @sweber thanks , so if the identifier is 29 bits (the MPC 5748 is used in the automotive industry si it will be a huge number of nodes i think) so i'll be limitted to just : 540 lbits/s \$\endgroup\$ – The Beast Feb 11 '16 at 1:07
  • \$\begingroup\$ @Hans i have count 47 not 46 :p and Mb = 1024*1024 OR 10^6 ? \$\endgroup\$ – The Beast Feb 11 '16 at 1:08
  • \$\begingroup\$ OK, I've overlooked one bit. And it's often not clear if 1024 or 1000 is used as base. However, this doesn't make a big difference. \$\endgroup\$ – sweber Feb 11 '16 at 9:58
4
\$\begingroup\$
I have found that the maximum bitRate that can be achieved is 1mb/s

Actually it's 1 Mbit/s. That's "mega", not "milli".

how can i know the maximum bitRate supported in the CAN BUS

By reading your own words just two sentences earlier, assuming your milli versus mega error was just a typo.

In a private CAN system where you control all the nodes and the bus cabling and the length and the electrical bus interface circuits, you can go faster. Since CAN is specified for 1 Mbit/s and most implementations break a bit time into 9-20 "time quanta", most CAN peripherals can't go much faster. Still, look at the CAN peripheral bit rate generator carefully in your micro. With a fast clock, you can probably run it faster than 1 Mbit/s.

\$\endgroup\$
  • \$\begingroup\$ yes it's just a typo :p i'm using the MCU MPC5748 of NXP, i didn't found where is the bit rate generator in datasheet \$\endgroup\$ – The Beast Feb 4 '16 at 16:33
  • \$\begingroup\$ Hello Mr @Lathrop can you please take a look at my topic here: electronics.stackexchange.com/questions/274250/… \$\endgroup\$ – The Beast Dec 11 '16 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.