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

[rtl] TWD idle when NoACK during reading #1158

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion rtl/core/neorv32_twd.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,10 @@ begin
engine.cnt <= (others => '0');
engine.sreg <= engine.rdata; -- FIFO TX data
engine.dout <= engine.rdata(7); -- FIFO TX data (first bit)
if (ctrl.enable = '0') then -- disabled?
if (
(ctrl.enable = '0') or -- disabled?
((engine.cmd = '1') and (smp.scl_rise = '1') and (smp.sda = '1') ) -- or no ACK while read?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, cou are checking for a STOP condition here, right?
Can't we use the smp.stop signal?

((engine.cmd = '1') and (smp.stop = '1')) -- STOP while read?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, as the stop signal is a SDA rise with SCL being one and not the other way around. This is more like reading the 9th bit: is the ack set or not? If not => I'm done (technically waiting for the stop), if yes => I send the next byte.

) then
engine.state <= S_IDLE;
elsif (smp.scl_fall = '1') then
engine.state <= S_RTX;
Expand Down
Loading