mirror of https://github.com/ARMmbed/mbed-os.git
Issue #666 LPC1768 i2c_slave_read fix
LPC1768 slave issues a STOP condition without waiting for master #666: https://developer.mbed.org/forum/bugs-suggestions/topic/5266/pull/1473/head
parent
1c75638d14
commit
929cf7ffe4
|
@ -350,11 +350,18 @@ int i2c_slave_read(i2c_t *obj, char *data, int length) {
|
|||
count++;
|
||||
} while (((status == 0x80) || (status == 0x90) ||
|
||||
(status == 0x060) || (status == 0x70)) && (count < length));
|
||||
|
||||
|
||||
// Clear old status and wait for Serial Interrupt.
|
||||
i2c_clear_SI(obj);
|
||||
i2c_wait_SI(obj);
|
||||
|
||||
// Obtain new status. (See Image-2)
|
||||
status = i2c_status(obj);
|
||||
|
||||
if(status != 0xA0) {
|
||||
i2c_stop(obj);
|
||||
}
|
||||
|
||||
|
||||
i2c_clear_SI(obj);
|
||||
|
||||
return count;
|
||||
|
|
Loading…
Reference in New Issue