geekmomprojects / SuperCon2022

Documentation for the motion-reactive wearables workshop at SuperCon2022
MIT License
3 stars 0 forks source link

unable to load demo sketches from code.py due to IMU_PWR error #1

Open Drc3p0 opened 1 year ago

Drc3p0 commented 1 year ago

I'm using Mu 1.1.1 on a macbook pro w/ M1 processor. I have loaded the firmware onto my XIAO SENSE so that it shows up as CIRCUITPY, where I have loaded these files onto it. I am able to run step0_circuitpython.py by uncommenting line 7 in code.py, but I am not able to load any of the other files when uncommenting their corresponding lines:

From the serial monitor for step1_accelerometer.py:

code.py output:
Traceback (most recent call last):
  File "code.py", line 10, in <module>
  File "demos/step1_accelerometer.py", line 14, in <module>
AttributeError: 'module' object has no attribute 'IMU_PWR'

Same issue when trying to run step2_neopixels.py

code.py output:
Traceback (most recent call last):
  File "code.py", line 13, in <module>
  File "demos/step2_neopixels.py", line 11, in <module>
  File "/lib/imu.py", line 9, in __init__
AttributeError: 'module' object has no attribute 'IMU_PWR'

Has anyone else had this error? Would love to know what the solution to this is.

geekmomprojects commented 1 year ago

If you run Step0, then hit ctrl-c in the REPL, you'll get a line just before the cursor appears in the serial window telling you which version of CircuitPython it's running and which board it's running on. Can you please copy and paste that information for me? I just want to verify that the board definition is correct for an XIAO nRF52840 sense.

Additionally, in the REPL, you can try typing the following commands in sequence:

import board dir(board)

Which will tell you the names of the available pins on your board. That may also help diagnose the issue. Please let me know what you see.

Drc3p0 commented 1 year ago

Some more info from trying to run step1_accelerometer.py

Error was from line 14, which is: dpwr = digitalio.DigitalInOut(board.IMU_PWR)

The following is what I get when I run dir() on board in the Mu terminal:

>>> import board
>>> dir(board)
['__class__', '6D_INT1', '6D_PWR', '6D_SCL', '6D_SDA', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'BLUE_LED', 'D0', 'D1', 'D10', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7', 'D8', 'D9', 'GREEN_LED', 'I2C', 'LED', 'MIC_PWR', 'MISO', 'MOSI', 'NFC1', 'NFC2', 'PDM_CLK', 'PDM_DATA', 'RED_LED', 'RX', 'SCK', 'SCL', 'SDA', 'SPI', 'TX', 'UART']
geekmomprojects commented 1 year ago

Can you also paste the contents of the "boot_out.txt" file that's on the CIRCUITPY drive when you plug in the board?

It's a bit weird that the pin names differ from what I have, which makes me think we're running different firmware, but I would probably try replacing "board.IMU_PWR" with "board.6D_PWR" and I'm guessing you'll need to replace "board.IMU_SCL" with "board.6D_SCL" and "board.IMU_SDA" with "board.6D_SDA". Not sure if that will work, but it's worth a try.

geekmomprojects commented 1 year ago

Also, I'm not sure Seeed's firmware is the same as Adafruit's, so could you try downloading and installing CircuitPython from the CircuitPython.org site rather than the Seeeduino site? You'll find it here: https://circuitpython.org/board/Seeed_XIAO_nRF52840_Sense/

Drc3p0 commented 1 year ago

The boot-out.txt file shows that the CircuitPython firmware provided by the manufacturer it is an older version of circuitpython:

Adafruit CircuitPython 7.1.0-beta.3-152-g7f189b3e3-dirty on 2021-12-21; Seeed XIAO nRF52840 Sense with nRF52840
Board ID:Seeed_XIAO_nRF52840_Sense

Whereas the firmware from the circuitpython site is currently at v 7.3.3. I have re-flashed it with the newer firmware from circutpython.org, and your code demos now work! Thank you for your help and for hosting such an awesome workshop!

geekmomprojects commented 1 year ago

Yay! I'm so glad it got sorted out and I'm happy you're enjoying the project and the content.