Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
The RDDRONE-BMS772 may have test software or no software installed from the factory.
Review this manual to understand what is the latest software and how to update it. There may be more than one option:
PX4/NuttX target
NuttX target
S32K design studio project
Updated as we gain insight into specific applications
As we learn of specific needs for specific use cases they will be noted here:
PX4 BMS specification and working group discusses the need to provide 5V power to a drone before activating the actual battery power supply. The intent is to allow the host to identify the battery characteristics to avoid a catastrophic mismatch. Conceptually there is a need to supply 5V through the CAN /SBUS connectors to allow a host-side processor to power up and query the battery for compatibility with the drone. i.e. do not power up a 12S battery on a drone that only is designed for 3S or 4S
This functionality can be tested with the current revision of the board given a few jumper wires to the CAN/SBUS connectors. As built the +5V power is NC
Not clear if the battery can be asleep then woken up with a button press to supply power.
The 5V supply MAY only need to power a small MCU on the host side and not the complete host-side FMU. The small MCU could do the BMS query and then choose to power up the battery if in compliance.
May be a trend toward 4 LEDS to show battery gauge status visually. We have one RGB led which we intend to flash a sequence and color to show battery status
Extra LEDs could be added on the expansion header
The BMS itself doesn't regulate charging current or voltage, and needs a simple CC/CV charger. It can however balance it's own cells and disconnect the load. This situation could be improved by making a charger that talks with the battery over CAN and helps properly manage current and voltage, or even additional circuitry on board to manage this.
The RDDRONE-BMS772 integrates the following functions and features:
LiPo Battery from 3s to 6s, with stack voltage ranging from 6V to 26V
ambient temperature range from -20°C to 60°C
measures battery stack and cell voltages with an accuracy of +/-5mV, battery charge or discharge current up to 200A peak and 90A* DC with an accuracy of 1% for the complete chain and cell temperature with an accuracy of +/- 2°C (including AFE, PCB and NTC inaccuracies)
active cell balancing during charging
offers a deep sleep mode (for transportation and storage) with <80μA leakage current, as well as an automatic sleep mode with <200μA current consumption on the battery.
allows authentication of the battery
allows diagnostics to verify the safe operation of the battery
allows CAN, I²C and NFC communication
implements SWD and JTAG debugging interfaces, works with standard Segger J-Link and other debuggers
implements DCD-LZ combined debug and uart console interface for use with PX4 DroneCode and HoverGames platforms
Note: The 90A DC maximum current is obtained only when all MOSFETs and heatsinks are mounted. See Power MOSFETs and heatsinks.
The RDDRONE-BMS772 kit includes:
Assembled and tested reference design in anti-static bag
Unmounted cell balancing connectors for 3s, 4s and 6s
CAN Bus Termination Resistor (DRONE-CAN-TERM)
4-pin JST-GH to 4-pin JST-GH 300mm cable
Power input and power output connectors
Quick start guide
External thermistor with cable
Small display
RDDRONE-BMS772 for Mobile Robotics
Also have a look at some of the other NXP GitBooks:
The HoverGames
UCANS32K146 : CAN-FD / UAVCAN node
RDDRONE-T1ADAPT : T1 Ethernet Adapter
NXP Cup Car : Including MR-Buggy3 build guide
The RDDRONE-BMS772 is a standalone BMS Reference Design suitable for mobile robotics such as drones and rovers, supporting 3-6 cell batteries.
Other uses include portable electronics and equipment needing better battery management
eScooters, ebikes
high end power tools
portable medical devices (Pulse oximeter, portable pumps, electric portable refrigerator)
backup battery system
outdoor monitoring/measuring equipment
If you just received your board, and want to jump to how to configure the jumpers and connectors for your specific battery this is the URL to follow
If you like to read a document explaining everything about the BMS772, go to the public github page: https://github.com/NXPHoverGames/RDDRONE-BMS772 and download the BMS772_releaseNotes_*.pdf. This document contains all the information about the latest release. How to do things and a quick start guide.
It is an open hardware and software design and useful leverages components used in general purpose automotive and high-reliability industrial applications. The BCC device performs ADC conversion on the differential cell voltages and currents. It is capable of very accurate battery charge coulomb counting and battery temperature measurements.
The NXP MC33772 is a 6 cell BCC. If higher cell counts are required this could be redesigned to daisy chain multiple BCC chips or switch to a larger cell count BCC such as the MC33771. These parts are all automotive grade Li-Ion battery cell controller IC designed for automotive and industrial applications such as HEV, EV, ESS, UPS systems
The BMS772 also features an S32K146/144 automotive grade S32K Microcontroller. These are rugged M4 core processors part of a scalable family of AEC-Q100 qualified 32-bit Arm® Cortex®-M4F and Cortex-M0+ based MCUs
An NTAG5 Boost NFC NFC Forum-compliant I2C bridge is also onboard and appears as an NFC contactless tag to the external world, and interfaces internally in a simple manner similar to an EEPROM for easy secure query of status or setting of parameters using an external NFC device such as a cell phone. In a practical sense this allows an end user to check multitudes of batteries that may be in storage just by hovering their cell phone over them.
An A1007 is an enhanced version of A1006 secure authenticator IC which includes monotonic counters and secure flags. These can be used to prove the battery pack is genuine and has not been tampered with as well as securely count charge cycles, and permanently flag negative events such as over discharge. The Secure Authenticator IC is a secure tamper-resistant authentication IC, which offers a strong cryptographic solution intended to be used by device manufacturers to prove the authenticity of their genuine products
Finally, the BMS communicates with a host such as a Drone Flight Management Unit (FMU) through DRONECAN/CyphalCAN or I2C/SMBus.
The RDDRONE-BMS772 is a standalone BMS Reference Design suitable for mobile robotics such as drones and rovers, supporting 3-6 cell batteries. Other portable electronics and equipment, such as scooters, power tools, portable medical devices could also benefit from referencing this design. If higher cell counts are required this could be redesigned to daisy chain multiple BCC chips or switch to a larger cell count BCC.
The device performs ADC conversion on the differential cell voltages and currents. It is capable of very accurate battery charge coulomb counting and battery temperature measurements. Additionally, it communicates with a Flight Management Unit (FMU) through UAVCAN and/or an SMBus.
These boards have been designed and optimized for the operating conditions described below. Usage of these boards beyond these conditions can lead to malfunction and damage.
Description
Min
Max
Unit
Battery input voltage
6
26
V
Battery charge/discharge current at 25 °C (DC) [1]
-
90
A
Battery charge/discharge current at 25 °C (peak) [1]
-
200
A
Operating ambient temperature
-20
60
°C
[1] These values are valid for a 4 pairs of power MOSFETs and 4 heatsinks configuration. See Configuring the hardware for more information
The board features several NXP ICs:
MC33772: 6-Channel Li-Ion battery cell controller IC designed for automotive and industrial applications such as HEV, EV, ESS, UPS systems. The MC33772 allows ADC conversions on the differential cell voltages and currents as well as coulomb counting and temperature measurements. It features embedded balancing transistors and diagnostics to simplify applications. The device supports standard SPI and transformer isolated daisy chain communication (via MC33664) to an MCU for processing and control
S32K144: AEC-Q100 certified microcontroller for general purpose automotive applications. The S32K144 features an Arm® Cortex®- M4F core, 512 KB of Flash, CAN/CAN-FD controllers, security module complying with SHE specification and is offered in LQFP-48, LQFP-64, LQFP-100 and MAPBGA-100 packages supporting an ambient temperature range from -40°C up to 125°C
UJA1169: Mini high-speed CAN System Basis Chip (SBC) containing an ISO 11898-2:201x (upcoming merged ISO 11898-2/5/6) compliant HS-CAN transceiver and an integrated 5V or 3.3V 250 mA scalable supply (V1) for a microcontroller and/ or other loads. It also features a watchdog and a Serial Peripheral Interface (SPI). The UJA1169 can be operated in very low-current Standby and Sleep modes with bus and local wake-up capability
A1007: A1007 authentication IC is a secure solution built with many tamper resistant features and security countermeasures to deter common invasive and non-invasive attacks
NTAG5: NXP’s NTAG 5 boost shrinks the NFC footprint while adding AES security, so designers can deliver ultra-compact devices for use in IoT, consumer, and industrial applications
The main ICs featured are listed in the table below:
Label
Description
Reference
U1
Battery Cell Controller (BCC)
U2
Micro-Controller Unit (MCU)
U3
System Basis Chip (SBC)
U4
Authentication
A1007
U5
Near-Field Communication (NFC)
The following figure shows the location of the connectors on the board.
All connectors implemented on RDDRONE-BMS772 are detailed in the table below:
Label
Description
Manufacturer
Reference
Placed or DNP
JP1
Cell terminal connector
JST MFG. CO
SxB-XH-A(LF)(SN)
DNP
J1
External temperature sensor
JST MFG. CO
SM02B-GHS-TB(LF)(SN)
Populated
J2
JTAG debugger
-
E.g.: FTS-105-01-F-D from SAMTEC
Populated
J3
CAN bus
JST MFG. CO
SM04B-GHS-TB(LF)(SN)
Populated
J4
Battery power input
-
E.g.: FIT0588 from DFRobot
DNP
J5
Battery power output
-
E.g.: FIT0588 from DFRobot
DNP
J6
Reset jumper
FCI
68000-202HLF
Populated with jumper mounted
J18
SMBus (I²C slave bus)
JST MFG. CO
SM04B-GHS-TB(LF)(SN)
Populated
J19
DCD-LZ debugger
JST MFG. CO
SM07B-GHS-TB(LF)(SN)
Populated
J20
Additional CAN bus
JST MFG. CO
SM04B-GHS-TB(LF)(SN)
Populated
J21
MCU expansion header
HARWIN INC.
M50-3530842
DNP
J22
Wake jumper
FCI
68000-202HLF
DNP
J23
I²C master bus
FCI
68000-204HLF
Populated
Note: Hardware configuration of the board is done via 16 jumpers to solder (SJxx). See Cell terminal connection, Shunt resistor and External NFC antenna for more details.
The RDDRONE-BMS772 board can communicate with a host device such as a PX4 Flight Management Unit (FMU) using the SMBus bus (can also be used as a simple I²C bus, connector J18) or the UAVCAN bus (can also be used as a simple CAN bus, connectors J3 and J20).
Note: For further information about UAVCAN, look for enablement in PX4.io software.
There are two ways to program and debug the RDDRONE-BMS772 board:
through the DCD-LZ connector (J19)
through the JTAG connector (J2)
Note: The DCD-LZ combines a debug interface with a debug serial console. It is used on RDDRONE-FMUK66 (HoverGames). For more information see the HoverGames gitbook.
The RDDRONE-BMS772 implements a programmable RGB LED. Various color combination and blink patterns can be used to indicate the state of the battery and system.
The side button is a wake button, it connects the WAKE pin of the SBC to the ground when pressed. The J22 header placed in parallel of the side button can be used as an alternative if an extended or panel mount button is needed.
An external display could be used to display important (battery) information. This display can be connected to J23, the I²C master bus. This header could be supplied with 3.3V (D34) or 5V (D35, default populated). By switching the diode, 3.3V or 5V could be used.
Some recent versions of the board may include a small common 0.91 inch OLED display using SSD1306 controller.
These displays work at both 3.3V and 5V. Software has been prepared but requires connection to the 3.3V domain (D34)
Double check the pinout configuration as they occasionally differ. Most use 1-GND, 2-
VCC, 3-SCL, 4-SDA and will connect directly to header J23 without modification.
Example of 0.91 inch OLED display using SSD1306 I2C display controller
An optional external temperature sensor can be added onto the RDDRONE-BMS772 board using connector J1. An example of application for this external sensor can be to monitor the cells temperature inside the battery pack.
Some components are included in the design but are not mounted on the RDDRONEBMS772 original board. They are marked "DNP" on the schematics and the BOM. The following table is giving the list of additional components that can be implemented in the design as well as their use:
Feature
Description
Label
Additional MOSFETs
Q3, Q4, Q7, Q8
Heatsinks
In order to dissipate more power, four additional heat-sinks can be mounted: two on the top side and two on the bottom side of the board. Recommended part is FK 244 08 D2 PAK
HS1, HS2, HS3, HS4
Optional termination resistor network on CAN bus
One 60.4 Ω resistor on each CAN line connected to a 4700 pF capacitor wired to the ground
R49, R50, C66
Capacitors on cell measurements connections
A filter can be added to the cell voltage measurements connections, according to the number of cells in use
C6, C12, C18, C22, C26, C29, C34
Capacitors on external temperature sensor
If the external temperature sensor is implemented, two capacitors can be added on the external temperature sensor low pass filter for more EMC demanding applications
C49, C54
Capacitor on cell balancing connections
Capacitors can be added on the cell balancing circuit for EMC, according to the number of cell in use
C99, C100, C101, C102, C103, C104, C105, C106, C107
External NFC antenna
Coil as an alternative option for the PCB NFC antenna for extended range operations
L2
Resistor on gate driver RS pin
Resistor to link RS pin on gate driver to MCU
R99
MCU expansion header
Additional MCU pins are wired to a 1x8 header slot. Potential to use additional battery level LEDs, emergency button, etc.
J21
Wake jumper
Jumper for SBC wake-up. In parallel of the button
J22
The following figure shows the location of the test points on the board.
Label
Signal name
Description
TP1
OVERCURRENT
Overcurrent signal
TP2
AUTH_NFC_SCL
Authentication and NFC I²C bus clock signal
TP3
AUTH_NFC_SDA
Authentication and NFC I²C bus data signal
TP4
VCC_3V3_SBC
SBC 3.3 V regulator output
TP5
RST_N
Reset signal (active low)
TP6
CAN_LO
CAN Low signal
TP7
CAN_HI
CAN High signal
TP8
VCC_3V3_LDO1
LDO 3.3 V regulator output
TP9
SMBUS_SCL
SMBus I²C bus clock signal
TP10
SMBUS_SDA
SMBus I²C bus data signal
TP11
VBAT_IN
Power input
TP12
VBAT_OUT
Power output
TP13
GND
Ground reference of the device
TP14
N/A
Power switches gate command
TP16
BCC_MISO
BCC SPI MISO line
TP17
BCC_CS
BCC SPI chip select
TP18
BCC_SCLK
BCC SPI clock signal
TP19
BCC_MOSI
BCC SPI MOSI line
TP20
SBC_CS
SBC SPI chip select
TP21
SBC_MISO
SBC SPI MISO line
TP22
SBC_MOSI
SBC SPI MOSI line
TP23
SBC_SCLK
SBC SPI clock signal
TP24
VCC_HARVEST
The VOUT pin of the NTAG (voltage harvest)
TP25
N/A
Connected to J18[1] of SMBus connector
The following part of the schematic is copied here to assist users with wiring cell terminal connections based on custom battery packs. Typically hobby style LiPo Batteries are already wired correctly and will be plug and play. The key item to note is the JP1 pin 7 is the negative most CT on the battery pack. The next pin up JP1 Pin6 will be one cell voltage higher than JP7. Similarly Pin 5 will be one votage higher thatn Pin 6. This continues until the end of the cell count depending on how many cells you have configured the BMS for on the previous page,
This page will provide all the information needed to flash the BMS
Download J-Link Software and Documentation Pack
J-Link Commander is used to flash binaries onto the RDDRONE-BMS772 board. The latest (stable) release of the J-Link Software and Documentation Pack is available at the SEGGER website for different operating systems.
The software can only be written to the board using a debugger. The HoverGames drone kit includes a J-Link EDU Mini debugger. To use it, you need to install the J-Link Software Pack.
The debugger can be plugged into the BMS using a small adapter board. This small PCB comes with a 3D printed case that can easily be put together. The J-Link debugger can be connected using an SWD cable. The connectors have to be oriented such that the wires directly go to the side of the board, as shown in the picture below.
While you do not need it right now, the adapter board also has a 6-pin connector for a USB-TTL-3V3 cable, which you can use to access the system console (CLI) of the BMS. The 3D printed case has a small notch on one side of the connector. The USB-TTL-3V3 cable needs to be plugged in such that the black (ground) wire is on the same side as this notch in the case. Make sure the cables are plugged in as shown in the picture below. Connect the 7-pin JST GH to the programming header of the BMS, J19.
A guide for flashing firmware to this board is outlined in one of our consolidated GitBooks for flashing a multitude of NXP hardware. The link to this GitBook is below. https://nxp.gitbook.io/mobilerobotics/software/flashing
Once you're done flashing your board, you may continue to the Accessories and tools for development tutorial.
For disambiguation:
"Power in" (J4) is where your physical battery will connect.
Individual balancing leads will connect to JP1 "Cell Terminal"
The BMS board and Physical battery connected together can now be considered a "smart battery with BMS"
"Power out J5 represents the connection of your "smart battery with BMS" to the outside world.
The board is organized as shown in the figures below:
Introduction to the nuttx sofware example of the BMS
The example starter software provided with the BMS uses the NuttX RTOS (real-time operating system ) for microcontrollers. NuttX RTOS has an emphasis on being standards compliance and small footprint. Scalable from 8-bit to 32-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. The POSIX compliance on embedded devices is what makes it attractive particularly to developers that are used to programming in a Linux environment. The NuttX code repository can be found here: https://github.com/NXPHoverGames/RDDRONE-BMS772 Please follow the step by step instructions in the github readme.md in order to get started with this code. We will update it and provide clarifications there as needed.
Currently the RDDRONE-BMS772 is supported in the Model-Based Design Toolbox (MBDT) for Matlab/Simulink. See https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/Example-Model-RDDRONE-BMS772/ta-p/1550394.
This software Guide applies for bms version 6.0-11.0
SOFTWARE provided is for reference only and should not be considered production ready or used in an end product as-is. It is expressly for the purpose of further development, research and validation by experienced people. Overcharging, undercharging or abusing batteries is dangerous and must be monitored carefully in a safe environment.
This example software was prepared in part as an intern's senior project under the supervision of NXP engineers.
If the application requires more power, two pairs of back to back MOSFETs can be added on the bottom side of the board. Corresponding part is PSMNR70-30YLH. See
Before first start-up, make sure the board is configured properly:
The board MUST be configured, connectors and solder jumpers need to be soldered and installed to match your exact battery cell count
It is advised to test the if everything is correct before hooking up a battery. You could mimic a battery with a power supply and resistors as cells.
Solder your power in and power out connectors or wires on the J4 and J5 footprints
Solder the correct cell terminal connector at the JP1 location. Ensure it is correctly positioned and aligned
Configure the board for your application by soldering the corresponding SJxx connectors
Configure the board with additional and/or optional components as described in Configuring the hardware to fit the application requirements
Power the board
Make sure you have the latest software (latest version is 6.0)
Configure the SW correctly, see First Time software configuration of the BMS
Once the board is configured properly (see Configuring the hardware for more details about configuration), it is time to connect the board.
To power on the RDDRONE-BMS772 board, *first* connect the battery to the power input connector (J4) and then the cell terminal connector (JP1). This protects the boards form internal damage due to hot plugging.
Similarly, to disconnect the battery from the board, the cell terminal connector (JP1) should be disconnected first. Then the power input (J4) can be disconnected.
The software example being developed for the RDDRONE-BMS772 board will use a NuttX Real-Time Operating System (RTOS).
Note: NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 32-bit microcontroller environments, the primary governing standards in NuttX are Posix and ANSI standards.
Lithium and other batteries are dangerous and must be treated with care.
Lithium and other batteries are dangerous and must be treated with care.
Rechargeable Lithium Ion batteries are potentially hazardous and can present a serious FIRE HAZARD if damaged, defective or improperly used. Larger Lithium batteries and those used for industrial use involving high discharge current and frequent full discharge cycles require special precautions. Do not connect this BMS to a lithium ion battery without expertise and training in handling and use of batteries of this type.
Use appropriate test equipment and safety protocols during development.
NXP has battery emulators that may be used during testing: https://www.nxp.com/design/development-boards/analog-toolbox/6-cell-battery-pack-to-supply-mc33772-evbs:BATT-6EMULATOR
NXP provides the enclosed product(s) under the following conditions:
This reference design is intended for use of ENGINEERING DEVELOPMENT OR EVALUATION PURPOSES ONLY. It is provided as a sample IC pre-soldered to a printed circuit board to make it easier to access inputs, outputs, and supply terminals. This reference design may be used with any development system or other source of I/O signals by simply connecting it to the host MCU or computer board via off-the-shelf cables. Final device in an application will be heavily dependent on proper printed circuit board layout and heat sinking design as well as attention to supply filtering, transient suppression, and I/O signal quality.
The goods provided may not be complete in terms of required design, marketing, and or manufacturing related protective considerations, including product safety measures typically found in the end product incorporating the goods.
Due to the open construction of the product, it is the user's responsibility to take any and all appropriate precautions with regard to electrostatic discharge. In order to minimize risks associated with the customers applications, adequate design and operating safeguards must be provided by the customer to minimize inherent or procedural hazards. For any safety concerns, contact NXP sales and technical support services. Should this reference design not meet the specifications indicated in the kit, it may be returned within 30 days from the date of delivery and will be replaced by a new kit.
NXP reserves the right to make changes without further notice to any products herein. NXP makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does NXP assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages.
Typical parameters can and do vary in different applications and actual performance may vary over time. All operating parameters, including Typical, must be validated for each customer application by customer’s technical experts.
NXP does not convey any license under its patent rights nor the rights of others. NXP products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the NXP product could create a situation where personal injury or death may occur. Should the Buyer purchase or use NXP products for any such unintended or unauthorized application, the Buyer shall indemnify and hold NXP and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges NXP was negligent regarding the design or manufacture of the part.
To use this BMS772 kit, you will need:
LiPo battery pack
3S to 6S with cell balancing connector - Voltage range of 6V to 26V
Suitable charger for the type of battery
Soldering iron to configure the board
External Thermistor temperature sensor with cable and JST-GH 2-pin connector (optional)
Debugger:
Segger J-Link Mini debugger
PEMicro universal multilink
or other suitable JTAG/SWD debugger
Note: The HoverGames Drone Kit (KIT-HGDRONEK66) and/or FMU Kit (RDDRONE-FMUK66) both include a DCD-LZ adapter and Segger J-Link Mini EDU and an FTDI USBUART-3v3 cable.
By using the DCD-LZ interface and USBUART cable you will also gain access to the command line interface (CLI) of the board.
S32 Design Studio for ARM-based MCUs (recommended)
Alternatively : PX4 or NuttX build environment depending on what code source is used.
PX4/NuttX board target example code (optional, see Software guide)
Note: The RDDRONE-BMS772 board allows to open the charge circuit when the battery is overcharging , to perform cell balancing and to monitor all cell voltages. Therefore the charger does not need to have a cell terminal connector.
This page will tell you how to get more info on DroneCAN
The DroneCAN documentation for this board can be found in the release notes version 6: https://github.com/NXPHoverGames/RDDRONE-BMS772/blob/main/BMS772_releaseNotes_6.0.pdf Be sure to download this to get the full PDF. See:
Chapter 8.4: How to use the DroneCAN interface
Chapter 8.4.1 How to set up the DroneCAN GUI tool and start dynamic node ID allocation
Chapter 8.4.2 How to use the DroneCAN GUI tool to configure the BMS
Chapter 8.4.3 How to use the DroneCAN GUI tool to monitor the DroneCAN messages
Chapter 11.5.8.1 DroneCAN messages implemented
This page will describe how to get the CyphalCAN BMS messages with the UCAN board
Connect the CypahlCAN device (like the RDDRONE-UCANS32K146) to the BMS using JST GH 4 pin connectors with 1 on 1 wires. End the CAN bus with a 120Ω terminator resistor between CAN high and CAN low.
Connect the UCAN board with a USB-TTL-3V3 cable to the laptop.
Install the can utils with the following terminal command:
sudo apt install can-utils
Install python 3.7 with the following terminal command:
sudo apt install python3.7
Install pyuavcan with the following terminal command:
python3.7 -m pip install pyuavcan
Start the deamon on UART <-> SLCAN to use SLCAN0 use the command (for ttyUSB1):
sudo slcand -o -s8 -t sw -S 115200 /dev/ttyUSB1
Keep in mind that in this case the UART of the UCAN board needs to be connected to ttyUSB1. You can check which USB it is by disconnecting the USB-TTL-3V3 cable connected to the UCAN board, write “ls /dev” in the terminal, connect the USB cable and write “ls /dev” again. Only the USB of the UCAN board should be added in the list. If not check if the USB connection of your virtual machine is passed through.
Enable the interface (up)(same as ifup can0 in nuttx) write the following command:
sudo ip link set up slcan0
Clone the cannode v1 tools:
Make sure the sub modules are in the git repository write the following command in the cannode-v1_tools directory:
git submodule update --init
Find this line in print_bmsstatus_topic.py:
media = pyuavcan.transport.can.media.socketcan.SocketCANMedia('can0', mtu=8)
Change it to the right can device, for example:
media = pyuavcan.transport.can.media.socketcan.SocketCANMedia('slcan0', mtu=8)
Run the pyuavcan tool by typing the following in a terminal where the print_bmsstatus_topic.py file is located:
python3.7 print_bmsstatus_topic
Keep in mind that the BMS needs to be configured correctly, see the CyphalCAN chapter of the SOFTWARE GUIDE - NUTTX.
This page will tell you how to use the CLI of the BMS
To use the command line interface, connect the debugger to the BMS using the 7-pin JST-GH connector from the debug adapter board to J19 and plug the USB coming from the debugger converter board into your computer. Open a UART terminal like minicom on a Linux machine or PuTTY or Tera Term for a windows machine.
Type “bms help” to get the help for the CLI. The CLI works only with lowercase commands.
The settings are:
115200 Baud
8 data bits
1 stop bit
This page will explain some start-up messages, what to do when first using the BMS
When first starting the BMS with the latest software the command line interface could look like the code snipping at the end of the page.
You can see that the version number is: bms6.0-11.0. this comes after "BMS version: ". Than it will begin doing self-tests.
START means it will start testing that part or component
PASS means that the test succeeded
FAIL means the test did not succeed
Be sure to check the error messages as it could help finding out what is wrong, some errors explain why it went wrong and how you could fix it. It could be that you will get these messages:
These messages mean that the CRC of the saved data (the parameters) in flash doesn't match. This could happen when nothing is saved or when a new program is flashed in the microcontroller (and thus cleared the flash). Than it could be that you get the message "NVMS registers don't have the right value!". This means a register in the SBC needs to be written, but before this could take effect, it needs to restart the SBC, "Restarting!" is stated when it does this. Since the SBC supplies the microcontroller with its power, the microcontroller will restart as well.
It could be that you get the message that the stackvoltage is too different from sum of cells, so there is a wrong n_cells number. This means that the actual connected cells are different than the entered number of cells (n-cells). To fix this, check what the current n-cells value is with "bms get n-cells" and make sure it corresponds with the number of cells in the attached battery. To configure the correct number of cells type "bms set n-cells x" where x the number of cells of the battery, that can be 3-6. After that type "bms reset" or press the button to reset the fault. In version 3.4 there is something wrong, n_cells should be n-cells.
You will get a warning if the battery temperature sensor is not enabled, "WARNING: battery temperature sensor is disabled!". To enable the battery temperature sensor see How to enable the battery temperature sensor.
If you see the text that the BCC overvoltage set to <number>mV. That number should be slightly higher than the actual set cell-ov in the software. This is because the overvoltage threshold register of the BCC is an 8-bit register, compared to the floating point variable in the software this has a lot less resolution. The value in the BCC is set slightly higher to not falsely trigger on it, but have it as a backup trigger since the software will react on the overvoltage as well with the measured cell voltage.
It could be that you see the following line: "NOTICE: Disabling 5V regulator (CAN transceiver) briefly!". This happens when the SBC needs to switch modes, because it can only be done in the standby mode where the 5V regulator is disabled.
"BMS main loop!" means the BMS has entered the main loop and will continue according to the main state diagram.
Each time the BMS enters a new mode, it will output this with "<mode> mode"
Here we see the output for version 4. but it should still be similar.
This page will describe how to use the CLI
To view the help of the commands of the bms, type "bms help" in the terminal (CLI). Than you will see this window:
When you type "bms help parameters", you will get a list with all the parameters with its unit, if it is Read Only (RO) or Read Write (RW) and what the data type is it. These are useful parameter properties that help with filling in parameters correctly.
The "bms help show-meas" command shows you which parameters you can view in cyclically in the CLI when the measurement happens. These commands should be used with the "bms show". To show them all, use "bms show all 1". if you want the measurements to be outlined and updated at the top of your terminal, use "bms show top 1". Keep in mind that if this is active, it could be that typed in characters disappear in this update.
The BMS uses VT100 escape sequences to update the terminal. In order to see this, make sure your terminal emulation program (like PuTTY or minicom) has VT100 mode enabled.
To get a single parameter value, you could use the bms get command. If for example you would like to get the state of charge, type "bms get s-charge" in the terminal. It will provide you with the value and its unit. If you want to check a lot of parameters, use the "bms get all" command, this will give you the full list of parameters, with the value and its unit. When you wish to load the parameters from flash, type "bms load".
To adjust parameter values, you need to use the bms set command. If for example you would like to set the number of cells to 4, you need to enter the following command: "bms set n-cells 4". To make sure parameters are saved to flash, type "bms save". If you would like to set the default parameters, type "bms default".
To get out of the FAULT_* state the BMS needs to reset the fault, type "bms reset". To get in the SLEEP state (if you are able to enter it), type "bms sleep". To wake-up from the sleep state, type "bms wake". To go to the DEEP_SLEEP state, type "bms deepsleep", it could be that it first self-discharges.
This page will give more information about the display
The display shows all kinds of battery information presented on an optional local I2C LCD display (e.g. SSD1306 type). The display should be connected to J23.
Both 3.3V and 5V are supported for the display. You can change the display voltage. For example to enable 3.3V on the display connector J23, make sure D34 is placed and D35 is not placed! If the diode D35 is placed, move the diode placed on D35 and place it on D34.
There is a framebuffer which makes sure the data is transferred to the display. Information like SoC, SoH, output status, BMS mode, battery voltage, average current, temperature and ID can be seen on the display.
This page will explain which temperature sensor you need and how to enable it.
By default the temperature sensor is not enabled. To configure the temperature sensor to be used, this temperature sensor need to be connected to J1 using a 2-pin JST-GH connector. The maximum length of the cable that leads to the temperature sensor is 20cm. This temperature sensor needs to be a 10k NTC, like the NTCLE100E3103JB0 from Vishay. With the CLI type:
“bms set sensor-enable 1”.
this will enable the temperature sensor measurement to be done together with the rest of the measurements in the BMS software.
This page will show the designed state machine and the description of the states from this state machine.
In Figure 2 the main state machine that will be implemented in the BMS can be found. This state diagram will be implemented in the BMS main loop.
The SELF TEST state is entered at power-up of the microcontroller. In this state the microcontroller initializes everything and performs the self-test, for example check if communication with a component is possible or check if the set output can be read. If everything is OK, it will go to the INIT state. If a watchdog reset has occurred not every self-test will be done to make sure the power is not turned off. The LED will be solid red in this state.
The INIT state is typically entered from the SLEEP state. In this state the microcontroller unit (MCU) will wake up and it will verify configurations, fault registers and functions. This is needed because it can enter the INIT state when the user resets from a fault in one of the FAULT states as well. When everything is OK, it will close the power switch if not already closed and proceed to the next state depending on the current direction. The LED will be steady green in this state.
This is the state where the battery operates how it should be, it is being discharged by the connected device, for example a drone. Meaning that the power switches are closed. The LED will be blinking green to indicate the state of charge. In this state the BMS performs the following tasks:
Battery voltage, cell voltage and current is measured and calculated every measurement cycle.
SoC and SoH are estimated every measurement cycle.
The DroneCAN/CyphalCAN BMS battery status will be send over the CAN bus every measurement cycle.
The user can read the BMS status and parameters with NFC and the CLI. The user may change the state to SLEEP.
A timer will monitor if the current is below the sleep current for more than the timeout period. If this happens, it will go to the SLEEP state.
It will monitor if the current flows in the battery and if the current is more than the sleep current for more than the charge detect time, the state will change to the CHARGE state.
If the current is less than the sleep current while the button is pressed for 5 seconds, it will transition to the SELF DISCHARGE state.
During this state the same functions as in the NORMAL state are implemented. The charging of the battery is done in different stages and is reflected in the charging state diagram in Figure 3. These are the states and their description:
CHARGE START: in this state the charging will begin, and a timer will start. The LED will be blue to indicate charging. After a set time (default 120sec) or if the voltage of one of the cells reaches the cell overvoltage level (to make sure there is no cell overvoltage error) the state will change to CHARGE WITH CB.
CHARGE WITH CB: in this state the cell balancing (CB) function will be activated. This function will calculate the estimated cell balance minutes per cell, which is based on the cell voltages, the difference compared to the lowest cell voltage, the balance resistor and the OCV-slope. The formula to calculate this estimated balance time is: Estimated balance minutes = (Vcell - Vcell_min ) * Rbal / (Vcell * ocvslope) Other than this calculated time, the BMS will check if the voltage of a cell that is being balanced, has reached the desired voltage as well. When the voltage of one of the cells reaches the cell overvoltage level or the charging current is less than the charge complete current, it will go to the RELAXATION state. The LED will stay blue and will blink if cell balancing is active. Balancing is finished if all the calculated cell balance minutes are expired or it has reached the lowest cell voltage.
RELAXATION: in this state the power switches are set open, disconnecting the charger from the battery. The MCU will be put in a very low power run (VLPR) mode (BMS application STANDBY mode), SBC in standby mode and the BCC to measure only at 10Hz. This will reduce the power in this state. The battery will relax for the specified relax time (default 300 sec). During this relaxing, the cells can still be balanced since this happens with a low balancing current. At the end of the relaxation period, the system will check whether the balancing is done. If balancing is not finished, the BMS will re-estimate the balance minutes. If balancing is finished and the highest cell voltage is lower than the cell overvoltage minus the voltage margin, it will return to the CHARGE WITH CB state to continue the charge process. If the highest cell is within this margin, the charging is complete, and it will go to the CHARGE COMPLETE state. To make sure it won’t endlessly go through this cycle with the CHARGE WITH CB state (this can happen if the end of charge current is met but the voltage requirement is not met), after 5 times it will just not check if the highest cell voltage is within this margin and will go to the CHARGE COMPLETE state
CHARGE COMPLETE: in this state, the charging is done, and the LED will be steady green. If the lowest cell voltage decreases again below the cell overvoltage minus the recharge voltage margin, it will go to the CHARGE WITH CB state again. The power switches will remain open and if the charger is disconnected it will go to the SLEEP state after the defined period of time.
If at any time the current flows from the battery to the output and this current is higher than the sleep current, the BMS transitions to the NORMAL mode. If a charger is disconnected, the state will transition to the SLEEP state. If the go to deep sleep command has been given or the button is pressed for five seconds there are two options: If one cell voltage is less than the storage voltage it will complete charging until each cell has reached the storage voltage, after this is done the BMS will transition to the SELF DISCHARGE state and this will then transition to the DEEP SLEEP state. The other option is that no cell voltage is less than the storage voltage, than the BMS will transition to the SELF DISCHARGE state.
The sleep state is typically entered when the current is very low for an amount of time. This SLEEP state is used to preserve power. The MCU will be put in VLPR mode, the SBC in standby mode, the BCC in sleep mode with measurement on to check for a sleep overcurrent and other faults. This is the BMS application VLPR mode. The power switches will be closed to make sure the battery could be used. If any threshold is met during a cyclic measurement or the button is pressed, it will wake the MCU and the BMS will transition to the INIT state to check status. If the button is pressed for five seconds, the state will change to the SELF DISCHARGE state, in order to go to the DEEP SLEEP state. If the t-sleep-timeout happens the BMS will go to the SELF DISCHARGE state and will discharge the battery to storage level. After this it will go to the DEEP SLEEP state. In this state the LED will be off.
The OCV state will allow to record the latest open cell voltage (OCV) of the battery which is used in the state of charge (SoC) computation. Cyclically the Battery will enter this mode when the Battery stays in the SLEEP state. The period the system will go from the SLEEP state to the OCV state will depend on the time since the battery has entered the SLEEP state in the first place, without going to another state except the OCV state. The time to enter the OCV state will gradually increase each time with 50% from the set begin time until the set end time is reached. If for example the set begin time is five minutes and the set end time is twenty-four hours, it will take fifteen times to have a period of is twenty-four hours. When entering this mode, the MCU will wake up the AFE and measure. After it has calibrated the SoC, it will go to the SLEEP state again. The LED will blink green in the OCV state.
The FAULT_ON state is entered when a critical fault has been detected (over-current, over-voltage, cell over-temperature) and requires evaluating if the battery needs to disable the output power. In this state the power will remain ON. With the flight-mode-enable and the i-flight-mode parameter, the user can make sure that the battery will not be disconnected from the power out connector and the BMS will stay in this state. If the s-in-flight parameter is high, it will stay in this state and not disconnect the power. Except, when the i-peak-max threshold is reached.
The s-in-flight parameter is high if the i-batt-avg (1s) is higher than i-flight-mode and the i-batt-avg (1s) is less than the i-out-max AND the flight-mode-enable is high.
The s-in-flight will be low again when: the i-batt-10s-avg is lower than the i-flight-mode and the i-batt-avg (1s) is less than the i-flight-mode. OR s-in-flight will be low when the flight-mode-enable is set to 0 OR when there is a i-batt-avg (1s) charge current higher than the i-sleep-oc ((1s_current_avg - i-sleep-oc) > 0). If the BMS is in the FAULT_ON state and s-in-flight will become false, it will go to the FAULT_OFF state.
If the BMS needs to turn off the power, it will go to the FAULT_OFF mode. Other ways to exit this FAULT_ON state is that the user can manually force the BMS to go to the INIT state via the reset fault command with the CLI or by activating the push button. If there is an undervoltage fault, it could transition to the DEEP SLEEP state after the t-fault-timeout time. In this state the LED will be solid RED to indicate the power is still on.
The FAULT_OFF state is entered when there is a fault and it needs to turn off the output power. In this state the power will be turned OFF. Usually, this state is entered because in the FAULT_ON state it noticed that it needs to turn off the power. It will go directly in the FAULT_OFF state if the emergency button is used and this button is active or if a hardware overcurrent is detected. To exit this FAULT_OFF state is that the user can manually force the BMS to go to the INIT state via the reset fault command with the CLI or by activating the push button. If there is an undervoltage fault, it could transition to the DEEP SLEEP state after the t-fault-timeout time. In this state the LED will be blinking RED to indicate the power is off.
This state is used to discharge the cells to the cell storage voltage in order to improve its life duration, when storing the battery for long time. In this mode, the power switches are open, the MCU is powered and the balancing functions are activated. When the storage voltage is reached for each cell or if cells have a lower voltage, it will transition to the DEEP SLEEP state. CAN communication is disabled. To get a better SoC estimation, the OCV is measured and this will update the SoC measurement of the battery. To exit this state and to go back to the INIT state, the button needs to be pressed. The LED will blink blue in this state
This state is used for transportation and storage. In this state, the power switches are open, disconnecting the battery, all protections are turned off, there are no cyclic measurements done, the LED is off, and it will set everything to sleep or off to ensure the lowest power usage (<100uA). Only the button can wake everything in this state. When the button is pressed, it will transition to the SELF_TEST state. When entering this mode, the MCU will check if at least one configuration parameter has changed. If configuration parameters have changed, it will save the parameters to flash to make sure they are loaded at startup. The LED will be white for 1 second before going off for the rest of the time in this state.
This page will describe the software block diagram of the nuttx example
Figure 1 the software block diagram can be found. The BMS application consists of several tasks that run semi parallel (since it is still a single core processor). These tasks use functions from software components. The NuttX RTOS will take care of switching between tasks. The CLI part is called by calling the BMS application from the nuttshell interface with commands. The nuttshell is the serial (or UART) communication to the NuttX RTOS and can be used to communicate with the BMS application. The explanation of the blocks can be found in below in Component description.
The command line interface (CLI) component takes care of communication with the user through the NuttX nutshell, it can be used during debugging of the smart battery application or a specific battery under test. The communication is mapped to use a universal asynchronous receiver-transmitter (UART) also known as the root console. The CLI can output messages in colors if the ANSI escape sequences are enabled in the terminal.
The application command may be followed by optional arguments such as:
· sleep
· deepsleep
· wake
· reset
· help
· show
· set
· get
With the set or get command the user can read and write every value, including the configuration parameter list. These values can be read/written by calling the BMS application followed by a set or get command followed by the name of the variable. In the case of a set command this would instead be followed by the new value of the variable. Try the command “bms help” to see the help of the CLI. For more information on using the parameters, see chapter https://app.gitbook.com/o/-L9GLsni4p7csCR7QCJ8/s/4sYITYOw8lqjlbpxfe9d/~/changes/1/software-guide-nuttx/untitled-1
There can only be one of these two CAN components active at the same time, either the DroneCAN component or the CyphalCAN component. This can be set via the parameter “can-mode”. After setting this, do a “bms save” and a “reboot” to apply the change.
The DroneCAN module manages the DroneCAN communication as the name already suggested. There are 2 parts of this communication, the synchronous and the asynchronous communication. For that reason, there is a task running to take care of both communications.
The synchronous communication is the updates of the different battery information messages. This is done with a certain update rate, depending on the message. If the BMS measurement interval is more than 1 second, it will influence this as well. These messages can then be sent regularly to the DroneCAN bus. Other devices connected to this bus can then read the messages, these devices could for example be an FMU/VMU for a drone or rover or other devices. This update with new data gets triggered via the updater task.
The asynchronous communication is when another DroneCAN device on the DroneCAN bus is requesting data. This can be battery data or a BMS parameter. Or another DroneCAN device would like to change a parameter of the BMS. When this happens, it is not triggered by the updater task, but the DroneCAN task will take care of this.
For the CAN communication, it will use the CAN PHY in the SBC (UJA1169).
If configured corrected, you could see the battery information in PX4, ArduPilot or QGroundControl.
CyphalCAN is supported as well, please see chapter "CyphalCAN".
The LED state module can be used to control the RGB LED. It can set an RGB color on or off and blink the LEDs at given intervals. If a LED needs to blink a blinker task will be used to ensure it blinks. This module is used to inform the user visually of various states and status.
This part is used implement the LED states given below
State
LED state
Self-test
Red
Deep sleep
Off (after 1 second white LED on)
Sleep
Off
Wake-up
Green
Normal
Green blinking (with state indication)
1 blink 0-40%
2 blinks 40-60%
3 blinks 60-80%
4 blinks 80-100%
Fault_on (output power on)
Red
Fault_off (output power off)
Red blinking
Charging
Blue
Charging done
Green
Balancing/self-discharge
Blue blinking
Charger connected at startup
Red-blue blinking
SMBus is an alternative way to communicate BMS information to a host device that has I2C, like an FMU/VMU. The BMS could be seen as an I2C peripheral device. Reading from specified BMS I2C registers allows the device to read BMS data. Data like voltages, temperatures, state of charge, average current could all be read from these registers. The SMBus needs to be enabled with the variable “smbus-enable” to work.
The NFC module manages NFC communication. NFC communication can be used to read all kind of battery parameters. Via NFC a device should be able to read the values with a refresh rate of once a second. The updater task will be used to update the data in the NTAG5 NFC device. It can operate in a similar manner to a double ported EEPROM, and NFC records can include standardized messages for HTTP or text records. In this way the NFC tag could be updated regularly with status information. That information could be added to text message, and for example a smartphone would be capable of reading the message with data attached, this is done with minimal coding effort. This method removes the need for any custom software on the reading device.
The authentication module will take care of the authentication using the A1007 chip. The A1007 is capable of secure asymmetric key exchange and storage as well as secure monotonic counters and flags for use in such things as counting charge or discharge cycles or permanently flagging under-voltage or over-temperature conditions.
This component is not implemented yet. Only IC presence verification via I2C is implemented.
The display module manages information presented on an optional local I2C LCD display (e.g. SSD1306 type). The display should be connected to J23. Both 3.3V and 5V are supported in the software. There is a framebuffer which makes sure the data is transferred to the display. Information like SoC, SoH, output status, BMS mode, battery voltage, average current, temperature and ID can be found on the display. This makes sure the user can easily see the battery information it needs.
The power component is used to control the MCU power modes. There are 3 BMS application power modes that are made which each mode for its own purpose.
RUN mode
RUN mode
In this mode, the MCU power mode is set to RUN mode. The MCU will run on an 80MHz clock. All needed peripherals are enabled.
This is the usual mode of the MCU.
STANDBY mode
In this mode, the MCU power mode is set to (Very Low Power Run) VLPR mode. The MCU will run on an 2MHz clock. At this low clock speed, the BMS is saving a lot of power.
Both SPI modules and the serial interface (CLI) is active to still have communication with the BCC, SBC for the WD and potentially a user.
This mode is a lot slower, but it saves a lot of power while still maintaining a connection to be able to measure as well.
One use case of this mode is during the CHARGE-RELAXATION state. You need to monitor the voltages, but this does not need to be a fast loop as the power to the charger is disconnected and thus you make sure the cells are not drained as much as in the RUN mode.
VLPR mode
In this mode, the MCU power mode is set to (Very Low Power Run) VLPR mode. The MCU will run on an 2MHz clock. At this low clock speed, the BMS is saving a lot of power.
Only the SBC SPI module and the serial interface (CLI) is active to still have communication with the SBC for the WD and potentially a user.
This mode is a lot slower, but it saves the most power. There is no monitoring of the battery. The MCU relies on an GPIO interrupt pin from the BCC for waking up.
One use case of this mode is during the SLEEP state. No power is drawn, and you want to drain the battery as little as possible, while still reacting on a use command to for example configure the BMS. If current is drawn, the mode will change to NORMAL or CHARGE and the MCU mode will change as well.
The SBC module manages the power of the voltage regulators in the SBC. With this module the SBC can be set in normal mode, standby mode and sleep mode. In the normal mode both V1 (powers the MCU and more “VCC_3V3_SBC”) and V2 (powers internal CAN PHY and 5V “VCC_5V_SBC”) are powered. In standby mode, V2 is off and in sleep mode both regulators V1 and V2 are off. The sleep mode is needed for the DEEP SLEEP state. The SBC provides an external watchdog as well. The main loop will “kick” (reset) the watchdog at the end of the loop.
The Bat management (battery management) part is the most important part, it will oversee the whole battery management. It will be used to monitor the battery, the PCB (temperatures) and calculate voltages, temperatures, current, SoC, SoH, average power and more. It will ensure the BCC chip (MC33772B) reacts if thresholds are exceeded. Functions of this part can be used to drive the gate driver IC, which allows it to disconnect or connect the battery from the BMS output power connector. Because this is such a large part of the system, the Bat management part has its own tasks. This task can not only utilize the functions in the batmanagement component, but has a configuration component to configure the BCC, a monitoring component to monitor the battery data and a balancing component to take care of balancing. All these components can access the BCC libraries. These libraries can access the NuttX drivers like the timers and the GPIO (reset BCC pin).
The batManag task will oversee the measurements and if triggered, it will do the calculations, check for errors, check for transition currents and handle the cell balancing / self-discharge. In the SW, the measured battery data and calculated battery data is put in two structs. It will save the newly made battery data and calculation data structs in the data part and trigger the updater task that there is new data available.
Since different parts need to use the same data, a data library is made to take care of this. This library will make sure it is protected against usage at the “same” time by multiple tasks. If you set a parameter, it will make sure the system will act on it.
Because the RDDRONE-BMS772 board aims to be adaptable for many different battery types, the power connectors are not mounted on the PCB. This allows the user to configure the board with the connectors they choose, or solder battery wires directly to the board.
In a completed application, it is expected that the battery and BMS would be permanently attached. During development it can be prudent to allow disconnection of the battery for safety reasons.
The power connectors footprints on the design correspond to an XT90 hobby type connector such as the DFRobot FIT0588 connector. These types of connectors are readily available at local and online hobby shops and may also be used for soldering typical silicone insulation heavy gauge power wires.
TE connectivity has created a line of UMP (Unmanned Power) connectors specifically for professional high power mobile systems. Some kits ship with this type of connector included as a promotional item.
TE connectivity provides a line "UMP" connectors specifically for professional high power mobile systems.
The RDDRONE-BMS772 board is configurable to fit 3s to 6s battery packs.
Solder jumpers must be soldered in place and the matching JP1 connector must be installed on the board to match your battery cell configuration. Do not operate the board without the correct configuration.
This configuration must be done before using the board
The correct cell terminal connector should be soldered as JP1 on the top side. Connectors for 3s, 4s, and 6s are provided unsoldered in the kit.
the connection to the cell terminal circuit should be done by soldering the correct solder jumpers as given in the table below. All jumpers are open by default
Configuration
Jumpers connected
Associated JP1 connector
JP1 placement
3s
SJ6, SJ10, SJ11 and SJ12
S4B-XH-A(LF)(SN)
Pin 4 to 7
4s
SJ3, SJ7, SJ11 and SJ12
S5B-XH-A(LF)(SN)
Pin 3 to 7
5s
SJ1, SJ4, SJ8 and SJ12
S6B-XH-A(LF)(SN)
Pin 2 to 7
6s
SJ2, SJ5 and SJ9
S7B-XH-A(LF)(SN)
Pin 1 to 7
Note: SJ13, SJ14, SJ15 and SJ16 are not used for cell terminal connection. See Shunt resistor and External NFC antenna.
Note: The other jumpers used for cell terminal connection (SJ1 - SJ12) should be open!
Note: The JP1 connector should be soldered on the top side of the board.
The shunt resistor (R1) can be disconnected from the overcurrent protection circuit and the BCC by unsoldering the SJ13 and SJ14 jumpers. Both jumpers are closed by default.
The on-board NTAG5 chip is designed to provide active antenna matching and amplification and will give enhanced performance when the battery is present and providing power. However, for extended range operation, the PCB antenna can be replaced by an SMD coil (L2). The coil is not mounted by default but the recommended part is SDR7045-2R2M. Also note that it is possible to solder wires and attach a remote NFC antenna to the same pads used for L2.
To use the SMD coil, the user must reconfigure the board using the following steps:
remove both 0.75 Ω resistors R93 and R94
solder close SJ15 and SJ16
replace 82pF and 680pF capacitors C72 and C116 by a single 56pF capacitor
The RDDRONE-BMS772 board allows placement of four pairs of power MOSFETs (PSMNR70-30YLH) and four heatsinks (FK 244 08 D2 PAK). Half of them is on the top side of the board and the other half is on the bottom side. By default, only the two pairs of MOSFETs of the top side are mounted.
The user may want to place additional MOSFETs and/or optional heatsinks to their board. This allows to widen the maximum DC current limit as described in the following table:
Configuration
Maximum DC current
4 pairs of MOSFETs and 4 heatsinks
90A
2 pairs of MOSFETs and 2 heatsinks
70A
2 pairs of MOSFETs and no heatsink
60A
Note: Exceeding the given current limit can permanently damage the board.
Depending on the application, the user may want to add some optional components onto the RDDRONE-BMS772 board.
External and additional components and their use are detailed in External and additional components.
This chapter will show how the realization has been done. It will use diagrams to show how some of the parts were designed and it will describe each part in more detail.
This is about the following code repository: https://github.com/NXPHoverGames/RDDRONE-BMS772
In the main source file, the BMS main can be found, this is the BMS application. This function will initialize each part and start the main loop task. This task will implement the battery main state machine as seen in Figure 2 (https://app.gitbook.com/o/-L9GLsni4p7csCR7QCJ8/s/4sYITYOw8lqjlbpxfe9d/~/changes/1/software-guide-nuttx/bms-application-state-machine). In the main source code, the state is changed. In this source file there is a function to handle a changed parameter as well. This function will call other functions from the needed parts to do something with the parameter that is changed. If for example a configuration changed, such that a configuration of the BCC needs to change, it will call the right function from the Bat management part to change the configuration of the BCC as well. At the end of the main loop, the watchdog in the SBC is kicked. If this is not done in time, it will reset the MCU.
There is a lot of data that is needed or set by different tasks. Because it is not wise to move this big chunk of data through all the tasks there needs to be some sort of shared memory. Because NuttX is POSIX compliance there are shared memory functions that could be used. But for these shared memory functions a memory management unit (MMU) is needed and this microcontroller does not have an MMU. That is why the whole data management will be made in a data source file. This makes sure the data is only made once and is not global. With functions the data can be read or written, and these functions ensures protection against multiple threads accessing the data at the same time. These functions can be seen in Figure 5.
To protect the data from multiple threads trying to access it at the same time, a mutex is used. A mutex is an object that can be locked and unlocked in an atomic operation. Meaning that if both threads want to lock the mutex, the threads cannot lock the same mutex at the same time. A mutex is needed to prevent data race. The other thread needs to wait until the mutex is available.
The big data chuck is in a struct, together with a parameter info array. This array supports a fast access of the data type, the minimum, the maximum and the address of the data. This ensures it is faster to get and set data than with a large switch.
If a variable is set with the set parameter function. It will check if the variable is changed. If the variable is changed, it will call a handle parameter change function. This function will check which parameter has changed and will set other parameters if needed. At the end there is a callback to the main which will make sure the correct functions / reactions are being called. There are parameters that have an effect on the battery management and thus a function that handles changes in the battery management part is called as well to react on the parameter that changed. Next to handling the change of a parameter, this function will check if one of the savable parameters has been changed. If this is the case, it will remember this to save the parameters to flash when the DEEP SLEEP state is executed.
In NuttX there is a nuttshell, this is the UART communication with the MCU. In this nuttshell, applications can be called with or without arguments. There arguments will be given to the function it calls, in this case the BMS main. This means that a CLI can be created with calling the application with some arguments.
This CLI that is made, can be used by calling the BMS application in the nuttshell with a command and optionally up to 2 arguments for that command. When this happens the BMS main is called. Meaning that this main needs to be resistant against multiple calls, this should not restart the BMS application because than the battery power will be cut.
If there are commands given when calling the BMS application, the CLI process commands function will be called to handle it. It will parse the command and optionally the arguments and check if the inputs are valid. If it is valid, it will act based on which command has been given. The flowchart can be seen in Figure 6.
In order to set a color to the RGB LED, the set led color function should be used. The flowchart of this function can be found in Figure 7. Because this function can be used from different tasks, a mutex will be locked before it checks if the color and if blink is already set. This function will set the semaphore to start or stop the blink sequence. It will skip the semaphore timed wait function to ensure the blink sequence restarts if needed. It will begin with the new color. This function will use the NuttX userled functions.
In order to use a GPIO in NuttX, these GPIO’s need to be defined in the board file and the board specific GPIO file. This will create devices for each GPIO pin. To use the GPIO in the application an IOCTL call needs to be used. IOCTL means input-output control and it is a device specific system call.
The IOCTL is used to give commands to a driver to control a device, in this case the GPIO pins. But for an IOCTL to work an open file descriptor needs to be given. This is obtained by giving the path to the device as a string. This is too much work to do in the application for setting or reading a GPIO, that is why a GPIO BMS application driver is made. This will make sure that a GPIO can be read or written with simple write/read pin functions and a define to indicate the pin. An input pin can be an interrupt pin On an interrupt it will generate a signal that will queue the action for the handler. Keep in mind that these signals can be very intrusive.
The Bat management part can be used to monitor the battery and control the power switch. Because the Bat management part is quite large, there are other source files made to help with functions it needs to do and with utilizing the BCC. Like monitoring, to take care of measurements. Configuration, to take care of the whole configuration for the BCC. Balancing, to add easy to implement balancing function. For the main to implement the state machine, functions are made to let the main implement the functionality. Some functions are made to enable the measurements, to check for faults, to self-discharge etc.
The batManag task is created to handle the battery management. It will start the manual measurements with the BCC. Mostly it will calculate and check the current or it will measure and calculate every variable at t-meas interval. It will then perform a measurement, calculate the variables, save the values, it will check for software faults, it will calculate the new transition variables, handle the cell balancing if needed and it will trigger the callback that new measurements have been done. When saving the data, it will save the new measured and calculated variables in one go using the structs. Because the BCC will not check for an overcurrent, the current needs to be read and calculated every time to be compared with the current threshold. For short circuit protection there is a hardware circuit. If it measures a fault, it will trigger the main to act on it.
The sequence of the batManag task can be seen in Figure 8. The sem_wait and sem_post functions are called consecutively in the endless loop, this is used to start and stop the task with a function from the main. The meas task will check if the next measurement needs to be the measure everything or just the current and calculate the wait time to make sure the t-meas interval is met or with the remaining wait time. The task will wait for the next time or when the measurement is enabled, it will measure right away. To make sure the cyclic measurements does not drift, the time before the loop starts and the period t-meas are gained. The target time is calculated by adding the period with the previous target time. If t-meas should change, this is updated in the sequence using a global variable. This is left out of the sequence diagram because it is too detailed.
To calculate the state of charge (s-charge), the coulomb counter is used. The coulomb counter register holds the sum of the measured currents (until read). There is another register that holds the number of samples in the coulomb counter register. The average current is calculated by dividing the sum of the currents by the number of samples. When the time is known for which the average current is calculated, the difference in charge can be calculated with the following formula: ∆Q=I_avg*∆t. The new remaining charge is calculated by adding the difference in charge with the old remaining charge. The state of charge can then be calculated by dividing the full charge capacity by the remaining charge.
In order to provide the average power consumption over a time period of ten seconds, a constant moving average is taken. This moving average is constructed by removing the oldest measurement and adding the new measurement, which is than divided by the amount of measurements. This way the average will only be of the last ten seconds. In order to be memory efficient, the measurements used in the moving average will be sub-sampled if the measurement period is configured as less than one second. This way maximum ten old measurements need to be known. Measurements are not lost when sub-sampling, because the BCC chip will remember an average of it.
Since the user can change configurations in run time, sometimes a configuration needs to be changed in the BCC as well. When there is a change in the configuration, this is set with the setParameter function and a task in the main source file will handle the change. This function will call a function to handle the change in the bat management part. In this part it will call the right function from the configuration source file to change the configuration of the BCC.
The batManag task will check for software measured faults. The BCC chip will take care of hardware fault monitoring for the overvoltage, undervoltage, over temperature and under temperature. It will set the fault pin high when there is an error. If this happens it will trigger an interrupt in the main and it will check what fault happened. The main can than act on the fault. This ensures that the main is in control of what happens.
Since the user can change configurations in run time, sometimes a configuration needs to be changed in the BCC as well. When there is a change in the configuration, this is set with the setParameter function and a task in the main source file will handle the change. This function will call a function to handle the change in the bat management part. In this part it will call the right function from the configuration source file to change the configuration of the BCC.
The SBC part is used to control the power of voltage regulators V1 (The most used 3.3V (VCC_3V3_SBC)) and V2 (CAN PHY) (VCC_5V_SBC). With the setSbcMode() function the mode of the SBC can be set. In the normal mode both V1 and V2 are active, in the standby mode V2 is off, turning off the CAN transceiver and in the sleep mode both V1 and V2 are off, turning off almost the whole BMS board. In Figure 10 the simplified flowchart of this function can be seen. Besides power regulators, the SBC has a watchdog, which is used to reset the MCU if it doesn’t "kick" (reset) the watchdog within the set time. The reset of the MCU this is done via the NRST pin.
This part works with a DroneCAN (or Cyphal) task that waits (it sleeps until a CAN transceiver signal comes in) for an incoming CAN transmission. It will also wake up if the main signals the task that new data needs to be send. When new data needs to be sent, the task will put the data that needs to be sent in the transmit buffer. It will check if the transmit buffer if it is filled and transmit the data if it is. Then it will wait for an incoming CAN transmission or signal again. To see the flowchart see Figure 10: DroneCAN flowchart below.
There are DroneCAN and Cyphal messages implemented. Keep in mind that you can only select one at the time. The DroneCAN messages can be seen below in "DroneCAN messages implemented".
The CyphalCAN messages are a snapshot of the CyphalCAN V1 with WIP DS-015. This consists of 3 messages, the energy source, the battery status and the battery parameters. These messages can be seen in "CyphalCAN messages implemented"
For information on the DSDL message definition used for DroneCAN, please see the .uavcan files:
ardupilot_equipment_power_BatteryContinuous
uavcan_equipment_power_BatteryInfo
ardupilot_equipment_power_BatteryPeriodic
ardupilot_equipment_power_BatteryCells
ardupilot_equipment_power_BatteryInfoAux
Table 1. DroneCAN battery continuous message
Type
Name
Unit
Description
Float16
Temperature_cells
C
Pack mounted thermistor (preferably installed between cells), NAN: field not provided
Float16
Temperature_pcb
C
Battery PCB temperature (likely output FET(s) or current sense resistor), NAN: field not provided.
Float16
Temperature_other
C
Application dependent, NAN: field not provided
Float32
Current
A
Positive: defined as a discharge current. Negative: defined as a charging current, NAN: field not provided
Float32
Voltage
V
Battery voltage
Float16
State_of_charge
%
The estimated state of charge, in percent remaining (0 - 100).
Uint8
Slot_id
-
The physical location of the battery on the aircraft. 0: field not provided
Float32
Capacity_consumed
Ah
This is either the consumption since power-on or since the battery was full, depending on the value of STATUS_FLAG_CAPACITY_RELATIVE_TO_FULL, NAN: field not provided
Uint32
Status_flags
-
Fault, health, readiness, and other status indications.
READY_TO_USE = 1
CHARGING = 2
CELL_BALANCING = 4
FAULT_CELL_IMBALANCE = 8
AUTO_DISCHARGING = 16
REQUIRES_SERVICE = 32
BAD_BATTERY = 64
PROTECTIONS_ENABLED = 128
FAULT_PROTECTION_SYSTEM = 256
FAULT_OVER_VOLT = 512
FAULT_UNDER_VOLT = 1024
FAULT_OVER_TEMP = 2048
FAULT_UNDER_TEMP = 4096
FAULT_OVER_CURRENT = 8192
FAULT_SHORT_CIRCUIT = 16384
FAULT_INCOMPATIBLE_VOLTAGE = 32768
FAULT_INCOMPATIBLE_FIRMWARE = 65536
FAULT_INCOMPATIBLE_CELLS_CONFIGURATION = 131072
CAPACITY_RELATIVE_TO_FULL = 262144
Table 2. DroneCAN battery info message
Type
Name
Unit
Description
Float16
Temperature
K
Float16
Voltage
V
Float16
Current
A
Float16
Average_power_10sec
W
Average power consumption over the last 10 seconds.
Float16
remaining_capacity_wh
Wh
Will be increasing during charging
Float16
full_charge_capacity_wh
Wh
Predicted battery capacity when it is fully charged. Falls with aging
Float16
hours_to_full_charge
h
Charging is expected to complete in this time; zero if not charging
Uint11
status_flags
-
- CHARGING must be always set as long as the battery is connected to a charger, even if the charging is complete.
- CHARGED must be cleared immediately when the charger is disconnected. STATUS_FLAG_IN_USE = 1 # The battery is currently used as a power supply
STATUS_FLAG_CHARGING = 2 # Charger is active
STATUS_FLAG_CHARGED = 4 # Charging complete, but the charger is still active
STATUS_FLAG_TEMP_HOT = 8 # Battery temperature is above normal
STATUS_FLAG_TEMP_COLD = 16 # Battery temperature is below normal
STATUS_FLAG_OVERLOAD = 32 # Safe operating area violation
STATUS_FLAG_BAD_BATTERY = 64 # This battery should not be used anymore (e.g. low SOH)
STATUS_FLAG_NEED_SERVICE = 128 # This battery requires maintenance (e.g. balancing, full recharge)
STATUS_FLAG_BMS_ERROR = 256 # Battery management system/controller error, smart battery interface error
STATUS_FLAG_RESERVED_A = 512 # Keep zero
STATUS_FLAG_RESERVED_B = 1024 # Keep zero
Uint7
state_of_health_pct
%
Health of the battery, in percent, optional. STATE_OF_HEALTH_UNKNOWN = 127 # Use this constant if SOH cannot be estimated.
Uint7
state_of_charge_pct
%
Relative State of Charge (SOC) estimate, in percent. Percent of the full charge [0, 100]. This field is required.
Uint7
state_of_charge_pct_stdev
%
SOC error standard deviation; use best guess if unknown.
Uint8
battery_id
-
Identifies the battery within this vehicle, e.g. 0 - primary battery.
Uint32
model_instance_id
-
Set to zero if not applicable. Model instance ID must be unique within the same battery model name.
Uint8[<32]
model_name
-
Battery model name. Model name is a human-readable string that normally should include the vendor name, model name, and chemistry
type of this battery. This field should be assumed case-insensitive. Example: "Zubax Smart Battery v1.1 LiPo".
Typical publishing rate should be around 0.2~1 Hz.
Table 3. DroneCAN battery periodic message
Type
Name
Unit
Description
Uint8[<=50]
Name
-
Formatted as manufacturer_product, 0 terminated
Uint8[<=32]
Serial_number
-
Serial number in ASCII characters, 0 terminated
Uint8[<=9]
Manufacturer_date
-
Manufacture date (DDMMYYYY) in ASCII characters, 0 terminated
Float32
Design_capacity
Fully charged design capacity. 0: field not provided.
Uint8
Cells_in_series
-
Number of battery cells in series. 0: field not provided.
Float16
Nominal_voltage
V
Battery nominal voltage. Used for conversion between Wh and Ah. 0: field not provided.
Float16
Discharge_minimum_voltage
V
Minimum per-cell voltage when discharging. 0: field not provided.
Float16
charging_minimum_voltage
V
Minimum per-cell voltage when charging. 0: field not provided.
Float16
charging_maximum_voltage
V
Maximum per-cell voltage when charged. 0: field not provided.
Float32
charging_maximum_current
A
Maximum pack continuous charge current. 0: field not provided.
Float32
discharge_maximum_current
A
Maximum pack continuous discharge current. 0: field not provided.
Float32
discharge_maximum_burst_current
A
Maximum pack discharge burst current for 30 seconds. 0: field not provided
Float32
full_charge_capacity
Ah
Predicted battery capacity when fully charged (accounting for battery degradation), NAN: field not provided
Uint16
cycle_count
-
Lifetime count of the number of charge/discharge cycles (https://en.wikipedia.org/wiki/Charge_cycle). UINT16_MAX: field not provided.
Uint8
state_of_health
%
State of Health (SOH) estimate, in percent (0 - 100). UINT8_MAX: field not provided.
Battery data to be sent statically upon request or periodically at a low rate
Recommend that this message is sent at a maximum of 1Hz and nominally 0.2 Hz (IE: once every 5 seconds.).
Table 4. DroneCAN battery cells message
Type
Name
Unit
Description
Float16 [<=24]
Voltages
V
Cell voltage array.
Uint16
index
-
Index of the first cell in the array, index 0 is cells at array indices 0 - 23, index 24 is cells at array indices 24 - 47, etc.
Rate: set by parameter on smart battery (default off).
Table 5. DroneCAN battery info auxiliary message
Type
Name
Unit
Description
uavcan.Timestamp
timestamp
-
timestamp
Float16 [<=255]
voltage_cell
V
Battery individual cell voltages, length of following field also used as cell count.
Uint16
cycle_count
-
Uint16
over_discharge_count
-
Number of times the battery was discharged over the rated capacity.
Float16
max_current
A
Max instantaneous current draw since last message.
Float16
nominal_voltage
V
Nominal voltage of the battery pack.
Bool
is_powering_off
-
Power off event imminent indication, false if unknown
Uint8
battery_id
-
Identifies the battery within this vehicle, e.g. 0 - primary battery
Subject
Type
Typ. Rate [Hz]
energy_source
1…100
status
~1
parameters
~0.2
Table 6. Energy source 0.1 CyphalCAN udral
Type
Name
Unit
Description
Uint56
timestamp.microsecond
us
The number of microseconds that have passed since some arbitrary moment in the past. UNKNOWN = 0.
Float32
source.power.current
A
Battery current.
Float32
source.power.voltage
V
Battery voltage.
Float32
source.energy
J
A pessimistic estimate of the amount of energy that can be reclaimed from the source in its current state.
Float32
source.full_energy
J
A pessimistic estimate of the amount of energy that can be reclaimed from a fresh source (a fully charged battery) under the current conditions.
Table 7. Battery status 0.2 CyphalCAN udral
Type
Name
Unit
Description
Uint2
heartbeat.readiness*
-
SLEEP = 0, STANDBY = 2, ENGAGED = 3.
Uint2
heartbeat.health*
-
NOMINAL = 0, ADVISORY = 1, CAUTION = 2, WARNING = 3.
Float32[2]
temperature_min_max
K
The minimum and maximum readings of the pack temperature sensors.
Float32
available_charge
C
The estimated electric charge currently stored in the battery.
Uint8
error*
-
Error status. NONE = 0, BAD_BATTERY = 10, NEEDS_SERVICE = 11, BMS_ERROR = 20, CONFIGURATION = 30, OVERDISCHARGE = 50, OVERLOAD = 51, CELL_OVERVOLTAGE = 60, CELL_UNDERVOLTAGE = 61, CELL_COUNT = 62, TEMPERATURE_HOT = 100, TEMPERATURE_COLD = 101.
Float16[<=255]
cell_voltages
V
The voltages of individual cells in the battery pack.
* not implemented in the BMS example code
Table 8. Battery parameter 0.3 CyphalCAN udral
Type
Name
Unit
Description
Uint64
unique_id
-
Unique number.
Float32
mass
Kg
The total mass of the battery.
Float32
design_capacity
C
Design capacity.
Float32[2]
design_cell_voltage_min_max
V
Factory cell voltages.
Float32
discharge_current
A
The discharge current.
Float32
discharge_current_burst
A
The burst discharge current at least for 5 seconds.
Float32
charge_current
A
The charge current.
Float32
charge_current_fast
A
The fast charge current.
Float32
charge_termination_treshold
A
End-of-charging current.
Float32
charge_voltage
V
Total charging voltage.
Uint16
cycle_count
-
The number of cycles.
Uint16
Void16
-
Was cell count.
Uint7
state_of_health_pct
%
The state of health.
Uint8
technology.value
-
Battery chemistry 100 = LiPo, 101 = LiFePO4, 0 = unknown.
Float32
nominal_voltage
V
The nominal battery voltage.
This page will have information about the CyphalCAN communication
Connect the CyphalCAN device (like the RDDRONE-UCANS32K146) to the BMS using 2x JST-GH 4 pin connectors with 1 on 1 wires. End the CAN bus with a 120Ω terminator resistor between CAN high and CAN low.
Make sure you Connect the UCAN board with a USB-TTL-3V3 cable to the laptop.
Install the can utils with the following terminal command:
o sudo apt install can-utils
Install python 3.7 with the following terminal command:
o sudo apt install python3.7
Install pyuavcan with the following terminal command:
o python3.7 -m pip install pyuavcan
Start the deamon on UART <-> SLCAN to use SLCAN0 use the command (for ttyUSB1): o sudo slcand -o -s8 -t sw -S 115200 /dev/ttyUSB1
Keep in mind that in this case the UART of the UCAN board needs to be connected to ttyUSB1. One can check which USB it is by disconnecting the USB-TTL-3V3 cable connected to the UCAN board, write “ls /dev” in the terminal, connect the USB cable and write “ls /dev” again. Only the USB of the UCAN board should be added in the list. If not check if the USB connection of the used virtual machine is passed through.
Enable the interface (up)(same as ifup can0 in nuttx) write the following command: o sudo ip link set up slcan0
Clone the cannode v1 tools:
o git clone
Make sure the sub modules are in the git repository write the following command in the cannode-v1_tools directory:
o git submodule update --init
Find this line in print_battery_service.py:
o media = pyuavcan.transport.can.media.socketcan.SocketCANMedia('vcan0', mtu=8)
Change it to the right can device, for example:
o media = pyuavcan.transport.can.media.socketcan.SocketCANMedia('slcan0', mtu=8)
Run the pyuavcan tool by typing the following in a terminal where the print_bmsstatus_topic.py file is located:
o python3.7 print_battery_service
Make sure the BMS CAN mode is in cyphal mode:
bms set can-mode cyphal
Check if the subject IDs of the messages are correct
cyphal_es_sub_id should be 4096.
cyphal_bs_sub_id should be 4097.
cyphal_bp_sub_id should be 4098.
Check if the node id of the BMS is not 225
o In the CLI of the BMS type “bms get cyphal-node-static-id”, if this is 255, it needs to be changed to another value (like 12). Do this with “bms set cyphal-node-static-id 12”
o After that save it and reboot the bms with “bms save” and “reboot”.
The BMS is not able to limit the current. It can only disconnect the battery from the output. For charging make sure a current limited power source is used and set the limitation to the right value. The BMS is not able to limit the voltage. For charging, the charge voltage should be limited as well.
The standard balancing current is only 50mA for one cell. This means it could take some time before balancing is done if the battery pack very unbalanced.
To get more information about the charging process see CHARGE state on the page.
This page will describe the task priorities of the BMS
The tasks of the BMS have different priorities, this is needed because some tasks/activities are more important than others. For example, one needs to react fast on a fault, so the system needs to prioritize a fault above blinking the LED. The BMS uses the NuttX preemption, which means that lower priority tasks get interrupted by a higher priority task. The task priorities can be seen in Figure 4.
When one of the BCC functions is called (via the spiwrapper), the task is locked so it can’t switch tasks. This way it makes sure it will execute the function OK, otherwise there could be CRC errors or NULL responses
This page shows the parameters of the BMS.
This page will describe the variables of the BMS. There are 6 kind of parameters
The common battery variables
The calculated battery variables
The additional battery variables
The configuration variables
The CAN variables
The hardware parameters
In the console (CLI) type "bms get all" to get all the parameters and its current value.
In the console (CLI) type: "bms help parameters" to get more info on the parameters.
Table 1. Common battery variables list
Table 2. Calculated battery variables list
Table 3. Additional battery variables list
Table 4. Configuration variables list
Table 5. Can variables list
A line means this is not implemented yet.
* These parameters will only be implemented during startup of the BMS
Table 6. BMS hardware parameters list
A line means this is not implemented yet.
This page will describe what you should set first
It is highly recommended that you check each parameters in and make sure to configure each parameter. Use "bms get all" to get each parameter and it's value, so you could configure each one for your battery. Some parameters you would like to configure are:
battery-type (Which battery type do you have? 0=LiPo, 1=LiFePO4, 2=LiFeYPO4, 3=NMC, 4=Sodium-ion)
This will change the under- and over-voltage, storage voltage, nominal voltage and the OCV curve it uses to correct the state of charge
n-cells (the amount of cells of the battery) [3 .. 6]
sensor-enable (to enable the battery temperature sensor) [0=disable, 1=enable]
a-rem (the remaining capacity) [Ah]
the BMS does a guess on what the remaining charge is based on a OCV(open cell voltage)/SoC (state of charge) table from one specific battery, but every battery is different.
It is advisable to insert the correct OCV/SoC table for the battery.
a-factory (the factory capacity of the battery) [Ah]
What is the capacity stated on the battery?
a-full (the full charge capacity of the battery) [Ah]
while charging, the BMS will calculate this based on a-rem
If unknown, set to the same value as factory capacity after the next step
model-name (the name of the battery)
i-charge-full (the end of charge current of the battery (could be 10% from i-charge-max)) [mA]
i-charge-max (the maximum charge current) [A]
i-peak-max (the maximum peak current threshold [A])
Parameter
Unit
Datatype
Description
Default
RO/RW
No
v-out
V
float
The voltage of the BMS output
0
RO
0
v-batt
V
float
The voltage of the battery pack
0
RO
1
n-cells
-
uint8_t
Number of cells used in the BMS board
3
RW
2
v-cell1
V
float
The voltage of cell 1
0
RO
3
v-cell2
V
float
The voltage of cell 2
0
RO
4
v-cell3
V
float
The voltage of cell 3
0
RO
5
v-cell4
V
float
The voltage of cell 4
0
RO
6
v-cell5
V
float
The voltage of cell 5
0
RO
7
v-cell6
V
float
The voltage of cell 6
0
RO
8
i-batt
A
float
The last recorded current of the battery
0
RO
9
i-batt-avg
A
float
The average current since the last
measurement (period t-meas (default 1s))
0
RO
10
i-batt-10s-avg
A
float
The 10s rolling average current, updated
each t-meas, default 1000 (ms)
0
RO
11
sensor-enable
-
bool
This variable is used to enable or disable
the battery temperature sensor, 0 is
disabled, 1 is enabled
0
RW
12
c-batt
C
float
The temperature of the external battery
temperature sensor
0
RO
13
c-afe
C
float
The temperature of the analog front end
0
RO
14
c-t
C
float
The temperature of the transistor (switch)
0
RO
15
c-r
C
float
The temperature of the sense resistor
0
RO
16
Parameter
Unit
Datatype
Description
Default
RO/RW
No
p-avg
W
float
Average power consumption over the
last 10 seconds.
0
RO
17
e-used
Wh
float
Power consumption since device boot
0
RO
18
t-full
h
float
Charging is expected to complete in this
time; zero if not charging.
0
RO
19
a-rem
Ah
float
Remaining capacity in the battery
0
RW
20
a-full
Ah
float
Full charge capacity, predicted battery
capacity when it is fully charged.
Decreases with aging.
4.6
RW
21
a-factory
Ah
float
Battery capacity stated by the factory
4.6
RW
22
s-charge
%
uint8_t
Percentage of the full charge 0 - 100%.
0
RO
23
s-health
%
uint8_t
Health of the battery in percentage, use
STATE_OF_HEALTH_UNKNOWN =
127 if cannot be estimated.
127
RO
24
s-out
-
bool
This is true if the output power is enabled.
0
RO
25
s-in-flight
-
bool
This is true if the system is in flight (with
flight-mode-enable and i-flight-mode)
0
RO
26
batt-id
-
uint8_t
Identifies the battery within this vehicle,
0 - primary battery.
0
RW
27
Parameter
Unit
Datatype
Description
Default
RO/RW
No
v-cell-ov
V
float
Battery maximum allowed voltage for one cell. exceeding this voltage, the BMS will go to fault mode
4.2
RW
28
v-cell-uv
V
float
Battery minimum allowed voltage for one cell.
Going below this voltage, the BMS will go to
fault mode followed by deepsleep after
t-fault-timeout
3
RW
29
v-cell-nominal
V
float
Battery nominal voltage for one cell. will be used for energy calculation.
3.7
RW
30
v-storage
V
float
The voltage what is specified as storage voltage for a cell
3.8
RW
31
v-cell-margin
mV
uint8_t
Cell voltage charge margin to decide or not to go through another topping charge cycle
50
RW
32
v-recharge-margin
mV
Uint16_t
Cell voltage charge complete margin to decide or not to do a battery re-charge, to keep the cell voltages at max this much difference with the cell-ov
200
RW
33
i-peak-max
A
float
Maximum peak current threshold to open the switch during normal operation, can't be overruled
200
RW
34
i-out-max
A
float
Maximum current threshold to open the switch during normal operation, if not overruled
60
RW
35
i-out-nominal
A
float
Nominal discharge current (informative only)
60
RW
36
i-flight-mode
A
uint8_t
Current threshold to not disable the power in flight mode
5
RW
37
i-sleep-oc
mA
uint8_t
Overcurrent threshold detection in sleep mode that will wake up the BMS and also the threshold to detect the battery is not in use
30
RW
38
i-system
mA
uint8_t
Current of the BMS board itself, this is
measured (as well) during charging, so
this needs to be subtracted
40
RW
39
i-charge-max
A
float
Maximum current threshold to open the
switch during charging
4.6
RW
40
i-charge-nominal
A
float
Nominal charge current (informative
only)
4.6
RW
41
i-charge-full
mA
uint16_t
Current threshold to detect end of charge
sequence
50
RW
42
c-cell-ot
C
float
Over temperature threshold for the cells.
Going over this threshold and the BMS
will go to FAULT mode
45
RW
43
c-cell-ut
C
float
Under temperature threshold for the cells.
Going under this threshold and the BMS will
go to FAULT mode
-20
RW
44
c-pcb-ot
C
float
PCB Ambient temperature over temperature
threshold
45
RW
45
c-pcb-ut
C
float
PCB Ambient temperature under Temperature
threshold
-20
RW
46
c-cell-ot-charge
C
float
Over temperature threshold for the cells
During charging. Going over this threshold and
the BMS will go to FAULT mode.
40
RW
47
c-cell-ut-charge
C
float
Under temperature threshold for the cells
during charging. Going under this
threshold during charging and the BMS
will go to FAULT mode
0
RW
48
n-charges
-
uint16_t
The number of charges done
0
RW
49
n-charges-full
-
uint16_t
The number of complete charges
0
RW
50
ocv-slope
mV/A.min
float
The slope of the OCV curve. This will
be used to calculate the balance time.
5.3
RW
51
battery-type
-
uint8_t
The type of battery attached to it.
0 = LiPo, 1 = LiFePO4, 2 = LiFeYPO4,
3 = NMC (LiPo type, LiNiMnCoO2),
4 = Na-ion (Sodium-ion, SIB). Could be
extended. Will change OV, UV, v-storage,
OCV/SoC table if changed runtime.
3
RW
52
Parameter
Unit
Datatype
Description
Default
RO/RW
No
t-meas
ms
uint16_t
Cycle of the battery to perform a complete battery measurement and SOC estimation can only be 10000 or a whole division of 10000 (For example: 5000, 1000, 500)
1000
RW
53
t-ftti
ms
uint16_t
Cycle of the battery to perform diagnostics (Fault Tolerant Time Interval)
1000
RW
54
t-bms-timeout
s
uint16_t
Timeout for the BMS to go to SLEEP mode when the battery is not used.
600
RW
55
t-fault-timeout
s
uint16_t
After this timeout, with an undervoltage fault the battery will go to DEEPSLEEP mode to preserve power. 0 sec is disabled.
60
RW
56
t-bcc-sleep-cyclic
s
uint8_t
Wake up cyclic timing of the AFE (after front end) during sleep mode
1
RW
57
t-sleep-timeout
h
uint8_t
When the BMS is in sleep mode for this period it will go to the self-discharge mode, 0 if disabled.
24
RW
58
t-ocv-cyclic0
s
int32_t
OCV measurement cyclic timer start (timer is increase by 50% at each cycle)
300
RW
59
t-ocv-cyclic1
s
int32_t
OCV measurement cyclic timer final value (limit)
86400
RW
60
t-charge-detect
s
uint8_t
During NORMAL mode, if the battery current is positive for more than this time, then the BMS will go to CHARGE mode
1
RW
61
t-cb-delay
s
uint8_t
Time for the cell balancing function to start after entering the CHARGE mode
120
RW
62
t-charge-relax
s
uint16_t
Relaxation time after the charge is complete before going to another charge round.
300
RW
63
batt-eol
%
uint8_t
Percentage at which the battery is end-of-life and shouldn’t be used anymore Typically between 90%-50%
80
RW
64
s-flags
-
uint8_t
This contains the status flags as
described in BMS_status_flags_t
255
RO
65
self-discharge-enable
-
bool
This variable is used to enable or disable the SELF_DISCHARGE state, 0 is disabled, 1 is enabled
1
RW
66
flight-mode-enable
-
bool
This variable is used to enable or disable flight mode, is used together with i-flight-mode. 0 is disabled
0
RW
67
emergency-button-enable
-
bool
This variable is used to enable or disable the emergency button on PTE8.
0
RW
68
smbus-enable
-
bool
This variable is used to enable or disable the SMBus update.
0
RW
69
gate-check-enable
-
bool
This variable is used to enable or disable the gate safety check. If true, it will check if it can be turned off, based on output voltage.
1
RW
70
model-id
-
uint64_t
Model id, set to 0 if not applicable
0
RW
71
model-name
-
char[32]
Battery model name, model name is a
human-readable string that could
include the vendor, model, chemistry.
"BMS772"
RW
72
Parameter
Unit
Datatype
Description
Default
RO/RW
No
cyphal-node-static-id*
-
uint8_t
This is the node ID of the CYPHAL node. Should be between 1 - 127 or 255 for PNP.
255
RW
73
cyphal-es-sub-id*
-
uint16_t
This is the subject ID of the energy source CYPHAL message (1...100Hz)
4096
RW
74
cyphal-bs-sub-id*
-
uint16_t
This is the subject ID of the battery status CYPHAL message (1Hz)
4097
RW
75
cyphal-bp-sub-id*
-
uint16_t
This is the subject ID of the battery parameters CYPHAL message (0.2Hz)
4098
RW
76
cyphal-legacy-bi-sub-id*
-
uint16_t
This is the subject ID of the battery info legacy CYPHAL message (0.2 ~ 1Hz)
65535
RW
77
dronecan-node-static-id
-
uint8_t
This is the node ID of the DRONECAN node. Should be between 1 - 127 or 255 for dynamic node id.
0
RW
78
dronecan-bat-continuous
-
uint8_t
This indicates if the particular DroneCAN topic has to be published
0
RW
79
dronecan-bat-periodic
-
uint8_t
This indicates if the particular DroneCAN topic has to be published
0
RW
80
dronecan-bat-cells
-
uint8_t
This indicates if the particular DroneCAN topic has to be published
0
RW
81
dronecan-bat-info
-
uint8_t
This indicates if the particular DroneCAN topic has to be published
1
RW
82
dronecan-bat-info-aux
-
uint8_t
This indicates if the particular DroneCAN topic has to be published
1
RW
83
can-mode
-
char[32]
Options “OFF”, "DRONECAN" and "CYPHAL". To indicate which is used.
“OFF”
RW
84
can-fd-mode*
-
uint8_t
If true CANFD is used, otherwise classic CAN is used
0
RW
85
can-bitrate*
bit/s
int32_t
The bitrate of classical can or CAN FD arbitration bitrate
1000000
RW
86
can-fd-bitrate*
bit/s
int32_t
The bitrate of CAN FD data bitrate
4000000
RW
87
Parameter
Unit
Datatype
Description
Default
RO/RW
No
v-min
V
uint8_t
Minimum stack voltage for the BMS board to be fully functional
6
RW
88
v-max
V
uint8_t
Maximum stack voltage allowed by the BMS board
26
RW
89
i-range-max
A
uint16_t
Maximum current that can be measured by the BMS board
300
RW
90
i-max
A
uint8_t
Maximum DC current allowed in the BMS board (limited by power dissipation in the MOSFETs). For info only. Use i-out-max for a limit.
60
RW
91
i-short
A
uint16_t
Short circuit current threshold (typical: 550A, min: 500A, max: 600A)
500
RW
92
t-short
us
uint8_t
Blanking time for the short circuit detection
20
RW
93
i-bal
mA
uint8_t
Cell balancing current under 4.2V with cell balancing resistors of 82 ohms
50
RW
94
m-mass
kg
float
The total mass of the (smart) battery
0
RW
95
f-v-out-divider-factor
-
float
The factor of the output voltage divider as component tolerances could be different to not result in 11.0.
11.0
RW
96
This page will provide info on the Model-Based Design Toolbox (MBDT) for make an application and programming the BMS772
The NXP MBDT includes an integrated Simulink®-embedded target supporting NXP MCUs for direct rapid prototyping and built-in support for software- and processor-in-the-loop (SIL and PIL) development workflows, systems and peripherals device interface blocks and drivers, a target-optimized Math and Motor Control library set (AMMCLib) for efficient execution on the target automotive MCUs and Real-Time Control Embedded Software Motor Control and Power Conversion Libraries (RTCESL) for other MCUs, and bit-accurate simulation results in the Simulink® simulation environment.
The NXP MBDT helps to generate all the code required automatically (including initialization routines and device drivers) to start up the MCU and run complex applications such as motor control algorithms and sensor-based and communication protocols while supporting builds with multiple compilers. The NXP MBDT supports a wide range of applications development and helps enable control engineers and embedded developers to shorten project life cycles.
For a BMS772 MBDT example, see this article: https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/Example-Model-RDDRONE-BMS772/ta-p/1550394
It could be that more examples will be added in the future, look for the examples in the toolbox.
More information can be found here:
The MC33772B Battery Cell Controller (BCC) comes with a SW package. This package contains embedded SDK SW driver for NXP’s Battery Cell Controller products and example projects for S32K144 MCU and S32 Design Studio for Arm Version 2018.R1. It exists in a Lite and a Full version:
The Lite version is implemented and used in the NUTT-PX4 software. It allows controlling the BCC and performing its main tasks, as: measuring Cell Terminal (CT) voltages, current, temperatures, analog inputs, etc.. It is available on NXP.com
The Full version complements the Lite version by adding diagnostics and safety to it. This package can be useful for users wanting to add a safety layer on their applications. It is available under NDA on Docstore
How to get access to the safety library
There is a full safety library for the Battery Cell Controller (BCC) IC. This library is only available under NDA and thus has not been added to this example code.
This software is available to selected customers via a required non-disclosure agreement (NDA). For additional information contact support or your local sales representative.
This page describes how to use the SMBus interface.
To enable the update, be sure to set smbus-enable to 1 with “bms set smbus-enable 1”. If this is enabled, one can use the BMS as an I2C peripheral device to get the information. Use the J18 connector (I2C/SMBUS) on the BMS, hook up your I2C initiator device with pull-ups to this connector. The SMBus information is based on the SBS1.1 specification. These are the supported messages:
Table 1. SMBus variable list
Parameter
Unit
Datatype
Description
I2C Address
temperature
K
uint16_t
The temperature of the external battery
temperature sensor, 0 otherwise.
0x08
voltage
mV
uint16_t
The voltage of the battery.
0x09
current
mA
uint16_t
The last recorded current of the battery.
0x0A
average_current
mA
uint16_t
The average current since the last
measurement (period t-meas (default 1s)).
0x0B
max_error
%
uint16_t
Just set to 5%. Not tracked.
0x0C
relative_state_of_charge
%
uint16_t
Set to the state of charge value.
0x0D
absolute_state_of_charge
%
uint16_t
Set to the state of charge value.
0x0E
remaining_capacity
mAh
uint16_t
The remaining capacity of the battery.
0x0F
full_charge_capacity
mAh
uint16_t
The full charge capacity of the battery.
0x10
run_time_to_empty
min
uint16_t
Calculated time to empty based on
current and remaining_capacity.
0x11
average_time_to_empty
min
uint16_t
Calculated the time to empty based on
average_current and remaining_capacity.
0x12
cycle_count
cycle
uint16_t
Set to the n-charges value.
0x17
design_capacity
mAh
uint16_t
Set to the factory capacity.
0x18
design_voltage
mV
uint16_t
Set to the cell overvoltage value.
0x19
manufacture_date
-
uint16_t
Set to the defines in the code. Not actual
manufacturer dates.
(year-1980)*512 + month*32 + day
0x1B
serial_number
-
uint16_t
Set to the battery id (batt-id).
0x1C
manufacturer_name
-
char *
Set to “NXP”.
0x20
device_name
-
char *
Set to "RDDRONE-BMS772"
0x21
device_chemistry
-
char *
This is a 3 letter battery device chemistry
"LiP", "LFP" or "LFY" (LiPo, LiFePo4,
LiFeYPo4).
0x22
manufacturer_data
-
uint8_t *
Set to 0x0. (length 1).
0x23
cell1_voltage
mV
uint16_t
Cell voltage of cell1.
0x3A
cell2_voltage
mV
uint16_t
Cell voltage of cell2.
0x3B
cell3_voltage
mV
uint16_t
Cell voltage of cell3.
0x3C
cell4_voltage
mV
uint16_t
Cell voltage of cell4.
0x3D
cell5_voltage
mV
uint16_t
Cell voltage of cell5.
0x3E
cell6_voltage
mV
uint16_t
Cell voltage of cell6.
0x3F
PX4.io is a flight stack or vehicle management software for mobile robotic vehicles such as drones and rovers which operates with NuttX as an underlying operating system. There will be a build target for the RDDDRONE-BMS772 that is a minimal PX4 functionality target board.
The same NuttX BMS software will be ported to this minimal functionality PX4 target with the intent that some users may perfer to operate in the PX4 ecosystem since it is well maintained. Over time the software developer may wish to take advantage of PX4 functions relating to MAVLINK, uORB messaging services, authentication or other.
PX4 target is a work in progress. Please check back here for updates. We are expecting to have this available September/2020
This page will tell you how to get NFC information
The BMS has an NTAG5 on board to have NFC communication with an NFC enabled device. In the current example an NDEF text record is implemented. This text record has the actual battery information and is updated each measurement time. If the data is read out via NFC, the new updated data cannot be written to the NTAG at the same time. To read the data with NFC, approach the BMS with an NFC enabled mobile phone. It should automatically pop up with the text message after a read, as can been seen in the figure below. An NFC read application could be used as well. If the BMS is in a low power state, the NFC is disabled and it will show some information on the state. If the BMS is in the sleep state, an NFC interaction can be used to wake up the BMS.
The following information can be found using an NFC read:
output voltage
Battery current
State of charge
State of health
Output current
Number of charges
Battery id
Model id
Current BMS application state