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

transfering a buffer of a single byte hits SPIM errata, causing 2 bytes to be clocked out #411

Open
korken89 opened this issue Nov 4, 2022 · 0 comments

Comments

@korken89
Copy link
Contributor

korken89 commented Nov 4, 2022

Hi,

When doing the following one hits errata 58 in https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_3_Errata_v1.1.pdf which causes the chip to clock out 2 bytes instead of only one.
Plus the CS line goes high while clocking causing weird things to happen on the bus.

The issues happen when RXD.MAXCNT = 1 and TXD.MAXCNT <= 1, which the code below hits.
I'm not sure how to best fix it.
Setting RXD.MAXCNT = 0 for 1 byte transactions fixes the issue but you also do not read a byte then, and some chips do send their status byte in every transaction during the first byte being sent - this would break this kind of status byte reading.

Code:

let mut buf = [Opcode::WriteEnable as u8];
spi.transfer(&mut cs, &mut buf).ok();

Trace:

image

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

No branches or pull requests

1 participant