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

STM32: Check for NACK #6687

Merged
merged 2 commits into from
Sep 22, 2024
Merged

STM32: Check for NACK #6687

merged 2 commits into from
Sep 22, 2024

Conversation

nefelim4ag
Copy link
Contributor

@nefelim4ag nefelim4ag commented Sep 12, 2024

stm32f0_i2c - tested.
stm32/i2c - I do not have.

Currently, HW I2C ignores NACK bit in any case.
Valid case when this is the end of the transfer.
With this change, it will correctly report NACK instead of an empty read or timeout.

reproduce:

def _init_sht3x(self):
        ....
        logging.warning("sht3x: start read with stretching")
        self.i2c.i2c_read(SHT3X_CMD['MEASURE']['STRETCH_ENABLED']['HIGH_REP'], 6)
        logging.warning("sht3x: stop read with stretching")
        logging.warning("sht3x: start read without stretching")
        self.i2c.i2c_read(SHT3X_CMD['MEASURE']['STRETCH_DISABLED']['HIGH_REP'], 6)
        logging.warning("sht3x: stop read without stretching")

Output with patch:

Configured MCU 'host' (1024 moves)
sht3x: start read with stretching
sht3x: stop read with stretching
sht3x: start read without stretching
Transition to shutdown state: MCU shutdown
Dumping 7 requests for client 140733793436160
 .....
MCU 'mcu' shutdown: I2C NACK error encountered!
 .....
Printer is shutdown

Thanks.


#6674

@KevinOConnor
Copy link
Collaborator

Thanks. In general it seems fine to me. I think we should avoid adding punctuation to error strings (in keeping with existing messages) - so no exclamation mark.

-Kevin

@nefelim4ag
Copy link
Contributor Author

nefelim4ag commented Sep 13, 2024

Oh, I just thinking about avoiding increasing ROM size, so just reused https://github.com/Klipper3d/klipper/blob/master/src/atsam/i2c.c#L139
But this is a different mcu.

Np, updated.

Signed-off-by: Timofey Titovets <[email protected]>
Signed-off-by: Timofey Titovets <[email protected]>
@nefelim4ag nefelim4ag mentioned this pull request Sep 14, 2024
@KevinOConnor KevinOConnor merged commit d9236f1 into Klipper3d:master Sep 22, 2024
1 check passed
@KevinOConnor
Copy link
Collaborator

Thanks.

-Kevin

miklschmidt pushed a commit to Rat-OS/klipper that referenced this pull request Oct 16, 2024
Misterke pushed a commit to Misterke/klipper that referenced this pull request Nov 1, 2024
Signed-off-by: Timofey Titovets <[email protected]>
Co-authored-by: Timofey Titovets <[email protected]>
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.

2 participants