Spark Logic

Hacking the GD32 based ‘Autool X50 OBD2 Monitor and diagnostic Display’

carl0s Wed Apr 11, 2018 5:27 pm

Hi!

I’m Carl

My first project with STM32 will hopefully be to get some code onto this GD32F103 board, and drive the LCD. I first need to figure out what the driver is. It appears to be using 17 pins.. Hopefully the ILI9341.

I will then use this as a screen / controller for my vehicle datalogger that I have already built on an Adafruit Feather M0.

Here’s the thing I want to hack..

Note that the mini-USB on the back here is actually for a vehicle OBD connection, and will be expecting +12v as well as K-Line, L-Line, CAN-Hi/CAN-Lo, etc.. It’s *not* a Mini-USB connection!

(in most web browsers, you can right-click on the images below and choose Open Image in New tab, to view at full resolution).

Image

Image

Image

Image

Image

Replies

ahull Thu Apr 12, 2018 3:05 pm

The backlight is pretty easy to identify. Look for the A and K pins on the FPCB (ribbon cable). They are almost certainly (A)node and (K)athode of the LED(s), furthermore the black tape (labelled CN3 on the FPCB) probably covers an SMD LED (or two) or a couple of zero ohm links. One other possibility is that the black tape might cover some configuration jumper pads used to set the interface mode.

Put your multimeter in diode test mode, and probe between the A and K pins, and you may well be rewarded with a dim glow from the backlight.
From there it is a matter of figuring out where those pins go on the main pcb.

Look closely at the image you posted of the FPCB, the interface might actually be relatively easy to figure out.

Although the controller has a bewildering array of possible interface modes, we can eliminate most of them due to the relatively low number of pins on the connector.

The connector itself has 18 pins, and one of those has been left blank, so that leaves 17, if we assume a minimum of two further pins, one each for power and gnd, and it appears two pins for the LED (although it may have a common ground or power pin, so it may only use one), then we only have 13 pins left, so we cant be using 16 bit parallel modes. It may be possible to further eliminate pins, since we may have a ground pin interleaved between each signal pin. If this is the case, then we may only be looking at six or seven signal lines.

If the gadget was still working, we could stick a logic analyser on it and get the right answer pretty quickly, but since it is not, we may need to eliminate the remaining modes by trial and error.

I presume the display doesn’t have a touch screen.

The button interface should also be relatively easy to figure out with the continuity tester on your multimeter too.

carl0s Thu Apr 12, 2018 3:22 pm

[ahull – Thu Apr 12, 2018 3:05 pm] –
The backlight is pretty easy to identify. Look for the A and K pins on the FPCB (ribbon cable). They are almost certainly (A)node and (K)athode of the LED(s), furthermore the black tape (labelled CN3 on the FPCB) probably covers an SMD LED (or two) or a couple of zero ohm links. One other possibility is that the black tape might cover some configuration jumper pads used to set the interface mode.

Put your multimeter in diode test mode, and probe between the A and K pins, and you may well be rewarded with a dim glow from the backlight.
From there it is a matter of figuring out where those pins go on the main pcb.

Look closely at the image you posted of the FPCB, the interface might actually be relatively easy to figure out.

Although the controller has a bewildering array of possible interface modes, we can eliminate most of them due to the relatively low number of pins on the connector.

The connector itself has 18 pins, and one of those has been left blank, so that leaves 17, if we assume a minimum of two further pins, one each for power and gnd, and it appears two pins for the LED (although it may have a common ground or power pin, so it may only use one), then we only have 13 pins left, so we cant be using 16 bit parallel modes. It may be possible to further eliminate pins, since we may have a ground pin interleaved between each signal pin. If this is the case, then we may only be looking at six or seven signal lines.

If the gadget was still working, we could stick a logic analyser on it and get the right answer pretty quickly, but since it is not, we may need to eliminate the remaining modes by trial and error.

Well, as it happens I ordered another one of the same gadgets at 3am this morning. Should have it tomorrow ;-)
If read-out protection isn’t set, I’ll read the flash and write it back to my broken one.
I can get my USB L/A on it.

