EEPROM Configurationπ
The EEPROM allows for persistent configuration of the motor controller.
Fieldsπ
All values (including f32 and u32 values) are little-endian.
Field ID |
Field Name |
Field Description |
Datatype |
Scaling (Divide by X to get real value) |
|---|---|---|---|---|
0 |
NumberOfBoots |
Number of boots of the device total. (pending implementation) |
f32 |
1 |
1 |
ResolverOffsetDegrees |
Resolver offset from mechanical resolver angle to electrical angle in degrees. |
f32 |
1 |
2 |
LoopIqPGain |
P (proportional) gain in the Iq PID loop |
f32 |
1 |
3 |
LoopIqIGain |
I (integral) gain in the Iq PID loop |
f32 |
1 |
4 |
LoopIqDGain |
D (derivative) gain in the Iq PID loop |
f32 |
1 |
5 |
LoopIqTGain |
Gain for integral anti windup in the Iq PID loop |
f32 |
1 |
6 |
LoopIdPGain |
P (proportional) gain in the Id PID loop |
f32 |
1 |
7 |
LoopIdIGain |
I (integral) gain in the Id PID loop |
f32 |
1 |
8 |
LoopIdDGain |
D (derivative) gain in the Id PID loop |
f32 |
1 |
9 |
LoopIdTGain |
Gain for integral anti windup in the Id PID loop |
f32 |
1 |
10 |
TorqueConstant |
Torque constant for the motor. Units Newton-Metres per Ampere. This torque constant is relative to Q-Axis current. The physical interpretation is roughly Nm/A where current is the amplitude of the torque generating phase current. |
f32 |
1 |
11-22 |
Current Scaling and Offsets |
The user should not touch these, calibrated at factory. |
f32 |
1 |
23 |
LoopVelPGain |
P (proportional) gain in the velocity control loop. |
f32 |
1 |
24 |
LoopVelIGain |
I (integral) gain in the velocity control loop. |
f32 |
1 |
25 |
LoopVelDGain |
D (derivative) gain in the velocity control loop. |
f32 |
1 |
26 |
LoopVelTGain |
Gain for integral anti windup in the velocity control loop. |
f32 |
1 |
27 |
MaxTorqueSlewRate |
Maximum torque slew rate in Newton-Metres per s. |
f32 |
1 |
28 |
OvercurrentThresholdAmps |
Maximum allowable phase current magnitude (in Apk) |
f32 |
1 |
29 |
OvertempThresholdCelsius |
Maximum allowable temperature in the inverter |
f32 |
1 |
30 |
ResolverPolesPerMotorPole |
Number of resolver poles per motor pole. Sign indicates resolver inversion. |
f32 |
1 |
31 |
MaxNPCapacitorVoltage |
Maximum allowable voltage across either neutral-point capacitor |
f32 |
1 |
32 |
EnableHVILAlarm |
Set to 1 to prevent operation if any HV connectors are unseated. Set to 0 to disable this check. |
u32 |
1 |
33 |
ExtTempSensorType |
This value controls what is reported in the 0x31C (External RTD interface).
|
u32 |
N/A |
34 |
DeviceIdentifier |
Lower 7 bytes of the 20-byte device identifier (little endian). The device identifier as printed on the unit is shown in base 36. |
7 bytes |
N/A |
35 |
DeviceIdentifier2 |
Middle 7 bytes of the 20-byte device identifier (little endian) |
7 bytes |
N/A |
36 |
DeviceIdentifier3 |
Upper 6 bytes of the 20-byte device identifier (little endian) |
6 bytes |
N/A |
37 |
HardwareRevision |
Internal revision number for sensing and control circuitry. |
u32 |
N/A |
Reading/Writing to EEPROMπ
There are 2 ways to configure the EEPROM. You can manually send CAN messages using whatever tool you prefer, or you can use Steinmetzβs tool which will autoformat and set that for you. The mechanism of configuration is the same for both manually sending CAN messages or the tool, the benefit of the tool is it will perform checks and formatting for you.
Using Provided Toolπ
Steinmetz provides a command-line tool to configure Avalanche EEPROM as well as manage firmware updates.
At this time, Steinmetz only provides a tool that works on Linux systems.
By default, the tool communicates over the can0 socketcan interface, although this can be changed with the --can flag.
Readingπ
The config tool can be used to read individual config values, or to dump all config values. Individual config values can be read like so:
$ ./steinmetz_tool config read ResolverOffsetDegrees
ResolverOffsetDegrees: 20
The list of all config values can be show with the --help flag:
$ ./steinmetz_tool config read --help
Read the value of a single configuration parameter
Usage: steinmetz_tool config read [OPTIONS] <KEY>
Arguments:
<KEY>
Possible values:
- NumberOfBoots
- ResolverOffsetDegrees: Resolver offset (in degrees)
- LoopIqPGain: kP for the q-axis current controller
- LoopIqIGain: kI for the q-axis current controller
- LoopIqDGain: kD for the q-axis current controller
- LoopIqTGain
- LoopIdPGain: kP for the d-axis current controller
- LoopIdIGain: kI for the d-axis current controller
- LoopIdDGain: kD for the d-axis current controller
- LoopIdTGain
- TorqueConst: Torque constant (in Nm/Amps)
- PhaseACoarseHallOffsetVolts
- PhaseBCoarseHallOffsetVolts
- PhaseCCoarseOffsetVolts
- PhaseACoarseVoltsPerAmp
- PhaseAFineHallOffsetVolts
- PhaseBFineHallOffsetVolts
- PhaseCFineOffsetVolts
- PhaseAFineVoltsPerAmp
- PhaseBCoarseVoltsPerAmp
- PhaseCCoarseVoltsPerAmp
- PhaseBFineVoltsPerAmp
- PhaseCFineVoltsPerAmp
- LoopVelPGain: kP for closed-loop velocity controller
- LoopVelIGain: kI for closed-loop velocity controller
- LoopVelDGain: kD for closed-loop velocity controller
- LoopVelTGain
- MaxTorqueSlewRate: Maximum allowable slew rate for torque controller (in Nm/s)
- OvercurrentThresholdAmps: Maximum allowable phase current magnitude (in Apk)
- OvertempThresholdCelsius: Maximum allowable temperature in the inverter
- ResolverPolesPerMotorPole: Number of resolver poles per motor pole. Sign indicates resolver inversion
- MaxNpCapacitorVoltage: Maximum allowable voltage across either neutral-point capacitor
- EnableHvilAlarm: Enable HVIL alarm
- ExtTempSensorType: Type of temperature sensor connected to external temp port
- DeviceIdentifier: The device identifier uniquely identifies a device and ties it back to pre-delivery acceptance testing data
- HardwareRevision
Options:
--can <CAN>
[default: can0]
-h, --help
Print help (see a summary with '-h')
Writingπ
The tool can similarly be used to write values to EEPROM:
$ ./steinmetz_tool config read ResolverOffsetDegrees
ResolverOffsetDegrees: 10
$ ./steinmetz_tool config write ResolverOffsetDegrees 20.0
Successfully Written ResolverOffsetDegrees: 20
$ ./steinmetz_tool config read ResolverOffsetDegrees
ResolverOffsetDegrees: 20
Dumpingπ
For efficiently reading the entire configuration (e.g in preparation to provision backup units), one may also dump the entire config:
$ ./steinmetz_tool config dump
NumberOfBoots: 0
ResolverOffsetDegrees: 178.5
LoopIqPGain: 0.03
LoopIqIGain: 6.0225
LoopIqDGain: 0
LoopIqTGain: 0
LoopIdPGain: 0.03
LoopIdIGain: 6.0225
LoopIdDGain: 0
LoopIdTGain: 0
TorqueConst: 1
PhaseACoarseHallOffsetVolts: 0
PhaseBCoarseHallOffsetVolts: 0
PhaseCCoarseOffsetVolts: 0
PhaseACoarseVoltsPerAmp: 0.0011173621
PhaseAFineHallOffsetVolts: 0
PhaseBFineHallOffsetVolts: 0
PhaseCFineOffsetVolts: 0
PhaseAFineVoltsPerAmp: 0.004703646
PhaseBCoarseVoltsPerAmp: 0.0013163976
PhaseCCoarseVoltsPerAmp: 0.00114652
PhaseBFineVoltsPerAmp: 0.0053415336
PhaseCFineVoltsPerAmp: 0.0058397744
LoopVelPGain: 0.006
LoopVelIGain: 0.001
LoopVelDGain: 0
LoopVelTGain: 0
MaxTorqueSlewRate: 65
OvercurrentThresholdAmps: 680
OvertempThresholdCelsius: 88
ResolverPolesPerMotorPole: 2
MaxNpCapacitorVoltage: 450
EnableHvilAlarm: 0
ExtTempSensorType: 2
DeviceIdentifier: a7hvgw1n2ah94bmsmj8f1dfg70
HardwareRevision: 1
Over CANπ
Writingπ
We will go through the example of writing the ResolverOffsetDegrees to be 10 degrees.
Step 1. Prepare CAN Packetπ
Begin by crafting the Write EEPROM CAN Packet as per the format described in 0x01a (EEPROM Set Parameter). ResolverOffsetDegrees is Field ID: 1. We want to write 10 degrees. If convert 10 to little-endian f32 we get [0x00, 0x00, 0x20, 0x41]. So we want to transmit a Standard CAN packet with ID 0x1a and data field as shown below:
Step 2. Transmit CAN Packetπ
Ensure the motor controller is powered on and in the ReadyToSwitch state, see State Machine. Transmit the CAN packet.
Step 3. Validate ACK Packetπ
When you recieve the ACK packet as described in 0x01c (EEPROM Set Response), you should check it to validate the write was performed correctly. The data we should recieve back per this example is shown below.
Reading.π
We will go through the example of reading back the LoopIqPGain, for our case we will assume LoopIqPGain is 0.5.
Step 1. Prepare CAN Packetπ
Begin by crafting the Read EEPROM CAN Packet as per the format described in 0x01b (EEPROM Get Parameter). LoopIqPGain is field: 2. So we prepare the CAN packet data as shown below.
Step 2. Transmit CAN Packetπ
Ensure the motor controller is powered on and in the ReadyToSwitch state, see State Machine. Transmit the CAN packet.
Step 3. Validate Response Packetπ
When you recieve the response packet as described in 0x01d (EEPROM Get Response), you should check it to validate the write was performed correctly. The data we should recieve back per this example is shown below.