Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition in ow.write() / ow.write_bytes() with power=1 #1797

Closed
devsaurus opened this issue Feb 12, 2017 · 0 comments
Closed

Race condition in ow.write() / ow.write_bytes() with power=1 #1797

devsaurus opened this issue Feb 12, 2017 · 0 comments

Comments

@devsaurus
Copy link
Member

There's a race for ow.write() / ow.write_bytes() with power enabled between the driver code to activate the strong output driver and any random interrupt. Looking at `onewire_write_bit() for the 0 case:

  • write '0' slot generation is protected against interrupts
  • unprotected phase begins and contains some µs delay plus the return back to onewire_write()
  • interrupts are masked again and the output driver is activated in line 175

If an interrupt occurs during the unprotected phase or a previously pending interrupt gets scheduled, the delay between the last bit's write slot and the activation of the strong output driver will be extended by some 10s of microseconds. This is a potential stability issue for ds18b20 et.al. sensors in parasite power mode which dictate TSPON(max) to be 10 µs.

I suspect that the strong driver has to be activated at the end of the last bit, still within the phase where interrupts are masked by onewire_write_bit().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants