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

Fix 'requestFrom' rollback issue and add a little more bullet proofing #50

Closed
wants to merge 3 commits into from
Closed

Conversation

ghost
Copy link

@ghost ghost commented Sep 1, 2020

  • Added 'busy' flag to enable slave time to finish processing previous request.

  • Moved the setting of SDA as input to SET_USI_TO_TWI_START_CONDITION_MODE. This
    helps to prevent conditions where SDA is held low indefinitely after a
    SET_USI_TO_SEND_ACK or SET_USI_TO_SEND_DATA, due to a missed clock pulse.

  • Added macro SET_USI_TO_TWI_OVERFLOW_MODE.

  • Added a timeout to wait for proper start condition latch. Helps with second
    point above.

  • Added function usiTwiHandleSTOP which is called when a stop condition is
    detected via TinyWireS_stop_check. This ensures use of new 'busy' flag.

  • TinyWireS_stop_check modified to use usiTwiHandleSTOP.

  • Reinstated multibyte 'requestFrom' by master functionality.

  • Added tws_delay_micros function.

  • Added a few more comments and reduced some confusion resulting from mixing up
    the roles of 'Master read' and 'Master write' with what the slave is doing.
    I think that one actually came from the app note and original source!

  • Tested with ATtiny85 (1MHz) and SAMD21 (48MHz) as master.

  • Fixes issue Surprise, as of f0eb04f the communication doesn't work anymore, only 255 response #44 . Potentially helps with issues Feature Suggestion #24 , Requesting multiple bytes: the correct way #36 , Request Callback is not triggered #43 and Read only gives 0xFF on Attiny85 #47 ?

Andrew Cunningham and others added 3 commits September 1, 2020 15:51
* Added 'busy' flag to enable slave time to finish processing previous request.

* Moved the setting of SDA as input to SET_USI_TO_TWI_START_CONDITION_MODE. This
  helps to prevent conditions where SDA is held low indefinitely after a
  SET_USI_TO_SEND_ACK or SET_USI_TO_SEND_DATA, due to a missed clock pulse.

* Added macro SET_USI_TO_TWI_OVERFLOW_MODE.

* Added a timeout to wait for proper start condition latch. Helps with second
  point above.

* Added function usiTwiHandleSTOP which is called when a stop condition is
  detected via TinyWireS_stop_check. This ensures use of new 'busy' flag.

* TinyWireS_stop_check modified to use usiTwiHandleSTOP.

* Reinstated multibyte 'requestFrom' by master functionality.

* Added tws_delay_micros function.

* Added a few more comments and reduced some confusion resulting from mixing up
  the roles of 'Master read' and 'Master write' with what the slave is doing.
  I think that one actually came from the app note and original source!

* Tested with ATtiny85 (1MHz) and SAMD21 (48MHz) as master.
* Added a timeout (ms) that can be set within TinyWireS.begin().
  The timeout is used when checking for a frozen bus within
  TinyWireS.stateCheck() and when checking if it is safe to sleep
  within TinyWireS.sleepMode().

* TinyWireS.sleepMode() added to check the bus is idle prior
  sleep. This helps to prevent bus lockups when entering the sleep
  state. usiTwiSetSleep added as the backend function.

* busActive flag added and TinyWireS.busActive() written to check
  bus state. usiTwiIsBusActive added as backend.

* TinyWireS_stop_check replaced with TinyWireS.stateCheck().
  This new routine checks for stop as well as a bus freeze.
  Examples updated.
@ghost ghost closed this Sep 23, 2020
@ghost ghost deleted the testing branch September 23, 2020 01:21
@rambo
Copy link
Owner

rambo commented Sep 23, 2020

hmmh ? merged to somewhere else ?

@ghost
Copy link
Author

ghost commented Sep 24, 2020 via email

This pull request was closed.
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

Successfully merging this pull request may close these issues.

1 participant