Our first version of CAN nodes had a Microchip PIC16F877 and a Philips SJA1000 CAN protocol chip on it. We made a "test" node, so the FC people would have a working CAN node in order to test the CAN driver and and FC software.
- Screw in the CAN cable (you'll need a teeny weeny screwdriver for those 0.1" euroterm blocks.
- Screw in the power cable from the "wallwart" power supply
- When you're ready, plug it in.
If the red error LED goes on, or something seems to have locked up, just cycle the power on the board by unplugging and plugging the power supply.
Remember, when it doubt, power cycle ;)
- Once a second, the node will broadcast CAN message ID = 0x7FC = 0b111 1111 1100 with 8 bytes of data. Those 8 bytes are a BCD counter, from 00000000 to 99999999.
- If you push the button on the board, CAN message ID = 0x7FD = 0b111 1111 1101 will be sent on the bus, with the following random data:
- Data = gcSystemError; // The current system error numer
- Data = Read_SJA(SJA_ECC); // SJA errors
- Data = Read_SJA(SJA_RXERR); // the number of SJA receive errors
- Data = Read_SJA(SJA_TXERR); // the number of SJA transmit errors
CAN Message ID 0x7FE = 0b111 1111 1110 with data > 0x00 turns on Green LED #1. If data is 0x00, Green LED #1 will turn off.
CAN Message ID 0x7FF = 0b111 1111 1111 with data > 0x00 turns on Green LED #2. If data is 0x00, Green LED #2 will turn off.
|ERRORLED||RA0||RED||Firmware error: PIC is probably locked up.|
|OVERFLOWLED||RA1||YELLOW||the SJA's receive buffer has overflowed: too many messages, too fast.|
|CANERRLED||RA2||YELLOW||Passive or active error state: nothing is listening on the bus, wrong bit rate, etc.|
|BUSERRLED||RA3||YELLOW||Hard error on the CAN bus: bit stuffing violation, CRC error, etc.|
|GREEN1LED||RA4||GREEN||CAN triggered LED|
|GREEN2LED||RA5||GREEN||CAN triggered LED|
If the node receives an CAN ID it doesn't recognize, it turns the OVERFLOW_LED, CANERR_LED, and BUSERR_LED. Now that's a stupid behavior. Sorry.
Note the CANERR_LED lights up if there's nothing listening on the bus - the attempted 1Hz messages will be stuck until there's another node listening on the bus, since there's that pesky (but necessary) "ACK" field in the CAN bus transmit sequence.