I took the template from the I2C AVR port and this doesn't seem to work. Before I start debugging, let me post the question, maybe I don't understand something simple:
This causes the I2C driver to hang:
i2c_lld.c:
Code: Select all
OSAL_IRQ_HANDLER(TWI1_Handler) {
OSAL_IRQ_PROLOGUE();
.
.
.
if (i2cp->errors != I2C_NO_ERROR) {
_i2c_wakeup_error_isr(i2cp);
}
OSAL_IRQ_EPILOGUE();
}
msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr,
const uint8_t *txbuf, size_t txbytes,
uint8_t *rxbuf, size_t rxbytes,
systime_t timeout) {
.
.
return osalThreadSuspendTimeoutS(&i2cp->thread, timeout);
}
Commenting-out "_i2c_wakeup_error_isr(i2cp);" makes the i2c timeout. What am I doing wrong or this is outside of I2C?