Im trying to init an MCP23017 expander. The controller halts as soon as i start the data transfer. the goal is to set GPIOA1 to HIGH.
Maybe someone already had this problem, or could guide me to an answer. That would really help me.
Code: Select all
uint8_t init_mcp23017(void) {
mcp23017_status = 0x20;
palSetPadMode(TEENSY_PIN18_IOPORT, TEENSY_PIN18, PAL_MODE_OUTPUT_OPENDRAIN);
palSetPadMode(TEENSY_PIN19_IOPORT, TEENSY_PIN19, PAL_MODE_OUTPUT_OPENDRAIN);
i2cStart(&I2CD1, &i2ccfg);
tx[0] = 0;
tx[1] = 0;
//i2cAcquireBus(&I2CD1);
i2cMasterTransmitTimeout(&I2CD1, 32, tx, 2, rx, 0, 100);
tx[0] = 20;
tx[1] = 1;
i2cMasterTransmitTimeout(&I2CD1, 32, tx, 2, rx, 0, 100);
return mcp23017_status;
}