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

Problem with read_multiple_data() function #4

Open
jaminturner opened this issue Apr 17, 2019 · 1 comment
Open

Problem with read_multiple_data() function #4

jaminturner opened this issue Apr 17, 2019 · 1 comment

Comments

@jaminturner
Copy link

There is a problem with the read_multiple_data() function in this library. It assumes you can send arbitrary register addresses to the ADXL355 and that it will give you the values in those registers. However, the ADXL355 implements an autoincrement scheme for multi-byte transactions. You send the first address, keep toggling the clock, and it will autoincrement and send the data out of the next register, then the next, etc. Subsequent addresses sent on the MOSI line will be ignored. After the first byte (which gives the start address and R/W bit), the ADXL355 ignores the MOSI line. Consequently, you can read multiple bytes, but you can only read them in order.

For example if you do read_multiple_data([0x0A, 0x09, 0x08]) you will not get back the values you think because the ADXL355 ignores the 0x09 and 0x08 bytes. Instead you will get back the values out of registers 0x0A, 0x0B, 0x0C.

@AlekseyFedorovich
Copy link

You are right, indeed in SPI libraries you normally specify the starting register and the number of bytes; not a list of registers

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

2 participants