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

⚠️ rework TWI module #865

Merged
merged 10 commits into from Mar 27, 2024
Merged

⚠️ rework TWI module #865

merged 10 commits into from Mar 27, 2024

Conversation

stnolting
Copy link
Owner

@stnolting stnolting commented Mar 26, 2024

✨ Add Configurable TWI FIFO

An optional FIFO is implemented that can be used to "program" long sequences of TWI operations (START conditions, repeated START conditions, STOP conditions, data transmissions) without further interaction of the CPU. The FIFO is configured by a new top generic:

IO_TWI_FIFO : natural range 1 to 2**15 := 1;

⚠️ Rework TWI Core

  • remove support for clock-stretching
  • remove bus state sensing
  • rework low-level interface / HAL
  • interrupt will fire when the FIFO is empty and no bus operation is pending

@stnolting stnolting added enhancement New feature or request HW hardware-related labels Mar 26, 2024
@stnolting stnolting self-assigned this Mar 26, 2024
@stnolting stnolting added the SW software-related label Mar 26, 2024
add non-blocking functions
- add configurable data/command FIFO
- remove clock-stretching
- remove bus sensing
- fire IRQ if TX FIFO is empty and no bus operation is in progress
@stnolting stnolting marked this pull request as ready for review March 27, 2024 16:53
@stnolting stnolting merged commit 6c30ec1 into main Mar 27, 2024
10 checks passed
@stnolting stnolting deleted the rework_twi branch March 27, 2024 19:35
@NikLeberg
Copy link
Collaborator

Hi @stnolting, I just skimmed the changes and saw that clock stretching detection was removed. Is it gone for good? So very simple TWI devices that require clock stretching will no longer work?

@stnolting
Copy link
Owner Author

After reading this great guide provided by AdaFruit, I had the feeling that clock stretching is not a good idea 🤔

Furthermore, I do not know of any off-the-shelve components that actually use clock stretching.

However, maybe I was too hasty. Do you think this is a handy feature that we should add again?

@NikLeberg
Copy link
Collaborator

I don't think that clock stretching is all that bad. But of course slaves that do it in weird ways could be a pain.

The BNO055 which also AdaFruit mentions is actually a sensor that utilises/requires clock stretching. I used it together with an ESP32 without problems. And I think to remember seeing actual clock stretching on my digital logic analyzer.

I havent used the BNO055 (a really excellent sensor I have to say) with NEORV32. So I don't know if the previously present clock stretching detection would have worked. But if it does not cause too much hastle I'd recommend or actualy prefer the functionality brought back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request HW hardware-related SW software-related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants