Skip to content

Fix truncation of device addresses 0x40 and above + various enhancements#12

Open
tonyle72 wants to merge 6 commits into0xArt:mainfrom
tonyle72:slave_address_fix
Open

Fix truncation of device addresses 0x40 and above + various enhancements#12
tonyle72 wants to merge 6 commits into0xArt:mainfrom
tonyle72:slave_address_fix

Conversation

@tonyle72
Copy link
Copy Markdown

@tonyle72 tonyle72 commented May 5, 2025

This update makes several fixes and improvements to the I2C master:

  • Fix truncation of device addresses 0x40 and above, caused by dropping of the saved_device_address MSB during barrel shifting. The testbench targets only one device address below 0x40, which is why this bug hasn't been caught until now.
  • Remove pulsing of serial_data_output_enable during S_READ_REG, to reduce wire contention during slave-output operation.
  • Update the testbench to instantiate and target two slaves at addresses 0x11 and 0x41, to verify the address-truncation fix.
  • Reclock busy to always mirror (state != S_IDLE). This allows busy to be used as a true not-ready indicator. Transaction parameters are now guaranteed to be captured when (reset_n && enable && !busy).
  • Use saved_device_address and saved_read_write (rather than the live inputs) to prep for slave-data receive, preventing any input changes outside of enable from sending a read operation astray.
  • Extend the low portion of SCL from a quarter to a half cycle during START.

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