I've bought this CAN Bus transceiver. It appears to have its own onboard microcontroller and I think I made a bad assumption that I could just start dumping data off the TX port.
Once the part arrived, I realized as simple as it sounds, I did not know how to read Serial data out of this TX pin and into the RX0 pin of the Arduino Nano, and then pipe those bytes elsewhere for analysis, for example to the serial monitor. Because, there is only one serial connection; and my computer needs to be one of them. Nevertheless - I did plug it into my car and try. But, obviously no data came out at the baud rate I randomly tried.
The manufacturer maintains a website but it doesn't have any information for me and they did not respond to my request for help.
I thinking I'm going to have to buy a different board with a similar or identical chip onboard, one that has an Arduino-compatible library available. Before I do that, I thought I would check whether anybody here has sample code that may work with this. Perhaps someone can understand salient parts of the available code.
Later on, I did rewrite my sketch to be a little more like an oscilloscope, removing the CAN transceiver and just plugging CAN_HI and CAN_LO into two available analog ports.
For the morbidly curious....
void setup() {
pinMode( A1, INPUT );
pinMode( A2, INPUT );
Serial.begin( 1000000 ); // 1Mbaud, CAN Bus is most likely 500kHz
}
void loop() {
int a1Value = analogRead( A1 );
int a2Value = analogRead( A2 );
Serial.print( "A1: " );
Serial.println( a1Value );
Serial.print( "A2: " );
Serial.println( a2Value );
}
And here is what it looked like. So I guess, I can at least say I know the CAN data is there and that my hardware can pick it up. (I made an OBD2 cable, connector, prototype board etc.)
Where to start?
If You cut out Your private speculations there would be less of not helpful text.
As You have noticed, You need 2 serial channels. The Pc Serial can use 115200 as speed, not 1 000 000.
Reading the CAN circuit ought to be possible using software serial, if Nano supports that. I only have practical experience of UNOs.