-
Notifications
You must be signed in to change notification settings - Fork 11
DMCC
- status bits always 0
- power can't be read (always 0)
- PID w/ integral term doesn't track, especially velocity
- position PID always at full power, needs option to limit
Battery, dual MicroFit connector in center:
- 2x Top : GND
- 2x Bot : V_Bat (closest to board)
The top and bottom pairs are electrically joined, and do not go to specific motors. The extra wires are there simply to create a higher effective gauge.
Polou Connector (Power + QEI):
(ref: http://www.pololu.com/product/2275)
Re: Motor power
Bk: Motor GND
Gr: Encoder GND
Bu: Encoder Vcc (3.3V - 20V)
Ye: Encoder Out A
Wh: Encoder Out B
DMCC QEI (left to right from BB-P8 to P9):
QEI1-1 (Re) 5V
QEI1-2 (Gr) QEI1_A?
QEI1-3 (Bk) GND
QEI1-4 (Ye) QEI1_B?
QEI2-1 (Re) 5V
QEI2-2 (Gr) QEI2_A?
QEI2-3 (Bk) GND
QEI2-4 (Ye) QEI2_B?
Wire reassignment when connecting from DMCC to Pololu encoders (which are also reordered from stock):
(Wh/Ye tape side) (encoder wire colors, not the physical order)
Re 5V --> Bl
Ye QEI --> QEI_B Wh
Gr QEI --> QEI_A Ye
Bk GND --> Gr
(non-tape side)
Each motor can be in 1 of 4 modes:
- 00 - power (static power setting)
- 01 - PID position
- 10 - PID velocity
- 11 - Fault
All capes are on the BBB I2C2 bus (P19,P20), which is i2c-1 on linux
Cape EEPROMs map 1-to-1 to DMCC address:
Cape EEprom DMCC I2c DMCC Board DMCC Switch
1-0x54 1-0x2c 0
1-0x55 1-0x2d 1 1-ON 2-OFF
1-0x56 1-0x2e 2
1-0x57 1-0x2f 3
EEPROMs show up as UU since they are registered with a kernel device driver DMCC PIC chip is not registered, so shows up by number as an unbound device
root@arm:~# i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- 2d -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
EEPROM dump:
# od -c /sys/bus/i2c/devices/1-0055/eeprom
0000000 252 U 3 356 A 0 D M C C ( D u a l
0000020 M o t o r C o n t r o l C
0000040 a p e ) \0 \0 M k 0 6 E x a d l e
0000060 r . c o m \0 \0 \0 \0 \0 D M C C M
0000100 k . 0 6 \0 \0 \0 \0 \0 \0 \0 \0 0 0 0 2
0000120 9 \n \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
WARNING: All reads are single bytes (8-bits). Executing 16-bit reads will cause the DMCC to lock up the i2c bus and require power cycle
Commands:
i2cget -y 1 0x2[cdef] <register addy>
i2cdump -y -r 0x00-0xef 1 0x2[cdef]
Testing based on Exadler protocol document:
Motor status: ??
0x00 R Status Always returns 0x00 ??
0x01 R? Polarity Always returns 0x00 ??
Power values:
[-10000,10000] (two's compliment)
Settings take effect only after writing to 0xff (see 0xff for values)
0x02 RW M1 Power low bit
0x03 RW M1 Power high bit
0x04 RW M2 Power low bit
0x05 RW M2 Power high bit
QEIs: 32-bit, only correct after refresh
0x10 R QEI1 Pos low bit
0x11
0x12
0x13 R QEI1 Pos high bit
0x14 R QEI2 Pos low bit
0x15
0x16
0x17 R QEI2 Pos high bit
0x18 R QEI1 Vel low bit
0x19 R QEI1 Vel high bit
Targets:
0x20
0x2b
PID Error:
0x2e ???
0x2f
PID values
Docs say these values are *256 for the sake of integer calcs, but it seems
that is completely internal to the PIC firmware
0x30 RW M1 Pos Kp low bit
...
0x4b RW M2 Vel Kd high bit
Cape version "DMCC Mk.06"
0xe0
..
0xef
Refresh: i2cset -y 1 0x2d 0xff 0x00
import DMCC # DMCC.so should be in path
# dmcc_id:[0,3], motor_id:[1,2]
# sets motor power: [-10000,10000]
# motor indicator light will be green when +, red when -
DMCC.setMotor(dmcc_id, motor_id, powe0x2dcr)
# Battery voltage in volts
DMCC.getMotorVoltage(dmcc_id)
# Battery voltage in millivolts (integer)
DMCC.getMotorVoltageInt(dmcc_id)
# returns QEI position (at least [-1M, +1M], probably 32-bit)
DMCC.getQEI(dmcc_id,motor_id)
# returns QEI velocity [-X,+X]
DMCC.getQEIVel(dmcc_id,motor_id)
# PID values are [-32768,32767]
# pos_or_vel: Pos = 0 , Vel = 1
#
# NB: each mode (pos/vel) has its own set of PID constants
#
# Example constants from sample program: -5248 -75 -500 (for position, seem reasonable)
# If velocity doesn't reach target, increase I to eliminate SSE
# (-20000,-30000, 000) almost track but has massive overshoot, especially when slowing
# can't track vel=0 with such a high I
DMCC.setPIDConstants(dmcc_id, motor_id, pos_or_vel, kp, ki, kd)
# these need PID set before they work
DMCC.setTargetPos(1,1,position)
DMCC.setTargetVel(1,1,velocity)
Control theory notes SSE of P controller: error = Input/(1+Kp)
Test motor's max vel: ~ [-275,280]
Convert signed hex:
unpack('h',pack('H',0xec78)) # MSB to LSB
Decode hex:
'444d4343204d6b2e3036'.decode('hex')