Board - Sparky
The Sparky is a very low cost and very powerful board.
- 3 hardware serial ports.
- Built-in serial port inverters which allows S.BUS receivers to be used without external inverters.
- USB (can be used at the same time as the serial ports).
- 10 PWM outputs.
- Dedicated PPM/SerialRX input pin.
- MPU9150 I2C Acc/Gyro/Mag
- Baro
Tested with revision 1 & 2 boards.
TODO
- Display (via Flex port)
- SoftSerial - though having 3 hardware serial ports makes it a little redundant.
- Airplane PWM mappings.
Voltage and current monitoring (ADC support)
Voltage monitoring is possible when enabled via PWM9 pin and current can be monitored via PWM8 pin. The voltage divider and current sensor need to be connected externally. The vbatscale cli parameter need to be adjusted to fit the sensor specification. For more details regarding the sensor hardware you can check here: https://github.com/TauLabs/TauLabs/wiki/User-Guide:-Battery-Configuration
Flashing
Via Device Firmware Upload (DFU, USB) - Windows
These instructions are for flashing the Sparky board under Windows using DfuSE. Credits go to Thomas Shue (Full video of the below steps can be found here: https://www.youtube.com/watch?v=I4yHiRVRY94)
Required Software: DfuSE Version 3.0.2 (latest version 3.0.4 causes errors): http://code.google.com/p/multipilot32/downloads/detail?name=DfuSe.rar STM VCP Driver 1.4.0: http://www.st.com/web/en/catalog/tools/PF257938
A binary file is required for DFU, not a .hex file. If one is not included in the release then build one as follows.
Put the device into DFU mode by powering on the sparky with the bootloader pins temporarily bridged. The only light that should come on is the blue PWR led.
Check the windows device manager to make sure the board is recognized correctly. It should show up as “STM Device in DFU mode” under Universal Serial Bus Controllers
If it shows up as “STMicroelectronics Virtual COM” under Ports (COM & LPT) instead then the board is not in DFU mode. Disconnect the board, short the bootloader pins again while connecting the board.
If the board shows up as “STM 32 Bootloader” device in the device manager, the drivers need to be updated manually. Select the device in the device manager, press “update drivers”, select “manual update drivers” and choose the location where you extracted the STM VCP Drivers, select “let me choose which driver to install”. You shoud now be able to select either the STM32 Bootloader driver or the STM in DFU mode driver. Select the later and install.
Then flash the binary as below.
Disconnect and reconnect the board from USB and continue to configure it via the Cleanflight configurator as per normal
Via Device Firmware Upload (DFU, USB) - Mac OS X / Linux
These instructions are for dfu-util, tested using dfu-util 0.7 for OSX from the OpenTX project.
http://www.open-tx.org/2013/07/15/dfu-util-07-for-mac-taranis-flashing-utility/
A binary file is required for DFU, not a .hex file. If one is not included in the release then build one as follows.
Put the device into DFU mode by powering on the sparky with the bootloader pins temporarily bridged. The only light that should come on is the blue PWR led.
Run ‘dfu-util -l’ to make sure the device is listed, as below.
Then flash the binary as below.
The output should be similar to this:
On Linux you might want to take care that the modemmanager isn’t trying to use your sparky as modem getting it into bootloader mode while doing so. In doubt you probably want to uninstall it. It could also be good idea to get udev fixed. It looks like teensy did just that -> http://www.pjrc.com/teensy/49-teensy.rules (untested)
To make a full chip erase you can use a file created by
dd if=/dev/zero of=zero.bin bs=1 count=262144
This can be used by dfu-util.
Via SWD
On the bottom of the board there is an SWD header socket onto switch a JST-SH connector can be soldered. Once you have SWD connected you can use the st-link or j-link tools to flash a binary.
See Sparky schematic for CONN2 pinouts.
TauLabs bootloader
Flashing cleanflight will erase the TauLabs bootloader, this is not a problem and can easily be restored using the st flashloader tool.
Serial Ports
Value | Identifier | RX | TX | Notes |
---|---|---|---|---|
1 | USB VCP | RX (USB) | TX (USB) | |
2 | USART1 | RX / PB7 | TX / PB6 | Conn1 / Flexi Port. |
3 | USART2 | RX / PA3 | PWM6 / PA2 | On RX is on INPUT header. Best port for Serial RX input |
4 | USART3 | RX / PB11 | TX / PB10 | RX/TX is on one end of the 6-pin header above the PWM outputs. |
USB VCP can be used at the same time as other serial ports (unlike Naze32).
All USART ports all support automatic hardware inversion which allows direct connection of serial rx receivers like the FrSky X4RSB - no external inverter needed.
Sonar Connections
Pin | Signal | Function | Resistor |
---|---|---|---|
PWM6 | PA2 | Trigger pin | 1K Ohm |
PWM7 | PB1 | Echo pin | 1K Ohm |
WARNING: Both PWM6 and PWM7 pins are NOT 5 volt tolerant, so a 1K Ohm resistor is required between the sensor and the FC pins.
Battery Monitoring Connections
Pin | Signal | Function |
---|---|---|
PWM9 | PA4 | Battery Voltage |
PWM8 | PA7 | Current Meter |
Voltage Monitoring
The Sparky has no battery divider cricuit, PWM9 has an inline 10k resistor which has to be factored into the resistor calculations. The divider circuit should eventally create a voltage between 0v and 3.3v (MAX) at the MCU input pin.
WARNING: Double check the output of your voltage divider using a voltmeter before connecting to the FC.
Example Circuit
For a 3Cell battery divider the following circuit works:
Battery (+) ---< R1 >--- PWM9 ---< R2 >--- Battery (-)
- R1 = 8k2 (Grey Red Red)
- R2 = 2k0 (Red Black Red)
This gives a 2.2k for an 11.2v battery. The vbat_scale
for this divider should be set around 52
.
Current Monitoring
Connect a current sensor to PWM8/PA7 that gives a range between 0v and 3.3v out (MAX).