Developers docs: DroneCAN template application.
View | STM32CubeMX | Pinout |
---|---|---|
![]() |
![]() |
pinout |
The PMU node does 3 things:
- Battery. This module estimates the battery info based on ADC voltage and current measurements and publishes BatteryInfo message.
- Gate monitor. This module estimates the internal state of the PMU based on ADC voltage of gates. It publishes the LogMessage and set
CRITICAL
state once an error is detected. - Buzzer. This module notifies with sound if the internal state of the board is bad. If the internal state is fine, it repeats the BeepCommand from an autopilot.
From the software side, the high level node design can be illustrated with the following UML diagramm:
More details about each module:
The battery module sends BatteryInfo message with 1 Hz rate.
Here:
voltage
andcurrent
are measured values,full_charge_capacity_wh
,battery_id
,model_instance_id
are configured via parameters,average_power_10_sec
,remaining_capacity_wh
,state_of_charge_pct
are calculated based on the above values.
If at least one gate is broken, it starts to notify with LogMessage each 10 seconds until the node is rebooted. The LogMessage has a number of broken gates.
The node ignores all broken states first 5 seconds to prevent false positive failures.
DMA Rank | Periphery | Pin | Meaning | Note |
---|---|---|---|---|
1 | ADC_IN2 | PA2 | ADC_GATE_2 | If voltage < 1.4 V, so it is broken. |
3 | ADC_IN4 | PA4 | ADC_GATE_3 | If voltage < 1.4 V, so it is broken. |
4 | ADC_IN6 | PA6 | ADC_GATE_4 | If voltage < 1.4 V, so it is broken. |
The buzzer notifies with sound about dead gates.
Here is a list of parameters.
More details you can find in the parameters auto-generated documentation Src/dronecan_application/README.md.
- TestBatteryInfo
- TC1. Publish rate must be 1 Hz (plus minus 50 ms is acceptable)
- TC2. Votlage should be within [4.5, 60.0] Volts
- TC3. Set a random value between [0, 100]
battery.soc_pct
, somsg.state_of_charge_pct
should be the same - TC4. The same for
battery.battery_id
- TC5. The same for
battery.model_instance_id
- TC6. Similar for pair
battery.capacity_mah
andbattery.full_voltage
, but checkmsg.full_charge_capacity_wh
value according to a formula - TC7. We should also check
msg.remaining_capacity_wh
. Well, it seems to be we should check it manually.
- TestBuzzer
- I don't know how to automatically test it...
- TestGateMonitor
- TC1. Test good gate
Reboot the node.
Set
gate.threshold
to 4095 (that means gates are always ok). Wait for 15 seconds. Debug message should not appear. The NodeStatus should have good health. - TC2. Test bad gates
Reboot the node.
Set
gate.threshold
to 0 (that means gates are always bad). Verify, that the node publish LogMessage with 0.1 Hz rate (burst publishing are not allowed, first 5 second node publish nothing) The NodeStatus should have CRITICAL health.
- TC1. Test good gate
Reboot the node.
Set
SWD connector Upload a firmware |
JST GH 4 pin connector CAN-bus bench test |
---|---|
![]() |
![]() |
Current ADC
- Accuracy
ADC_RESOLUTION = 12 bit
ADC_RAW_MAX = 4095
MAX_CURRENT = 200 A
CURRENT_SENSETIVITY = 146.5 mA
- Frequency
MCU_FREQUENCY = 72 000 000
ADC_FREQUENCY = 12 000 000
NUMBER_OF_CONVERSION = 7
SAMPLING_TIME = 55.5 Cycles
THEORY_GROUP_FREQUENCY = 30 888 Measurements/sec
ACTUATL_GROUP_FREQUENCY = 22 175 Measurements/sec