I have a CAN bus with one node acting as a master and several slaves. All nodes have a independent power supply. Is it possible to switch all nodes off and on from the master? The switch off can be realized over a CAN-message. But is there a way to power on Nodes over the CAN bus? It would be okay to switch all slave nodes on by powering up the bus and switching all off by commands to switch them all on again later.
Electrical – Switch / power on nodes when CAN bus is powered up
buscaninterconnectlow-powerswitching
Related Solutions
Since this method brings the bus near 100% utilization, we'll assume that these 3 nodes are the only ones on the bus. Based on your delay time of 10µs, we also assume that the bus speed is 500kbps (i.e. 5 bits of delay, or 1 bit short of the post-arbitration wait between messages).
Whether the method will work or not depends largely on the implementation details of your CAN driver. A more reliable way to accomplish this would be to have node B and C waiting to read each other's message before sending (with node B initially transmitting without waiting). I.E.:
- Wakeup
- Node C waits on message B
- Node B transmits
- Node B waits on message C
- Node C transmits
- Node C waits on message B
- Etc.
To account for desynchronization, each waiting period should have a timeout, after which the node transmits regardless of whether it's received the other node's message.
This will even out the bus utilization and leave each controller able to accomplish other tasks while waiting for the message (instead of continually trying to transmit in the event of an arbitration loss).
Note that this is an unconventional use of CAN. You may be better served with a simpler protocol, such as SPI (node A would have to poll B and C, but there would need to be no arbitration, and everything could be DMA and/or interrupt-driven).
The issue with the AMIS42700 chip is that when trying to broadcast a message to all nodes, it seems to keep sending the same message repeatedly
This implies that the problem could as well be on the CAN controller level. There must be at least one CAN controller present who will acknowledge the reception of the message, or otherwise the controller will keep trying 128 times. Some troubleshooting to check:
Check for error or bus off flags from the transmitting CAN controller. Ensure that no CAN controllers are set to filter out certain identifiers. Ensure that they aren't in "listen-only" mode where they won't ack received frames. Ensure that no controller is in loopback mode (only talking with itself).
Do you get error frames on the bus or actual data? If you look for error frames with a plain oscilloscope, they look like small, single pulses. While data frames look like a train of binary ones and zeroes.
(For an error frame, it should start with 6 bits, which are either dominant or recessive depending on what error state the sending node is in: active error state=dominant bits, passive error state=recessive bits. A node is in active error state until after 128 attempts, when it reverts to passive and can no longer mess up bus arbitration. No matter if active or passive, this part of the frame violates the "bit stuffing" rule on purpose. CAN usually only tolerates up to 5 bits of equal level before using bit stuffing. So the only time when you should encounter 6 bits with same level in a row is during the error frame.)
What does the enable signals EN1 and EN2 look like on the master? Are they stable?
Same problem when you disconnect the second "slave" AMIS from the bus?
I will always suspect the most classic serial bus problem: what is tx and what is rx? (As a rule of thumb/Murphy, you always get these wrong no matter what you do :) ) It would seem that the AMIS circuit will act as a data communication "modem" in this case, or if you will just as any other plain CAN tranceiver. In that case you'll have to ensure that CAN controller Tx goes to AMIS Tx. Your schematic looks correct, but I would always double-check this.
I doubt the terminator resistors have much to do with the problem, since termination-related problems either have no notable effect on the communication (the bus may work fine without proper termination, especially on lower baudrates) or they cause the whole bus to go down, ie they work or they don't. In case they don't, no slave would be able to send anything either.
However, in the datasheet application example of AMIS-42700 (p4), they seem to prefer 60 Ohm, which implies that each of the individual buses should have the normal 120 Ohm termination in each end. As in: add two more 120 terminators on each bus and treat them as two buses not one.
Probably needless to say, but signal grounds need to be the same for both buses. So if they are located on physically different locations, it is not enough to just connect the Text and Rint signals, you must also connect signal grounds.
Strangely, when disconnecting one of the CAN lines (CANH or CANL) at a time, the communication could be established between nodes. In that case though I did not check CANH and CANL at the oscilloscope.
CAN is very rugged, so even when you do such evil things to it, it may still be able to "limp home" if you are lucky.
Related Topic
- Electronic – RS-422 for pseudo-multipoint bus topology
- Electronic – CAN- “Messages have ID’s not nodes”
- Electronic – CAN bus test via loopback – possible or not
- CAN Bus – CAN Bus with Star Configuration/Long Stubs
- Digital Communications – Address-Free Communication Between Microcontrollers
- Electronic – Addressing scheme with CAN bus
- CAN Protocol – CAN Bus Hardware Design with 1000 Nodes
Best Answer
Instead of switch on or off a node, Sleep function of the node MCU can be an option. If you send a specific message from master then the receiver can put itself into Sleep mode. Then if you send another message, it can wake up. But this requires a detailed programming.