Skip to content

bug in twi.c which effectively disconnects TWI/I²C after an error in Slave Receiver mode [imported] #242

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

Open
cmaglie opened this issue Nov 15, 2012 · 0 comments
Assignees

Comments

@cmaglie
Copy link
Member

cmaglie commented Nov 15, 2012

This is Issue 486 moved from a Google Code project.
Added by 2011-02-26T20:06:51.000Z by dmel...@gmail.com.
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Defect, Priority-Medium, Component-Core

Original description

From http://arduino.cc/forum/index.php/topic,53131.0.html:

"Hello..
there is a bug in twi.c which effectively disconnects TWI/I²C after an error in Slave Receiver mode.

The bug is in SIGNAL(TWI_vect) at case label TW_SR_DATA_NACK/TW_SR_GCALL_DATA_NACK

the wrong code is:
// nack back at master
twi_reply(0);

This should be:
twi_reply(1);

Explanation: See ATmegaxxx Documentation (doc8161.pdf) from Atmel. In Fig. 21-16 on page 236 the states $88 (TW_SR_DATA_NACK) and $98 (TW_SR_GCALL_DATA_NACK) are final states. There is nothing to "nack back at master". This has already been done! Unlike the $80 (TW_SR_DATA_ACK) and $90 (TW_SR_GCALL_DATA_ACK) states, there will be no $A0 state (TW_SR_STOP) to terminate. Table 21-4. on page 235 shows that if we now leave TWEA off, we will never be able again to be selected as receiver. Calling twi_reply(1) will set TWEA and thus allow further selection as slave."

tbowmo referenced this issue in tbowmo/Arduino Jul 14, 2016
Update MyMainESP8266 to compile with ESPlib 2.3.0
@sandeepmistry sandeepmistry transferred this issue from arduino/Arduino Sep 16, 2019
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

1 participant