The CAN bus on the Karbon series computers can be modified to fit your applications. Here are some of the frequently asked questions regarding the CAN bus feature.
Q: How do I know which port to use?
A: Messages may be sent by writing to the CAN virtual serial port, like this:
std 123 4 11223344 data
The syntax is:
[std | ext] [id] [length] [data] [data | remote] The Karbon series computers additionally support doing some of the legwork for you, and support using a terminal command to interpret and send a packet:
can-message 123 11223344The syntax is:
can-message [id] [data]So just to be clear, you use the first syntax on the CAN serial port, and the second syntax on the serial terminal.
Q: How do I receive data? A: CAN messages are delivered to the CAN virtual serial port. If you are monitoring this port in with a serial terminal, you will see the data printed out in the terminal.
Q: Can I set the baud rate?
A: Yes! This is a configuration setting, so you’ll need to access the serial terminal. From there, you have two available commands. The first is:
can-autobaudThis command will attempt to detect the baud rate and propagation delay of your CAN bus. It does this by sending messages with ID 7FF, and watching for acknowledgement — so it may not work in every setting. Which is when you want to use the second command:
set can-baudrate 800The syntax is:
set can-baudrate [rate](rate is in thousands)In both cases, you can check if the baud rate was set correctly using
config. Don’t forget to save your settings with
save-config to ensure that it will persist after a power loss.
Q: Do you have an example of doing all of this? A: Sure! This image covers most of the commands in this FAQ:
In the above, we have our Karbon series computer running the CAN bus at 800k, and it’s attached to a device that will echo any CAN packets we send.
Q: Help! Something is terribly broken, how do I reset? A: If things have stopped working quite right, you can reset the Karbon’s microcontroller and CAN controller by performing a hard power cycle (completely disconnect the system from power). Make sure you shut down normally first! If something is ever really, really broken, you can force the Karbon series computer to boot in recovery mode by depressing the settings switch while plugging the system in. From here, you should be able to completely re-flash the firmware.
Q: What CAN standards do the Karbon computers support? A: The Karbon series computers have a CAN 2.0B controller.