Can bus anyone?

Status
Not open for further replies.

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
I have started using Can.... All has been well unitl the back and forth messaging became... well a lot!

Normally I don't bother with error as it has never been a problem but now messages are appearing out of order..

I send 4 messages... then the 5th goes missing 6 and 7 are okay then 5 arrives... ??? The resend seems to be automatic.

When there is an error... Do I need to flush the channel and resend the last message??? How does it work?
 
CAN is fundamentally a broadcast system; in its basic form, each device regularly sends whatever data may be needed by other devices in the system and it's up to each device to monitor for data from other devices that send data relevant to them.

There may be other layers of protocol built on that, but at the lowest level it's broadcast with no handshake.
 
I kinda bodged it.... Basically "if ERR then wait 200ms" It seems to work better... If there is an error on the bus then it has to wait a tad..
 
If two devices try to transmit at the same time, it should be detected harmlessly at the hardware level, the lower priority one should wait and retry without anything being corrupted, if I remember right.

What MCU are you working with? I've used the CCS CAN library just as an experiment to test out communications with other systems, but I don't have anything using CAN seriously so far.
 
Pic32 to Pic18 Normally one direction but recent projects require more than a dumb slave..

I have no serial interface on the pic32 ( all serial ports are hogged by SPI ) so I shift data to a "smart" receiver that can print to a little thermal printer.

41 chars at a time, so the canbus is busy.. If I print more than 5 lines it starts to cry.. The delay seems to have done the trick..
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…