-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HOTFIX:Backport of second round upstream NuttX i2c fix (#6771)
backport 3cd66af and pr 258 Applies to STM32F4 and STM32F7 STM32, STM32 F7, and STM32 L4: Clone Freddie Chopin's I2C change to similar STM32 I2C drivers. Save elapsed time before handling I2C in stm32_i2c_sem_waitstop() This patch follows the same logic as in previous fix to stm32_i2c_sem_waitdone(). It is possible that a context switch occurs after I2C registers are read but before elapsed time is saved in stm32_i2c_sem_waitstop(). It is then possible that the registers were read only once with "elapsed time" equal 0. When scheduler resumes this thread it is quite possible that now "elapsed time" will be well above timeout threshold. In that case the function returns and reports a timeout, even though the registers were not read "recently". Fix this by inverting the order of operations in the loop - save elapsed time before reading registers. This way a context switch anywhere in the loop will not cause an erroneous "timeout" error.
- Loading branch information
David Sidrane
authored
Mar 10, 2017
1 parent
60c8c84
commit c967cad
Showing
1 changed file
with
142 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters