Saturday, 17 November 2018

microcontroller - What is the maximum bitrate supported in the Can Bus?


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.




Answer



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.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...