Programming issues with OBD-II/SPI adapter

Inquiry and support for Freematics products
Post Reply
b0rna
Posts: 6
Joined: Wed Apr 02, 2014 11:01 am

Programming issues with OBD-II/SPI adapter

Post by b0rna »

Im having issues getting any code to run on the I2C OBD-II adapter. I'm trying to use an Arduino UNO as an ISP. Ive got the source loaded, compiled (untouched), and was having errors using the UNO as an ISP. After some tinkering, it seems that the sketch already loaded on the adapter stopped to function. Having no luck flashing the compiled source back on, I feared that I may have somehow damaged the bootloader. At this point, I reloaded the bootloader (that is, the optiboot version for the 644P) successfully. Having set my board type as shown in the image, when i try upload the compiled source again, I get a signature mismatch error, as shown in the attachment. Trying to select the 8Mhz board instead ( i see a 16Mhz oscillator on the board), I get a sync error. I also tried using Arduinobuilder in ISP mode and get the same errors. Here is a screenshot:

Any help would be appreciated.
Attachments
error.jpg
error.jpg (253.31 KiB) Viewed 28828 times
stanley
Site Admin
Posts: 1039
Joined: Sat Mar 01, 2014 3:15 am

Re: Programming issues with OBD-II/SPI adapter

Post by stanley »

If you purchased the adapter recently, it is a V2 which is compatible with Arduino UNO. So you need to set the board type to Arduino UNO.
b0rna
Posts: 6
Joined: Wed Apr 02, 2014 11:01 am

Re: Programming issues with OBD-II/SPI adapter

Post by b0rna »

I purchased a new adapter from you. The first one was the 644P (V1). I could not get any firmwares to function unfortunately.

I purchased a V2 adapter recently. This one is the 328P. I can program it just fine, and have tried a multitude of sketches both using Codeblocks and Arduino builder and the Arduino IDE. I can program using both methods, however, nothing seems to function. I get an sck cannot be set warning using both methods.

Using the USBASP I purchased from you along with the dongle, see attachment for the program write log.

The Arduino library also gives the same message.

I have tried all the available sketches, simple test sketches from the master-repo and the V2 sketch.

After giving up on both dongles, I tried just creating a simple digital write sketch to pulse one of the free ports pins. I used current limited led to poke at some of the free pins (not sure if they have changed in V2, im looking at the schematic from V1 on kickstarter). I tried several pins including some on port D, and port C as well. Nothing. I literally cant get the MCU to do anything on either board.

Very very frustrated. A lot of money has been dumped into these dongles and im not sure why im having so much difficulty programming them.

Thank you.
Attachments
sck.jpg
sck.jpg (141.12 KiB) Viewed 28263 times
b0rna
Posts: 6
Joined: Wed Apr 02, 2014 11:01 am

Re: Programming issues with OBD-II/SPI adapter

Post by b0rna »

Also, are the unused IO pins pulled down or up or are they left floating? The kickstarter schematic does has the 644P, and from there it looks as if they are left floating. Any chance you can post the schematic for V2?

Any help is appreciated.

Thanks.
b0rna
Posts: 6
Joined: Wed Apr 02, 2014 11:01 am

Re: Programming issues with OBD-II/SPI adapter

Post by b0rna »

allright,

After some patience and debugging, ive got something going on.

I started with a clean sketch, added Wire.h to the project and issued a hello world on the I2C bus, then uploaded the sketch to the I2C adapter.
--
On the other side, I used an Arduino UNO, started with a clean sketch as an I2C reader and set it up such that it will dump all bus data on the serial monitor.

-----------------------------------------------------------------------

so on the adapter side:

obd.begin() gets issued (which issues Wire.begin());

Then i do a I2C write as a "hello adapter" capture point to ensure that obd.begin() returned and the I2C bus is initiated (capture in serial monitor of arduino UNO I2C listner)

after this, obd.init() is issued through

//initiate OBD-II connection until success
while (!obd.init());

this is where the problem begins. obd.init() does not return.
instead, the adapter resets after about 5 seconds and the obd.begin() runs again from within the void setup() function.

not entirely sure how to go about getting this to work.

I2C model, (ive also got a UART model laying around i could probably use)...

My guess is that 0bd.init() is not returning true, and the while loop runs wild until the Arduino resets. The while loop would stall the void setup() if init() does not return.

Not sure what im doing wrong.

Any help is appreciated.

Thanks.
Last edited by b0rna on Mon Jul 14, 2014 5:51 am, edited 1 time in total.
b0rna
Posts: 6
Joined: Wed Apr 02, 2014 11:01 am

Re: Programming issues with OBD-II/SPI adapter

Post by b0rna »

Hi Stanley,

So I've got everything working.

This thread can be closed.
stanley
Site Admin
Posts: 1039
Joined: Sat Mar 01, 2014 3:15 am

Re: Programming issues with OBD-II/SPI adapter

Post by stanley »

Good to know that. :)
rainlake
Posts: 1
Joined: Tue Dec 09, 2014 12:45 pm

Re: Programming issues with OBD-II/SPI adapter

Post by rainlake »

Hi @b0rna. What did yo do to make it work?
I have same issue as yours.
thank you
koffisam
Posts: 2
Joined: Tue Apr 14, 2015 4:35 am

Re: Programming issues with OBD-II/SPI adapter

Post by koffisam »

Hello @b0rna,
I am also having the same issue with my OBD device. Can you please offer any help?
orpheus88
Posts: 9
Joined: Mon May 05, 2014 9:13 pm

Re: Programming issues with OBD-II/SPI adapter

Post by orpheus88 »

Did it today successfully, open Arduino IDE select Arduino Uno as Board, select the correct COM port and load the ArduinoISP sketch from the examples and then flash it, Arduino IDE can be closed afterwards.
Open CodeBlocks select Arduino Uno as Target, when finished building and you want to upload it to your Freematics, click Tools, configure tools..., choose Upload via Arduino ISP, click Edit, Edit the -P parameter from something like

Code: Select all

-P\\.\{UPLOAD-PORT}
to the COM-port of your Arduino Uno like

Code: Select all

-P\\.\COM34
save an close the dialogs connect like described in http://blog.freematics.com/2014/freemat ... ing-guide/ and now you can choose Tools- > Upload via Arduino ISP to upload the built hex file.
I sometimes have the problem that my freematics is to busy with the current sketch, that it ignores the reset (or the reset cable to port 10 on the uno, has come loose again) and I get a "not sync" error from avrdude, but a reset on the uno fixes that.

Even my USBasp is finally working as it should, connected like shown http://blog.freematics.com/2014/freemat ... ming-guide (Ground on 7 like in the picture not on 8 like the in the text), didn't have the freematics not responive problem here.
Post Reply