Firmware/Bird

From Teilen macht Spass!
Revision as of 12:00, 24 November 2022 by Scootyandspeedy (talk | contribs) (→‎Bird Rev:2 board flashing)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Bird Rev:2 board flashing

This Bird model is made by Ninebot(Segway), next to okai the only two companies producing and r&d-ing troitinettes. The IoT part of the Bird scooter is outsourced to https://www.mobilogix.com/ (src: https://hackaday.io/project/163676-birdboxing/log/160392-bird-esb-esx)

The board contains an ARM STM32F412RGT6 micro-controller. It's SWD debug interface is broken out to neat debug pads on the PCB. It controls the Quectel EC21-E modem via oldschool AT-commands.

pinout


The ARM mirco-controller is read-protected, so we can not (yet) dump the existing code. But we can erase it and run our own code if needed.

The prefered way to interact with these ARM chips is using a software called OpenOCD. For this guide we will use the official, terrible IDE and Flasher.

You will need an ST-Link V2 Dongle for this exercise (some wire and a soldering iron is also handy).

It would be great to use the onboard sound transducer and make some noise, but I cant find what pin its connected to. Also this would involve enabling high speed clocks and adjust timers plus enabling PWM on that pin....What we know now of the onboard LEDS and SPEAKER/TRANSDUCER:


  • Buzzer is connected to GPIO PC13 it seems? needs some pwm and work on the timers and clocks mebbie
  • The left LED (red), is going to the swd power pin, this means you can program it to blink, but then wont be able to program the chip anymore? More digging needed
  • Left LED (green) seems unconnected, i soldered it to the unused PD2 pin and it can be programmed to blink. Funny how i only could get a unconnected pin to work on an unconnected led...you would argue its easy to trace components to their pins..its quite hard (buzzer and other led actually seem to be driven through some transistor). Funny sidenote, this pin is used in a lot of online tutorials for a blinking led lol.

Blink an LED

The Left LED (green) seems unconnected, i soldered it to the unused PD2 pin and it can be programmed to blink.

pinout


TOOLCHAIN WINDOWS

  • Follow the steps on this official wiki to install the toolchain:

https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Step1_Tools_installation

  • Then follow this guide to blink a led:

https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Step2_Blink_LED

The HAL codes used in the video are not correct in this case, you can replace the blink part with the following:

    

HAL_GPIO_TogglePin(PD2_GPIO_Port, PD2_Pin); 
HAL_Delay(1000);


TOOLCHAIN OSX

TOOLCHAIN LINUX