Maxim Integrated High-Speed Microcontroller Users Guide: Network Microcontroller Supplement User Manual

Page 160

Advertising
background image

High-Speed Microcontroller User’s

Guide: Network Microcontroller

Supplement

160

The theory behind the CAN autobaud feature is relatively simple. If a CAN module operating at a particular baud rate listens in on a

CAN bus operating at a different baud rate, it sees a random bit stream. Because the bit stream does not conform to the CAN 2.0B

protocol, a large number of bus errors (bit 0 error, bit 1 error, bit stuff error, etc.) are seen by the “listening” CAN. These errors incre-

ment the CAN error counter register. With only a moderate amount of CAN traffic, enough errors quickly accumulate to set the CAN

error count exceeded (EC96/128) bit in the CAN 0 status register (C0S; A4h). This can be used as an indicator that the DS80C400 is

not operating at the same baud rate as the CAN bus. The DS80C400 would then adjust its baud rate and repeat the process.

If, after a period of time, only a small number of errors have accumulated (most likely due to normal transmission noise), then the

DS80C400 is operating at the correct baud rate. The autobaud process is further simplified by the fact that most networks only oper-

ate at a small number of values. For example, DeviceNet operates at 125kbps, 250kbps, and 500kbps, so a device attempting to auto-

baud to a DeviceNet network would only have to test three baud rates.

The autobaud feature of the CAN module is enabled by setting the autobaud bit (C0C.2). Setting this bit activates a special loopback

circuit within the CAN module that logically ANDs incoming network data received on the RX pin with the TX pin of the CAN module.

While the autobaud bit is set, the CAN module disables its transmit output and places it in the recessive (high) state, so that error

frames generated by the autobauding CAN module do not disturb other devices on the network during the procedure.

The following user-defined software procedure can be used in conjunction with the autobaud feature to determine the baud rate of the

network.

1. Set CRST = 1 to disable bus activity. Setting this bit also sets the SWINT bit, enabling access to control/status registers, and also

clearing the C0RE and C0TE registers.

2. Configure bus timing registers to set desired baud rate.

3. Set autobaud bit = 1.

4. Set SWINT = 0 to enable CAN module and begin listening for errors.

5. Delay approximately 500ms (allow enough time for > 128 errors to occur).

6. If CAN error count exceeded (EC96/128) bit is set, baud rate is incorrect. Select a new baud rate and repeat procedure. If EC96/128

bit is not set, the DS80C400 CAN module is set to the correct baud rate.

Maxim Integrated

Advertising