Commit 9db207a
Improve bus recovery (#1767)
If the esp32 is reset during a i2c read cycle the slave device may be in control of the SDA line.
If the SDA line is held low, the esp32 cannot issue a START or STOP to recover the bus.
The previous code did not correctly configure the SCL output pin, and it cycled SCL 9 times with SDA Low. Since the slave device was in a READ cycle, it just continued outputting the bits of the current byte. When the ACK/NAK bit space occurred, The low output value of SDA was interpreted as ACK so the slave device continued with the next byte. It never terminated the READ cycle.
This new code will correctly recover from an interrupted READ1 parent a989853 commit 9db207a
1 file changed
+11
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1350 | 1350 | | |
1351 | 1351 | | |
1352 | 1352 | | |
1353 | | - | |
1354 | | - | |
| 1353 | + | |
| 1354 | + | |
1355 | 1355 | | |
1356 | | - | |
| 1356 | + | |
1357 | 1357 | | |
1358 | 1358 | | |
1359 | | - | |
1360 | | - | |
| 1359 | + | |
| 1360 | + | |
1361 | 1361 | | |
1362 | 1362 | | |
1363 | | - | |
1364 | | - | |
| 1363 | + | |
1365 | 1364 | | |
1366 | | - | |
1367 | | - | |
1368 | 1365 | | |
1369 | 1366 | | |
1370 | 1367 | | |
1371 | 1368 | | |
1372 | 1369 | | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
1373 | 1374 | | |
1374 | | - | |
1375 | | - | |
1376 | 1375 | | |
1377 | 1376 | | |
1378 | 1377 | | |
1379 | | - | |
| 1378 | + | |
1380 | 1379 | | |
1381 | 1380 | | |
1382 | 1381 | | |
| |||
0 commit comments