Merged
Conversation
The ch32v chips borrow a lot from the STM32 peripherals, and so I was able to take a lot from the stm32 hal. It seems, however, that they diverge in the behaviour here: The STM32 I2C HALs I read check signal BTF, rather than RxNE, so they set the NACK a byte earlier.
There was a problem hiding this comment.
🔍 Lint Results
ℹ️ Additional issues on unchanged lines
The following 1 issue(s) exist but are not on lines changed in this PR:
port/wch/ch32v/src/hals/i2c.zig:16: Suggestion: Rename `I2cRegs` to `I2C_Regs`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
mattnite
approved these changes
Jan 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ch32v chips borrow a lot from the STM32 peripherals, and so I was able to take a lot from the stm32 hal. It seems, however, that they diverge in the behaviour here: The STM32 I2C HALs I read check signal BTF, rather than RxNE, and they set the NACK a byte earlier.
Noticed this while playing with the ICM-20948 driver. My original PR was only tested lightly with i2c-bus-scan, which never had to do reads over 1 byte.