Here are the FFC pinouts, so i guess it’s just a matter of finding which SPI pins on the GD they are connected to.
Image

RogerClark Thu Apr 12, 2018 9:26 pm

I think the main difference with the GD32 variant in the core was just that all the boards used a 12MHz crystal where as most STM32 boards use a 8MHz

You could could try just selecting the Generic STM32F103C board, if your board uses an 8MHz crystal ( I think from the photos that it does)

Note, don’t select the F103CB as the GD32F103C8 only every has 64k Flash unlike the STM chip where you normally get 128k even on the 64k version ( because ST’s production yields are so good they don’t have duff chips to sell as the 64k version )

However getting the display to work would involve debugging the SPI at the hardware level using a logic analyser

It’s a actually a shame that the companies in China who made the GD32 boards, initially charged so much for them, and then ceased production due to lack of demand, as I think most people would have been happy to use the GD32 as it’s much faster than the STM32.

However perhaps the internal market in China found the GD32 was not as compatible as it was claimed to be, and hence it didn’t get the demand they expected for those boards.

E.g. No one has noticed any STLink dongles or other similar boards appearing with GD32 MCUs on them.
So the price / risk ratio of the GD32 can’t make it economic for the manufacturers in China to widely use it

RogerClark Thu Apr 12, 2018 9:33 pm

I just checked on Aliexpress and the price for the GD32 seems to be the same as the STM32.

I can’t see any incentive for most companies to use it.

The GD32 would need to be reasonably cheaper eg. Half the price of the STM32 to make economic sense to take the risk on a new device.

carl0s Thu Apr 12, 2018 10:29 pm

Maybe GD are also intending to market based on features (faster clock, shadow ram flash thingy). I noticed Fujitsu have a page dedicated to GigaDevices. They seem to have some sort of partnership.

Anyway I have the datasheet for both the LCD and the LCD driver, and I have buzzed out all the pins tonight, and it all makes sense. The screen is connected to PB12 to PB15 (Alt mode: SPI2). The cathode pins (both) of the LCD backlight run via a 2.2k ohm resistor from PB1 thru a transistor of some sort (Q6 on PCB). I’m a bit clueless and only just learning electronics but I get that a transistor is a switch..

Data/Command select (LCD FFC PIN8 in table above) is connected to PA11. LCD reset (FFC #9 in table above) is connected to PA15.

I’ll diagram all this up over the weekend with better PCB photos.

RogerClark Thu Apr 12, 2018 11:54 pm

Re: GD32

Its hard to know how they are marketing the GD32. I forget how much faster it is. Possibly 25% faster at best.
Strangely the GD32 has the option to run at 120Mhz with USB functioning, however the chip is only spec’ed to run at 108Mhz, and to maintain USB the speed has to drop down to 96Mhz. So it looks like their manufacturing quality or silicon fab design, didn’t live up to their initial spec’s

ahull Fri Apr 13, 2018 5:48 am

[carl0s – Thu Apr 12, 2018 10:29 pm] – The screen is connected to PB12 to PB15 (Alt mode: SPI2). The cathode pins (both) of the LCD backlight run via a 2.2k ohm resistor from PB1 thru a transistor of some sort (Q6 on PCB). I’m a bit clueless and only just learning electronics but I get that a transistor is a switch..

If we set up a blink sketch on PB1, we should be rewarded with a flashing backlight. The backlight I’m guessing, should draw about 30mA (for simplicity we can consider it as a single LED with the two x 2.2k resistors in parallel, but it is in reality probably a number of small LEDs in parallel with each other, seriesed up with each resistor) and should be quite bright at that. We can then try using PWM on that pin, which should give us full control of the backlight brightness.

I suspect from the description that setting the pin high will switch the backlight off, and low will switch it on, but I could of course be completely wrong. :D

RogerClark Fri Apr 13, 2018 6:24 am

@carl0s

Can you post a link to where you bought it ?

(I assume you bought it online ??)

ahull Fri Apr 13, 2018 10:00 am

This gadget seems to have several names, and several variants.

Using the ebay search string “X50 plus car”

Cheapest I can find on ebay.com is :-

https://www.ebay.com/itm/AUTOOL-X50-Plu … SwvKtY9XXl

Best UK Price £17.21

https://www.ebay.co.uk/itm/AUTOOL-X50-P … SwvKtY9XXl

I cant be absolutely certain it is the same device as the “ANCEL A202 Smart OBDII Gauge Car Speed Meter” but the pictures look close enough to suggest 99.9% it is probably the same device. The display looks the same, and it has the same LDR and USB connector on the rear, the same jog/click button on the front etc.

EDIT: Just found this in the instructions.

” 7.Instrument standby time-After the car flames out, the set value is reached, and X50 Plus will sleep automatically.”

Don’t say you weren’t warned ;)

