Are you using transceivers or diodes ? Are you using the programming port or the native USB port ?What is exactly your wiring ?
For a correct wiring, use CAN Transceivers and two 120 Ohms resistors at each end of the bus or, as an alternative solution, diodes and a 2K2 resistor connected to 3.3V as explained in this Application Note from Siemens:https://www.mikrocontroller.net/attachment/28831/siemens_AP2921.pdfDiodes are a perfect choice for testing, as long as your bus is no longer than a few meters (I tested with a 1.5 meter but others have been successful with this solution up to 4 meters) although this solution may not be sufficient in case there are lots of EMI.Use a signal diode similar to 1N914 or 1N4148 and a 2K2 (or higher) resistor connected to 3.3 V ( Not 5V as mentionned in AN AP2921). The current should not go above 1.6 ma.Since you are using the programming port, don't forget to comment line 22 in your sketch:#define Serial SerialUSB
Hello!I tested a pair of program that transmit and receive the digital data of a photocell or in the other word send a byte through the CAN to the receiver part. It's by SN65HVD230Q transceiver but my program is failed. I guess the transmission part is valid and the receive part is wrong. I tested the Tx pin of transmission part in the oscilloscope and saw the pulses with about 500ns width. I can't get any answer in receiver part at all . I had used MCP2551 for many times, has my CAN controller been failed because of this? ((