This manual gives a basic info about Phobia Motor Controller (PMC). See other documents for specific topics.
We do not assemble hardware for sales. You can get fabrication files from our releases or look into the PCB repo. You will have to order the fabrication and assembly yourself.
$ git clone https://github.com/rombrew/phobia-pcb.git phobia-pcb
The aim of our PCB design is to optimize electrical and thermal performance. We are not trying to cram all the components into a small volume. However, we sometimes cross the border of quality in favor of PCB size.
Our recent HW revision is REV5
designed in 8-layer PCB with 35um copper foil
thickness. To improve heat dissipation it is necessary to mount an aluminium
heatsink at bottom side through isolated thermal interface.
You can also try to use third-party hardware like VESC or its clones. Look into Hardware VESC document to get an overview of supported third-party hardware.
Plug PMC according to the diagram. If you need to run a bootloader (in case of erased MCU) then short BOOT pin to +3.3v before the power up.
+-----------+
| | +---------------+
| Host PC |-------//------| USART adapter |
| | | |
+-----------+ | GND RX TX |
+---+---+---+---+
| | |
| | |
+---------------+---+---+------+ Motor
+---------+ | GND TX RX | -----
| |-----| |----------/ \
| Battery | | Phobia Motor Controller |---------| o |
| |-----| |----------\ /
+---------+ | BOOT +3.3v | -----
+--------+------+--------------+
| |
+--/ --+
WARNING: You also can use an USB connection if your hardware has one. Refer
to your hardware manual or look into src/hal/hw/...
directory to find out
available serial interfaces.
PMC software consist of several main parts.
-
Workbench includes numerical model of VSI with PMSM connected (
bench/...
). The numerical model enables us to develop control code in fast cycle without hardware tests. It is complete enough to take into account all of machine parameters. We also provide some set of automated tests which uses a numerical model. But keep in mind that only abstract control code fromsrc/phobia/...
directory is covered by these tests. -
Phobia Graphical User Interface (
pgui/...
). It is a user tool to configure and diagnose PMC in visual way. This frontend communicates with PMC using the CLI via serial port or USB. -
Firmware code for onboard MCU (
src/...
). All of PMSM control algorithms and related functions are implemented here.
You can build the software from sources yourself or get binaries from bundle resleases.
The firmware can be compiled with appropriate GCC or Clang toolchain. Setting up the build toolchain is beyond the scope of this document.
For example let us build the firmware for our REV5
hardware.
$ git clone https://github.com/rombrew/phobia.git phobia
$ cd phobia/src
$ make HWREV=PHOBIA_rev5
You can specify cross-compiler prefix CROSS
and serial device name TTY
.
$ make HWREV=PHOBIA_rev5 CROSS=armv7m-none-eabi TTY=/dev/rfcomm0
If you modified source code files it may be necessary to regenerate defs.h
files by mkconfig
python script before build.
$ ./mkconfig
$ make HWREV=PHOBIA_rev5
There are several ways to load the firmware into the MCU.
SWD interface with GDB. We use Black Magic Probe. Be careful when using hardware debugging while the machine is running. The sudden stop of feedback loop can cause overcurrent accident.
$ make HWREV=PHOBIA_rev5 gdb
(gdb) load
SWD interface with STLINK. You can use
GDB as in previous case but we are only concerned with using st-flash
util.
$ make HWREV=PHOBIA_rev5 stlink
USART interface with ST embedded bootloader using stm32flash. You should have a serial port connected to the board TX and RX pins and BOOT pin shorted to the +3.3v.
$ make HWREV=PHOBIA_rev5 flash
USB interface with ST embedded bootloader using DFU. You should have an USB port connected to the board and BOOT pin shorted to the +3.3v.
$ make HWREV=PHOBIA_rev5 dfu
After MCU is flashed the Command Line Interface (CLI) will be presented on USART, USB and CAN interfaces. We use picocom terminal program. Default baudrate is 57600 with 8-bits data 1-bit even parity and 1-bit stop.
$ make TTY=/dev/ttyUSB0 connect
If MCU was already flashed with PMC firmware you are able to activate ST embedded bootloader without BOOT pin. Just run the command in the CLI.
(pmc) ap_bootload
We recommend you to do built-in integrity check and self-adjustment the first time you power PMC up. Then read all of documentation for setting PMC up.
- Command Line Interface
- Graphical User Interface
- Hardware Design
- Hardware VESC
- Integrity Self Test
- Machine Probe
- Control Tuning
- High Frequency Injection
- Input Analog Knob
- Input Pulse Width
- Input STEP/DIR Interface
- Network CAN
- Trouble Shooting
Yuo can contact me on sourceforge or github as well as by email.
Roman Belov [email protected]