carl0s Fri Apr 13, 2018 10:24 am

[ahull – Fri Apr 13, 2018 10:00 am] –
This gadget seems to have several names, and several variants.

Using the ebay search string “X50 plus car”

Cheapest I can find on ebay.com is :-

https://www.ebay.com/itm/AUTOOL-X50-Plu … SwvKtY9XXl

Best UK Price £17.21

https://www.ebay.co.uk/itm/AUTOOL-X50-P … SwvKtY9XXl

I cant be absolutely certain it is the same device as the “ANCEL A202 Smart OBDII Gauge Car Speed Meter” but the pictures look close enough to suggest 99.9% it is probably the same device. The display looks the same, and it has the same LDR and USB connector on the rear, the same jog/click button on the front etc.

EDIT: Just found this in the instructions.

” 7.Instrument standby time-After the car flames out, the set value is reached, and X50 Plus will sleep automatically.”

Don’t say you weren’t warned ;)

Haha, yes that’s the correct device!

I will actually be using the Autool X60 in the end though which is a round gauge style, but I could only find those from China. So I got the above instead from Amazon (for £29.99 .. but I wanted it next day on prime!)

What they mean in the instructions there, is that because a car’s +12v in the OBD connector is constantly live (there’s no switched live available on OBD connector), it will instead go to sleep when the read values from OBD show that the engine has been off for a set time.

carl0s Fri Apr 13, 2018 10:30 am

[ahull – Fri Apr 13, 2018 5:48 am] –
[carl0s – Thu Apr 12, 2018 10:29 pm] – The screen is connected to PB12 to PB15 (Alt mode: SPI2). The cathode pins (both) of the LCD backlight run via a 2.2k ohm resistor from PB1 thru a transistor of some sort (Q6 on PCB). I’m a bit clueless and only just learning electronics but I get that a transistor is a switch..

If we set up a blink sketch on PB1, we should be rewarded with a flashing backlight. The backlight I’m guessing, should draw about 30mA (for simplicity we can consider it as a single LED with the two x 2.2k resistors in parallel, but it is in reality probably a number of small LEDs in parallel with each other, seriesed up with each resistor) and should be quite bright at that. We can then try using PWM on that pin, which should give us full control of the backlight brightness.

I suspect from the description that setting the pin high will switch the backlight off, and low will switch it on, but I could of course be completely wrong. :D

I just need to find out how to build/compile stm32duino code and then upload it with my ST Link v2. I have been using PlatformIO for my Arduino stuff to date.

carl0s Fri Apr 13, 2018 10:43 am

[ahull – Fri Apr 13, 2018 5:48 am] –
[carl0s – Thu Apr 12, 2018 10:29 pm] – The screen is connected to PB12 to PB15 (Alt mode: SPI2). The cathode pins (both) of the LCD backlight run via a 2.2k ohm resistor from PB1 thru a transistor of some sort (Q6 on PCB). I’m a bit clueless and only just learning electronics but I get that a transistor is a switch..

If we set up a blink sketch on PB1, we should be rewarded with a flashing backlight. The backlight I’m guessing, should draw about 30mA (for simplicity we can consider it as a single LED with the two x 2.2k resistors in parallel, but it is in reality probably a number of small LEDs in parallel with each other, seriesed up with each resistor) and should be quite bright at that. We can then try using PWM on that pin, which should give us full control of the backlight brightness.

