arduino / arduino/ArduinoCore-avr

Arduino Wire as a slave stops responding if the data is NACK'ed after TW_SR_DATA_NACK or TW_SR_GCALL_DATA_NACK

Open
#116 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

The slave stops responding to any data on the bus after twi-reply(0) gets called.
https://github.com/arduino/Arduino/blob/378736e6883ccc74cd26cf7202115b9ee1413794/hardware/arduino/avr/libraries/Wire/src/utility/twi.c#L510-L515

The line
https://github.com/arduino/Arduino/blob/378736e6883ccc74cd26cf7202115b9ee1413794/hardware/arduino/avr/libraries/Wire/src/utility/twi.c#L513
should be `twi_reply(1); ` to allow the slave's to respond and allow own SLA to be recognized;

Check datasheet http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf: page 285

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in hardware/arduino/avr/libraries/Wire/src/utility/twi.c around lines 510-515 and compare the TW_SR_DATA_NACK and TW_SR_GCALL_DATA_NACK behavior with page 285 of the linked ATmega328P datasheet. Verify the response handling after twi_reply(0), then confirm that the slave continues responding to subsequent bus data and recognizes its own SLA.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.