Skip to content

How to use PinFinder firmware

reed-dan edited this page Apr 7, 2024 · 4 revisions

Introduction

The pinfinder tool will help you configure all the settings changeable in the firmware and automatically detect the pins, or manually set the pins. All without needing to know how to code, use keil, or compile your own firmware.

Using the pinfinder tool is easy, flash the correct pinfinder for your board. The tool will detect the uart pins you want to use. Connect your serial device to the uart pins, and connect with your favorite serial communicator. Once connected you will work through the menu to detect the pins and make adjustments to the settings. Save your settings and flash the main firmware.

Usage

Preparation

Parts Needed

  1. Board you want to program
  2. A constant current power supply, set to 24V1A, or the power supply that came with your balance board.
  3. A SWD programmer, DAPlink is suggested, cheap stlink v2 would also work
  4. USB to TTL uart adapter, if you dont have one a esp32 dev board can be used
  5. PC with serial terminal software, it is suggested to use putty or online version Online Serial Terminal

Identify the hardware

  • Please make sure you know the model of your mcu, it should be stamped/printed on the boards mcu. Failure to use the firmware/pinfinder designed for your mcu will likely brick your board. If you are not sure about your board, please check the database of all known boards, or ask for help.
  • In order to flash your mcu, you will need to find the SWD debug header on your board. Luckily this is the only hardware reverse engineer you need to do, and it is often quite easy. The SWD debug header is often located near the top left of the micro controller, with 4 or 5 holes, marked as GND, 3V3, DIO, CLK, & RST (RST is not on all boards).

image

If the pins are connected together, it is for an RF remote and is not the programming headers.

swd
  • You will need to find a serial port to use the pinfinder terminal, it is suggested to use the masterslave connector on the board, the pinout is sometimes marked on the back of the board. You will need to connect to Tx Rx & GND make sure you do not connect the masterslave positive pin to your usb to ttl adapter! It is likely 12 or 15 Volts and will kill your PC/TTL UART adapter

Installing the Firmware

  • Please refer to installation guide in the readme
  • If this is your first time installing this firmware, please do a full chip erase to unlock the chip and make sure the eeprom is clean, then install the latest pre-compiled firmware provided here or compile your self here
  • After the firmware is flashed, immediately disconnect the power to the board, or choose to not run code after flash, because the first boot is very important.

First Boot

  • Before powering on the board connect all the accessories in the hoverboard back to your main board, the bluetooth module is not used so you can remove it for additional serial port, the masterslave connector should be left empty for now, DON'T CONNECT THE BATTERY connect the battery wire to a constant current power supply (24 Volts 1 Amp), or the balance board power supply. Using the battery may damage the mosfet on the board and brick your board.

*Power Button Detection: Turn on the power supply, press the balance board power button and release it immediately (if its a master), all led(s) on the board will light up, wait for about 5 seconds the led(s) will turn off one by one until the entire board powers off(power supply will read no current draw).

*UART/Serial pin Detection: Press the power button again to turn the board back on and release it, all the led(s) will start to flicker quickly, it is waiting to set the serial port you want to use, just use a piece of wire to short the Tx and Rx together for about 1 second, after the detection is successful the led(s) will stay on for 1 second then go off, now you can release the short between the serial wires.

  • Connect the Tx, Rx, and GND to your usb ttl adapter, open the serial terminal software and connect at baud 19200 8N1, you will see the dots being printed by the hoverboard, now press enter to enter the main menu

image

Auto Detect

Press 1 at main menu to detect everything, just follow the serial terminal guide, you should be able to use the board with main firmware already with default configuration.

Once detection is complete, press 8 at main menu to try out motor rotation, if it works and no error in autodetect it will likely work with main firmware.

Manual Setup

If you want to change the parameters like battery voltage, current, slaveID, ETC or if the autodetect is unable to detect your pinout, you can use command line to set them manually. Press 7 at main menu to enter command line interface. There is a help option in the UI to guide you through manual configuration.

Finish

After all configuration is set with the pinfinder, power the board off and flash the main firmware, be sure to select erase sector only do not erase chip. If all goes well you can connect to the UART/Serial pins with esp32. If all led(s) flash slowly the config is either accidentally erased or was not saved correctly in pinfinder, please start over again.