This is a attempt of writing an alternative firmware for the LD1125H FMCW radar to extract raw ADC values from the Echo/Bang signal via high-speed UART.
The hardware reverse engineering part was done in this article.
First prepare CMake
# mkdir build
# cd build
# cmake ..
Then you can build targets
# make hello_world
which will spit out .elf, .bin and .hex files.
This target is a basic test to verify if the clock configuration, RTOS and UART is working correctly.
Connect a UART to PA10 (TX) and PA9 (RX) using a FTDI like FT232H at a baudrate of 4MBaud to see a text being printed out every second.
- Set the DAC to a static value
- Sample the Bang signal at 50kHz with ADC DMA into a double buffer
- Output it to the serial port buffer using UART DMA TX
- Visualize in Python (FFT)
LD1125H shows the FFT of the Bang signal of a spinning fan
Beware: there was a slight offset in the Python windows when I zoomed into the signals. I really starts a 0 and then increases with direct relation to the RPM of the fan.
Template heavily adapted from https://github.com/djix123/GD32F303CG_CMake
Linker Scripts and Startup from https://github.com/cjacker/gd32f30x_firmware_library_gcc_makefile
OpenOCD script https://github.com/gd32-rs/gd32-openocd