IDDAC #
Brief #
iddac (loaded by conf/template/id_dac.txt as id_dac) is a one shot identification on the F4 board that searches the F3 hardware overcurrent comparator threshold hv0.dac that trips at a wanted phase current cur (A peak). It drives hv0 in current mode itself, bisects the dac, and prints the hv0.dac = ... line to append to the config. Nothing is saved; for normal operation use ocdac or a fixed hv0.dac.
Component Explanation #
- Procedure:
- Set
conf0.max_ac_curto at least 1.1 xcur(1.2 x in mode 1).curmust be over 1 A, at mostcur_maxand undermax_cur / 1.05(mode 0) ormax_cur / 1.2(mode 1), otherwise the run fails withfail = 1. Too low amax_curalso lets the F3 software trip (fault 15) orfault0fire first and stop the run. link id_dac(or load the template). It disablespid0,fault0.pos_errorandfault0.sat, routeshv0.en,cmd_mode,d_cmd,q_cmd,posanddacfrom this component, and insertshv_errorbetweenhv0.faultandfault0.hv_error. The template setsmode = 1andcur = 20.- Enable the drive. The run starts on
en > 0,stategoes to 1, and at the end the result is printed in the console (green) or the failure reason (red). Append the printed line to the config and reset: a finished run (state = 2) is a one shot and does not repeat until reset; after a failure, droppingenreturnsstateto 0 and the next enable runs again. - Expect one comparator trip per ramp, a few dozen in all.
- Search (rt):
- The comparators are one-sided, so the bridge trips only with the current vector at 60, 180 and 300 deg el.
- For each dac tried: bridge off, wait for
hv_faultto clear (up to 2 s, elsefail = 3) and 0.1 s settle, then the d current ramps atrampA/s from 1 A (after 0.1 s alignment) until the F3 reportsHV_OVERCURRENT_HWor the ramp reachescur. After a trip the bridge stays off 0.3 s. - A dac passes when every tested angle trips by
cur.dac_lomust pass (elsefail = 4) anddac_himust fail (elsefail = 5); then bisection finds the highest passing dac, so no angle trips abovecur. - Any other hv fault during a ramp stops with
fail = 2.
- Mode 0, free axis:
posis set to the three fixed angles 60, 180, 300 deg in turn (the unloaded rotor aligns to them), so all three comparators are tested.
- Mode 1, loaded or blocked axis:
posfollows the rotor (com_pos) and the current stays on d, so it makes no torque and the rotor need not move.- The current vector then sits at the rotor angle or opposite it; each ramp takes the d sign whose vector lies within 30 deg of a trip angle and counts the current that phase sees,
|i| * cos(offset), againstcur(the vector goes up to 1.155 xcur). - One ramp per dac tests only the comparator of that phase: the result is in
trip0,trip1/trip2stay 0. Rotate the axis by hand between runs to check the others.
- Fault handling and outputs:
- While running,
HV_OVERCURRENT_HWtrips caused by the search are masked out ofhv_error; any otherhv_fault(and all faults when idle, done or failed) pass through tofault0. - With
en <= 0the bridge is off anddacoutputs the last result, ordac_lobefore the first run; an interrupted or failed run returnsstateto 0, a finished one keepsstate = 2. - On success or failure the comparator is left at the last passing dac (the result, or
dac_lo). cmd_modeis 1 (current mode) from nrt_init.
After
fail = 1(badcur) on the first run, thedacoutput is 0 untilendrops, because the search bounds were never set; the bridge stays off meanwhile. The console text forfail = 3also says “disabled”, but disabling does not setfail.
Pins #
| Name | Description |
|---|---|
| en | input, enable, from fault0.en_out |
| en_out | output, bridge enable, to hv0.en |
| cmd_mode | output, hv command mode, 1 = current, to hv0.cmd_mode |
| d_cmd | output, d current command (A peak), to hv0.d_cmd |
| q_cmd | output, q current command, always 0, to hv0.q_cmd |
| pos | output, electrical angle of the current vector (rad), to hv0.pos |
| dac | output, overcurrent comparator dac under test (0..4095), to hv0.dac |
| hv_fault | input, hv fault code, from hv0.fault |
| hv_error | output, hv0.fault without the HW overcurrent trips the search causes, to fault0.hv_error |
| max_cur | input, current limit (A peak), from conf0.max_ac_cur |
| com_pos | input, rotor electrical angle (rad), from fb_switch0.com_fb, used in mode 1 |
| mode | parameter, 0 = free axis (three angles), 1 = loaded or blocked axis (rotor d axis) |
| cur | parameter, wanted trip current (A peak), default 20 |
| cur_max | parameter, hard ceiling on cur (A peak), default 25 |
| ramp | parameter, current ramp rate (A/s), default 20 |
| dac_lo | parameter, search floor, must trip by cur, default 150 (ringing trips at 0 A below) |
| dac_hi | parameter, search ceiling, must not trip by cur, default 400 |
| state | output, 0 = idle, 1 = running, 2 = done, 3 = failed |
| fail | output, 0 = ok, 1 = bad cur, 2 = other hv fault, 3 = fault did not clear, 4 = dac_lo does not trip, 5 = dac_hi trips |
| trip0 | output, trip current at the result dac (A peak), 60 deg (mode 1: the tested phase) |
| trip1 | output, trip current at the result dac (A peak), 180 deg, mode 0 only |
| trip2 | output, trip current at the result dac (A peak), 300 deg, mode 0 only |
| trip_phase | output, mode 1: comparator tested, 0/1/2 = 60/180/300 deg |
References #
Source: .c File