I suspect from the description that setting the pin high will switch the backlight off, and low will switch it on, but I could of course be completely wrong. :D

There’s only one 2.2k resistor that I can see for the backlight by the way (R7). The 18-pin LCD FFC has two LED anodes and two LED cathodes, but they seem to be connected together. So both cathodes go to transistor Q6, which is then connected to the GD32 via 2.2K resistor R7.

The anodes are joined as well, and come out of transistor Q4, which also feeds V-in of voltage regulator U4 (662k – https://www.mikrocontroller.net/attachm … 6206N3.pdf )

Here is the PCB, and here is my drawing on the datasheet. My really bad drawing in the bottom left of the datasheet is the same orientation as the PCB, and I have diagrammed the important LCD pins. The only pins I haven’t bothered with are mostly ground and +vcc.

Image

Image

Also, here is the datasheet for the GD32F103 in English: http://www.internetsomething.com/autool … asheet.pdf

Here is the 850 page user guide for the GD32F103 in English: http://www.internetsomething.com/autool … N_V2.0.pdf

and here’s the LCD datasheet again: http://www.internetsomething.com/autool … 24GUF1.pdf

ahull Fri Apr 13, 2018 12:10 pm

Good progress. :D
What about the switches for left/right/click interface and the LDR, have you identified these yet?

carl0s Fri Apr 13, 2018 12:30 pm

[ahull – Fri Apr 13, 2018 12:10 pm] –
Good progress. :D
What about the switches for left/right/click interface and the LDR, have you identified these yet?

No but I will do :-)

ahull Fri Apr 13, 2018 2:06 pm

I will actually be using the Autool X60 in the end though which is a round gauge style, but I could only find those from China. So I got the above instead from Amazon (for £29.99 .. but I wanted it next day on prime!)

The Autotool X60 looks to be almost identical (its “round” display may actually be a square one in a round bezel). It will be interesting to compare the two.

What they mean in the instructions there, is that because a car’s +12v in the OBD connector is constantly live (there’s no switched live available on OBD connector), it will instead go to sleep when the read values from OBD show that the engine has been off for a set time.

Oh.. so no real flames in that “flame out…” shame… I’ll tell the Trumpton fire brigade to stand down then ;)

carl0s Fri Apr 13, 2018 3:11 pm

LOL :D

Yes I am expecting it to be a square display, but, I want a gauge style case :)

carl0s Fri Apr 13, 2018 9:19 pm

eeeeeee it works :-)

I used PlatformIO, and just chose “STM32F103R8 (20k RAM. 64 Flash)” as the board.

RogerClark Fri Apr 13, 2018 10:25 pm

Ok.

I didn’t realise it came with the OBD connector etc.

ahull Sat Apr 14, 2018 9:00 am

[carl0s – Fri Apr 13, 2018 9:19 pm] –
eeeeeee it works :-)

Blinkey flashey stuff! :D Next up.. the display I would guess. That may take a bit more head scratching.

You could also try reading the LDR, and using that to control the brightness of the backlight.

carl0s Sat Apr 14, 2018 9:04 am

[ahull – Sat Apr 14, 2018 9:00 am] –
[carl0s – Fri Apr 13, 2018 9:19 pm] –
eeeeeee it works :-)

Blinkey flashey stuff! :D Next up.. the display I would guess. That may take a bit more head scratching.

You could also try reading the LDR, and using that to control the brightness of the backlight.

I have bought a working replacement unit. I was going to return it now that I can see the firmware is readout locked. Do you think I should keep it?

I was hoping there would be a gfx library for the display controller and I might just have to alter spi pin assignments or something. Is that a bit optimistic ? :-)

Also, do you think I should set about getting a serial debugging console going for doing a lot of Serial.print() stuff? If so should I use the gd32’s on-chip usb or should I just use its uarts with a TTL to usb into my computer?

I probed the LDR last night so I have the pins. This is where I think serial debugging might help me though. Also I don’t yet know about pwm on these things. I hope you can set hardware to do it and just adjust when needed, as software pwm would surely eat up a huge number of cycles and require that absolutely no delays or blocking code happens anywhere during the main loop.

Sign in to reply