Skip to content

nlbutts/FRCMotorTester

Repository files navigation

Brushless Buddy

This is a small PCB with a display and two rotary encoders. The device is designed to help teams quickly prototype BLC designs using the Rev SparkMax motor controllers. Although it could be expanded to support other devices.

Design

The block diagram is shown below. The design consists of an input buck regulator. The regulator should be good up to 24V, but was designed to work at 12V. There is reverse battery protection, so it should handle accidentially connecting the battery up in reverse.

The buck generates 5V which is used for the CAN transceiver. The 5V is fed to two LDO's to generate 3.3V for the processor and 3.0V for the LCD backlight.

There are two status LEDs on the board, two rotary encoders, and a 128x32 pixel graphical LCD. An STM32F446 processor powers everything.

block diagram

There are three user accessible connectors: Power J2:

Pin Use
1 Ground
2 Power

The mate is a JST PHR-2

CAN J10:

Pin Use
1 CAN High
2 CAN Low
3 CAN High
4 CAN Low

The pinout is the same as the Spark MAX and uses the same connector. The mate is a JST PHR-4

Aux J3:

Pin Use
1 3.3V
2 Ground
3 GPIO1
4 GPIO2
5 GPIO3
6 Analog Input

The mate is a JST PHR-6 The auxiliary connector is used for future use cases. It just made sense to throw this connector on.

The picture below shows the location of the connectors. connectors

Software

The design runs Micropython. To re-build the code do the following:

  1. Download the ARM GCC compiler GCC
  2. Decompress the toolchain to some known location, we will call this <gcc_emd>
  3. Open a command prompt and update your path: export PATH=<gcc_emd>/bin:$PATH
  4. Check out this repo, we will call this directory
  5. Navigate to */software/micropython
  6. make -C mpy-cross -j
  7. BOARD=FRCMOTOR make -C ports/stm32/ -j
  8. Connect the Tagconnect to the board.
  9. Program firmware.elf using the STM32CubeProgrammer.

SWD Debug

It is assumed you are using a JLink and it is installed in /opt/SEGGER/JLink In the software directory:

  1. Run gdbstart.sh in one terminal
  2. Run debug.sh in other terminal. You now have the full power of GDB at your literial finger tips

Python

This device runs micropython. So the main program is a Python program. The main program is called main.py, catchy aint it?

There are two levels of software upgrades. If you need to upgrade the Python code, simply update main.py and copy it over to the PYBFLASH device.

If you need to update Micropython, then use a terminal program to open the REPL terminal. Hit CTRL-C to stop the program. Then type

import machine
machine.bootloader()

This will put the processor in DFU upgrade mode. You can now use STM32CubeProgrammer to program the DFU file. If the upgrade fails, then the device will have to be JTAGed. The next rev of the PCB will fix a defect and a physical button will allow the unit to be booted in DFU mode.

About

Design to assist teams to run motors

Resources

License

Stars

Watchers

Forks

Packages

No packages published