Skip to content

ufnalski/uart_to_arduino_plotter_g431kb

Repository files navigation

Yet another UART to USB sniffer [STM32G431KB]

Why another UART to USB converter when we have CH343G, FT232, CP2102, and many other similar converters? The short answer is flexibility. The longer one is sniffing communication between two wiper actuators developed by Bosch. I was playing with Renault Scenic IV wiper actuators. The part numbers are 288A54125R and 288157018R. The left one (at least for the European version) communicates with the BCM over the LIN bus [19200 bps], whereas the right one takes commands from the left one using standard UART communication (no break and sync fields, bitrate much higher than allowed by the LIN bus standard). Standard UART to USB converters support some predefined set of bitrates. It was clear from the logic analyzer that the wipers use something close to 64 kbps, which is a non-standard baud rate for UART. The closest standard 57600 bps didn't work. Therefore, an STM32 was used as a converter. The beauty of such a solution is its versatility. You can play with any baud rates, any data types, any checksums/CRCs, any serial plotters, and many more. A couple of lines and the world is your oyster ❕

UART to USB sniffer in action Logic analyzer UART decoder Web serial plotter wiper position

Note

The measured baud rate is 1000000/(156.2/10) kbps which is 64 kbps. The division by 10 comes from an 8-bit payload plus one start bit and one stop bit.

Tip

The half-duplex UART line between the drives implements a 12 V logic levels. Check your drawer for a ready-to-use (RTU) solution. You can use a LIN transceiver to sense the line (as in my example). A single-wire CAN transceiver should also do the job. Optocouplers are another way to tackle that. What I need here is the listen only (LO) mode which makes things much simpler.

Important

It is highly recommended to use USB isolators when playing with automotive sensors and actuators, i.e. higher than 5V devices. That is why sniffers such as CANable or LUC (LIN) implement the idea of galvanic isolation. I almost always place universal USB isolators between the notebook and all other devices if there is a risk of going something wrong on the "high" voltage side - breadboards are living organisms and everything is possible 🙂 My favorite HS USB isolator is EVAL-CN0550-EBZ from Analog Devices.

EVAL-CN0550-EBZ USB isolator

Pinout

Pin # Left drive (master) Right drive (slave)
1 12 V 12 V
2 GND GND
3 NC NC
4 UART (64 kbps) UART (64 kbps)
5 LIN bus (19200 bps) NC

Missing files?

Don't worry 🙂 Just log in to MyST and hit Alt-K to generate /Drivers/CMCIS/ and /Drivers/STM32G4xx_HAL_Driver/ based on the .ioc file. After a couple of seconds your project will be ready for building.

Exemplary free serial plotters (see #define USE_*** in main.c)

Call to action

Create your own home laboratory/workshop/garage! Get inspired by ControllersTech, DroneBot Workshop, Andreas Spiess, GreatScott!, bitluni's lab, ElectroBOOM, Phil's Lab, atomic14, That Project, Paul McWhorter, Max Imagination, Nikodem Bartnik, Stuff Made Here, Mario's Ideas, Aaed Musa, Haase Industries, and many other professional hobbyists sharing their awesome projects and tutorials! Shout-out/kudos to all of them! Promote README-driven learning 😎

Warning

Automotive actuators - do try them at home ❕

220+ challenges to start from: Control Engineering for Hobbyists at the Warsaw University of Technology.

Stay tuned!

Releases

No releases published

Packages

 
 
 

Contributors