More I2C register talk

Posted on August 29, 2014


Vnevoa: Man, I hate hidden stuff! You’re cooking up an addressing scheme inside another addressing scheme. I don’t like that.

Of course I’m doing all the read/write operations by the book, with addressing. That’s one lesson I learned the hard way at Siemens. 😉 I like the serial EEPROM addressing scheme and I’d like to keep it. That way everything is in the clear and there’s no hidden states or data mix-ups. Each register has its own function and address and that’s it. If we need more regs, we create them.

The code you’re watching in the repo is for the MD03 bridge, not yours. I’ve got a different Python class for each one, obviously. 😉 I haven’t updated it because this MD03 version is the latest and greatest.

Changing the SW Revision register’s place would be bad practice. It has to stay in the same place in all versions.

Other than that, we can define anything we like. So, I suggest:

// The registers we support. Can be read, some written, through I2C:
 enum {
    eI2cReg_Status = 0,       // R status b0:over-current, b1:over-temperature, b2:busy, b3:?,  b4~b7: heartbeat (RO)
    eI2cReg_Command = 1,      // R/W command b0: "0" = motoring/freewheeling, 1 = "dissipative braking"
    eI2cReg_Speed = 2,         // R/W speed/direction  b7: direction; b0~6: Speed
    eI2cReg_MotorTemp = 3,     // R motor temperature
    eI2cReg_HBridgeTemp = 4,   // R hbridge temperature
    eI2cReg_HBridgeVcc = 5,    // R hbridge power supply voltage
    eI2cReg_MotorCurrent = 6,  // R motor current
    eI2cReg_SwRev = 7 // R read software revision 

(to be continued…)Lisbon_MMF_logos_Banner_big