Skip to content

Conversation

@qwandor
Copy link
Member

@qwandor qwandor commented Apr 12, 2024

The Twi implementation is untested as I don't have any nrf51 devices.

Unfortunately the Twim implementation isn't working correctly. Adjacent operations of the same type are specified to be carried out without an SR and SAD+R/W, which is why I avoid setting the lastrx_stop or lasttx_stop shortcut in that case, but when testing this I've found that trying to have two read operations in a row results in an overrun error for some reason.

@qwandor qwandor marked this pull request as ready for review April 15, 2024 14:46
Copy link
Member

@9names 9names left a comment

Choose a reason for hiding this comment

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

Don't have time for a couple of days to test this out again, but logic looks good.

}

fn write_part(&mut self, buffer: &[u8], final_operation: bool) -> Result<(), Error> {
unsafe { self.set_tx_buffer(buffer)? };
Copy link
Member

Choose a reason for hiding this comment

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

No fence required here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not entirely sure. Added some more fences to be on the safe side.

@qwandor
Copy link
Member Author

qwandor commented Apr 16, 2024

Don't have time for a couple of days to test this out again, but logic looks good.

I tested the Twim implementation on a Microbit v2 with various combinations of writes and reads (including consecutive reads), and the Twi implementation hasn't changed since you tested it so I think this should be fine.

@qwandor qwandor merged commit ead3042 into master Apr 16, 2024
@qwandor qwandor deleted the i2c branch April 16, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants