-
Notifications
You must be signed in to change notification settings - Fork 7
MSA301 library appears to be incompatible with M0 Basic #12
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
Comments
oh yknow this should be a UnaryStruct instead... since its 3 x 16-bit values. is this adaptation something you could try doing and submitting a fix? |
Only if you are willing to wait quite a while for any result.
I'm fairly adept at programming in C and several other dinosaur languages
but I'm using this project to try to learn enough Python to remain relevant
in this century. And while I do understand the foundations of both
compiled and interpreted languages (functional languages still give me
pause) it's been a minute since I've actually worked with any compilers or
interpreters.
I'll keep this in mind, however, as I claw my way up the learning curve; it
sounds quite intriguing.
Marc
…On Thu, Dec 31, 2020 at 2:35 PM ladyada ***@***.***> wrote:
oh yknow this should be a UnaryStruct instead... since its 3 x 16-bit
values. is this adaptation something you could try doing and submitting a
fix?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF5GZPQLFNJB7FKTPUYWBVLSXT4BXANCNFSM4VPY23NA>
.
|
hihi i submitted a fix :) when this issue is closed, look for the latest release for the mpy file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I recently got a Feather M0 Basic controller and the MSA301 accelerometer for a new project. When I tried to load the basic test program, I get an unexpected error message. The M0 Basic info is: Adafruit CircuitPython 6.0.0 on 2020-11-16; Adafruit Feather M0 Basic with samd21g18
The Circuit Python program (as copied from the documentation) is:
import time
import board
import busio
import adafruit_msa301
i2c = busio.I2C(board.SCL, board.SDA)
msa = adafruit_msa301.MSA301(i2c)
while True:
print("%f %f %f" % msa.acceleration)
time.sleep(0.5)
When loaded to the M0 Basic, the error message is:
Traceback (most recent call last):
File "code.py", line 4, in
File "adafruit_msa301.py", line 207, in
File "adafruit_msa301.py", line 233, in MSA301
File "adafruit_register/i2c_bits.py", line 61, in init
OverflowError: small int overflow
I checked on the Discord Adafruit Circuit Python channel and both jerryn and Jeff E. were extremely helpful in chasing down this issue. From their comments, specifically from Jeff E., the issue could be:
"Line 233: _xyz_raw = ROBits(48, _MSA301_REG_OUT_X_L, 0, 6)
"This specifies that the "xyz raw" register has 48 bits, which it will try to treat as a single integer value. This doesn't work in M0 builds, because they don't support "long integers", they only support integers 30 bits long (31 bits? anyway, fewer than 48 and even fewer than the customary 32).
"... I think there's a reasonable possibility it can be modified to get rid of this particular use of a 48 bit quantity. Instead of using RWBits for this particular data, you would use a 6-byte readinto() followed by a struct.unpack. It's all a conjecture from me though"
Thanks for your kind consideration,
Marc Wells
The text was updated successfully, but these errors were encountered: