Based on my troubleshooting: Inside of the COBD class's "begin()" method (OBD2UART.cpp), the calls to "OBDUART.begin(baudrates[n], SERIAL_8N1, 16, 17);" in OBD2UART.cpp do not return before the setup() code runs again.
With OBDUART being a label for Serial1, I am not sure why "Serial1.begin(baudrate, config)" is hanging. The code below shows the setup() function in the test sketch I am trying to run:
Code: Select all
#include <OBD2UART.h>
COBD obd;
void setup()
{
Serial.begin(115200);
Serial.println("1: Before obd.begin()");
// we'll use the debug LED as output
// pinMode(13, OUTPUT);
// start serial communication
obd.begin();
Serial.println("2: after obd.begin()");
// initiate OBD-II connection until success
while (!obd.init())
{
Serial.println("Failed init");
delay(1000);
// digitalWrite(13, HIGH);
// delay(1000);
// digitalWrite(13, LOW);
}
}
The circuit: An Adafruit GPS breakout board and MicroSD module are connected to rx, tx and SS, MOSI, MISO, and SCK respectively. Disconnecting these modules had no impact on the program's behavior.
I'm a college student trying to use this kit for my senior project, so any help is appreciated!