-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
Description of defect
When trying to read a byte from I2C every first call read() is done. The second call is not actually done it only returns ACK: 1 even if i put a 1s delay between those two calls. This is a problem in OS6, in OS5.15 this works as intended.
Target(s) affected by this defect ?
STM32F412
Toolchain(s) (name and version) displaying this defect ?
GCC_ARM
What version of Mbed-os are you using (tag or sha) ?
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
mbed-cli
How is this defect reproduced ?
An example read from I2C eeprom
#include "mbed.h"
I2C i2c(PB_7, PB_6);
int main() {
char buf[1];
for (size_t i = 0; i < 2; i++) {
int ack = i2c.read(0x50 << 1, buf, 1);
printf("ack=%i\n", ack);
// ThisThread::sleep_for(1s);
}
return 0;
}add debug to I2C read()
https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/i2c_api.c#L914-L920
if ((timeout == 0) || (obj_s->event != I2C_EVENT_TRANSFER_COMPLETE)) {
DEBUG_PRINTF(" TIMEOUT or error in i2c_read\r\n");
/* re-init IP to try and get back in a working state */
i2c_init_internal(obj, NULL);
+ printf("timeout\n");
} else {
count = length;
}Results:
This is OS6
ack=0
timeout
ack=1
This is OS5.15.6 (b114a9c)
ack=0
ack=0

