Other Parts Discussed in Thread: MCF8316AEVM, MOTORSTUDIO
Tool/software:
Hello,
I designed a custom board with a MCF8316C-Q1 driver interfaced with a MCU. I developed a driver to write and read the registers via I2C, without CRC.
I succeeded in doing the following :
- Read a register content
- Write new content to that register
- Readback that new value from the register
Therefore, I believe my implementation is fine. However, the change is never effective. Meaning, it is not reflected on the chips behavior.
The hardware pins are as follows :
- DRVOFF: Low
- SPEED: Low (intended to be used in I2C speed control)
- BRAKE: Low
- DIR: Low
- ALARM : LOW
- Fault: high-Z
I have a MCF8316AEVM on hand. I wired the I2C lines to my circuit and can control the driver as intended through MotorStudio. Therefore, the issue is not with the hardware design or soldering. The hardware pins are also set properly.
Am I missing some step when programming the registers ? I do not intend to write the EEPROM, so I am not calling the register 0x000000EA with EEPROM Read / Write bit. But is there another bit that should be raised in order for the register to be applied ?
If that can help, here is a snippet from my I2C write function. The forming of the address byte is not shown here.
Thank you !
// Build 24 bits Control Word : datasheet 7.6.2.1
// WRITE operation: OP_R/W = 0b0;
controlWord = 0b0 << 23;
// CRC Disabled: CRC_EN = 0b0;
controlWord |= 0b0 << 22;
// Data Length is 32 bits: DLEN = 0b01
controlWord |= 0b01 << 20;
// Memory Section: MEM_SEC = 0x0
// Memory Page: MEM_PAGE = 0x0
// Memory address : is casted on 12 bits
controlWord |= address & 0xFFF;
mfc8316c->i2cData.writeBuffer[0] = (controlWord >> 16) & 0xFF;
mfc8316c->i2cData.writeBuffer[1] = (controlWord >> 8) & 0xFF;
mfc8316c->i2cData.writeBuffer[2] = controlWord & 0xFF;
// Build Data Word
mfc8316c->i2cData.writeBuffer[3] = (data >> 24) & 0xFF;
mfc8316c->i2cData.writeBuffer[4] = (data >> 16) & 0xFF;
mfc8316c->i2cData.writeBuffer[5] = (data >> 8) & 0xFF;
mfc8316c->i2cData.writeBuffer[6] = data & 0xFF;
// Write I2C output buffer on the bus
mfc8316c->i2cData.writeLength = 7;