Merge pull request #1394 from openmv/cambus_fix_scan

Fix cambus getting stuck sometimes after failed scan.
This commit is contained in:
Ibrahim Abd Elkader 2021-07-15 00:25:42 +02:00 committed by GitHub
commit 1919d4384a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -264,7 +264,13 @@ int cambus_scan(cambus_t *bus)
return (addr << 1);
}
}
#if defined(STM32H7)
// After a failed scan the bus can get stuck. Re-initializing the bus fixes
// it, but it seems disabling and re-enabling the bus is all that's needed.
__HAL_I2C_DISABLE(bus->i2c);
mp_hal_delay_ms(10);
__HAL_I2C_ENABLE(bus->i2c);
#endif
return 0;
}