Skip to content

Commit 2347a6d

Browse files
committed
Added wait to i2c stop
1 parent b7b4a9c commit 2347a6d

File tree

1 file changed

+7
-0
lines changed
  • libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F

1 file changed

+7
-0
lines changed

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/i2c_api.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ int i2c_start(i2c_t *obj) {
5757
}
5858

5959
int i2c_stop(i2c_t *obj) {
60+
volatile uint32_t n = 0;
6061
i2c_hal_send_stop(obj->instance);
62+
63+
// It seems that there are timing problems
64+
// when there is no waiting time after a STOP.
65+
// This wait is also included on the samples
66+
// code provided with the freedom board
67+
for (n = 0; n < 100; n++) __NOP();
6168
first_read = 1;
6269
return 0;
6370
}

0 commit comments

Comments
 (0)