Access to STM32 protocol controller

Inquiry and support for Freematics products
Post Reply
nothin
Posts: 5
Joined: Sat Feb 25, 2017 7:42 pm

Access to STM32 protocol controller

Post by nothin »

Hello, I would like to be able to broaden the use of the Freematics ONE. In order to do this, I would need access to the STM32 protocol processing microcontroller. Can the software running on this be altered using the Arduino connection or in another way, with some soldering possible?
And if this software can be altered, is it possible to get the source code for this device?

I would like to alter the way the communication with the car works and possibly the transfer speed. If no other peripherals are needed, such as GPS and GPRS, the update frequency could be boosted.

Unless the protocol chip used is hard coded, altering this should be possible.

Regards and thanks in advance
Simon
protomor
Posts: 99
Joined: Wed Oct 14, 2015 9:17 am

Re: Access to STM32 protocol controller

Post by protomor »

There's two levels of code for this project (both are open for you to modify). The first is the "ino" file itself, which is the general workings that connects to the GPS and accelerometer as well as the OBD2 stuff. The second level is the hardware setup in the libraries themselves.

The base of this project is the ELM327 chip. Which is in most OBD2 readers. You can get just this setup from some place like spark fun (https://www.sparkfun.com/products/9555).

The bits of the freematics code that I've been working with actually logs the GPS and accelerometer while waiting for the ELM327 chip to respond to each call. So there is about a ~15ms overhead at most. I doubt it has any meaningful impact on logging of the OBD2 data.

The biggest hurdle is OBD2 itself. The protocol is "call and respond" (my term, I dunno the real term). You have to send a command to the OBD2 unit and wait for it to respond. So each call takes time. If you ask for throttle position, it'll take time to respond before you can ask for the coolant temperature. You can't just scan the whole pid list at once.

On top of that, the TYPE of protocol makes a difference. I've polled only RPM on some cars and have gotten a 500ms call back time with no gps and no accelerometer. Just calling that PID. Some late 90's cars will poll around 180ms. Early 2000s tend to be around 120ms. I can get around 50ms from my late 2007 GTO engine. I recently saw a log from a guy with a 2013 VW of some kind and it polled at 15ms!
nothin
Posts: 5
Joined: Sat Feb 25, 2017 7:42 pm

Re: Access to STM32 protocol controller

Post by nothin »

According to the schematics, the protocol controller is using the stm32f103c8t6 microcontroller to interface the gps and CAN-bus, where the CAN-bus is through a tja1050 can transceiver. OBD2 has support for both direct CAN sniffing but also the call/respond you describe. I would like to alter the stm32 chip, but as far as I can tell, the uploading done from the arduino ide only targets to ATmega chip.

The big question remains, how would you update the firmware on the stm32f103c8t6 and what is the source code for the current firmware. Because the Arduino chip uses SPI to interact with this other chip, I should be able to change the SPI functions on the stm32 chip. Or is it hardcoded as an ELM327, which would limit the possibilities.

I have a controller built on top of a Beaglebone Black, with a transceiver, that can sniff from the ODB-II CAN without issues, which is why I am confident that there will always be chatter on the line.
protomor
Posts: 99
Joined: Wed Oct 14, 2015 9:17 am

Re: Access to STM32 protocol controller

Post by protomor »

Honestly, you're getting beyond my knowledge and ability. The freematics unit is predone and a whole unit. If you want to tap into the bits individually, I would suggest simply getting the parts and starting from there rather than taking this unit and stripping it down.

I'm still not sure what you're trying to do. The sparkfun ELM327 is as bare bones as you can get for an "off the shelf" OBD2 solution. If you want a CAN interface only, I think you'd want the tja1050 chip itself and forego anything that supports full OBD2. You'd have to write your own code to grab data but that shouldn't be too hard.

Still, on newer can cars, with this unit, you can get 15ms polls. Do you need faster than that? I'm not sure you'll shave much time off of it.
nothin
Posts: 5
Joined: Sat Feb 25, 2017 7:42 pm

Re: Access to STM32 protocol controller

Post by nothin »

The reason is I am doing a project at my university, where there have to be specialized logging. This requires GSM and GPS module, as well as gyroscope and such. The Freematics has almost all of these things, but is way cheaper for a small production. They are looking for around 25 units, where the unit price of the Freematics ONE is between 1/3 and 1/4 of the production cost of the currently used logger based on a Beaglebone Black.

The fact is that we do not intend to make a request/receive but mainly filter the information already being transmitted on the line.

Perhaps Stanley, having designed it, could indicate whether or not this is possible with the current setup of the Freematics ONE. This being able to recode the stm32 microcontroller.
swedlaan
Posts: 2
Joined: Thu Sep 28, 2017 9:31 pm

Re: Access to STM32 protocol controller

Post by swedlaan »

Hi,

According to the Schematics for the One+ there seems to be a possibility to connect to the STM. See connector J5.
I've got the ST debugger/ICE but the J5 isn't marked on the PCB and i suspect it's some of the unmounten pins on the side of the PCB.

If we can get the information on how to connect the STM32 debugger it shouldn't be a problem.
Post Reply