-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TWID bug #72
Comments
Hello, Alternatively, one may renew the call to
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I find that when sending a single byte write followed by a multi byte read, that it is failing.
static struct _twi_desc tw = { .addr = FLEXTWI2, .freq = 100000, .slave_addr = CLOCK_BUS_ADDR >> 1, .transfer_mode = BUS_TRANSFER_MODE_POLLING, .timeout = 0}; twid_configure(&tw); struct _buffer buf[] = { { .data = (unsigned char*) "\0\0", .size = 1, .attr = (int) BUS_BUF_ATTR_TX | BUS_I2C_BUF_ATTR_START}, { .data = (unsigned char*) &static_clock_data, .size = sizeof(RTCC), .attr = (int) BUS_BUF_ATTR_RX | BUS_I2C_BUF_ATTR_START | BUS_I2C_BUF_ATTR_STOP } }; twid_transfer(&tw, buf, 2, NULL);
The problem is that the byte sent must be finished before sending the restart. To fix, it appears that in _twid_poll_write it should be
if (size == (buffer->size - 1)) { if (_check_tx_timeout(desc)) return -ETIMEDOUT; twi_write_byte(desc->addr, buffer->data[i]); while(!twi_is_byte_sent(desc->addr));//<<--- Add this line or suggest better }
The text was updated successfully, but these errors were encountered: