MicroPython error during installation verification

I have put together the v1 XRP kit and connected it to XRPCode. After successfully updating the firmware to XRPLib v2.0.1, I am unable to run the installation_verification.py in the XRPExamples directory. I see the following error in the MicroPython console:

Traceback (most recent call last):
  File "<stdin>", line 37, in <module>
  File "XRPExamples/installation_verification.py", line 1, in <module>
  File "/lib/XRPLib/defaults.py", line 18, in <module>
  File "/lib/XRPLib/encoded_motor.py", line 36, in get_default_encoded_motor
  File "/lib/XRPLib/motor.py", line 61, in __init__
ValueError: unknown named pin "MOTOR_L_IN_1"
Traceback (most recent call last):
  File "<stdin>", line 50, in <module>
  File "/lib/XRPLib/resetbot.py", line 43, in <module>
  File "/lib/XRPLib/resetbot.py", line 11, in reset_motors
  File "/lib/XRPLib/encoded_motor.py", line 36, in get_default_encoded_motor
  File "/lib/XRPLib/motor.py", line 61, in __init__
ValueError: unknown named pin "MOTOR_L_IN_1"

This is the firmware / lib version displayed in the REPL:

MicroPython v1.25.0-preview.208.g1e83cd914 on 2025-01-14; SparkFun XRP Control Board V2 with RP2350

I’m not sure where those pin aliases are stored. Can I get around this by replacing the unknown pin name with the GPIO number instead, i.e. IO30 or IO31?

Ok I think I’ve figured out the issue. After looking at all the available values on the Pin.board interface in the REPL:

from machine import Pin
>>> Pin.board.
CURRENT_M3      CURRENT_M4      CURRENT_ML      CURRENT_MR
DIST_ECHO       DIST_TRIG       ENCODER_3A      ENCODER_3B
ENCODER_4A      ENCODER_4B      ENCODER_LA      ENCODER_LB
ENCODER_RA      ENCODER_RB      GP0             GP1
GP10            GP11            GP12            GP13
GP14            GP15            GP16            GP17
GP18            GP19            GP2             GP20
GP21            GP22            GP23            GP24
GP25            GP26            GP27            GP28
GP29            GP3             GP30            GP31
GP32            GP33            GP34            GP35
GP36            GP37            GP38            GP39
GP4             GP40            GP41            GP42
GP43            GP44            GP45            GP46
GP47            GP5             GP6             GP7
GP8             GP9             LED             LED_RGB
LINE_L          LINE_R          MOTOR_3_IN1     MOTOR_3_IN2
MOTOR_4_IN1     MOTOR_4_IN2     MOTOR_L_IN1     MOTOR_L_IN2
MOTOR_R_IN1     MOTOR_R_IN2     NEOPIXEL        PSRAM_CS
RADIO_CLK       RADIO_CS        RADIO_DIO       RADIO_ON
RGB_LED         SCL0            SCL1            SDA0
SDA1            SERVO_1         SERVO_2         SERVO_3
SERVO_4         USER_BUTTON     VIN_MEAS        WL_GPIO0
WL_GPIO1        WL_GPIO2

It looks like the expected pin names are different in MicroPython than the XRPLib. After updating all the defaults to the matching names on the Pin.board, the installation_verification.py runs successfully.

I can submit a PR to the open source codebase later to see if this is the correct fix for everyone using the v1 XRP.

There is a problem that we are investigating that the XRP needs to be reset once after the update as there is an old version of part of the XRPLib that is not getting cleared from memory. After the reset things should run fine.

I am new to XRP and micropython. I just assembled the SparkFun XRP kit. I got the same error when running “from XRPLib.defaults import *”…
ValueError: unknown named pin “MOTOR_L_IN_1”
How do I update Pin.board? Looks like something is corrupted in the lib.
Please advise. Thanks.

How do I reset XRP board V2 with RP2350? I tried power off and USB cable off. But I am still getting the same error with unknown named pin “MOTOR_L_IN_1”. Please advise.

Here is my PR for the workaround at the moment: fix(XRPLib): update pin names to match latest MicroPython machine config by HipsterBrown · Pull Request #82 · Open-STEM/XRP_MicroPython · GitHub

I’ll try out the reset using the button on the board after the update. I’ve run into that issue after updating those XRPLib files not taking effect after saving until resetting the board.

After hours of research, I found the solution: reflash with the latest firmware as of today.

  1. reset flash memory w/ flash_nuke.uf2
    https://www.raspberrypi.com/documentation/microcontrollers/pico-series.html#resetting-flash-memory

  2. flash w/ Sparkfun…UF2 aka micropython for XRP
    MicroPython - Python for microcontrollers

  3. run xrpcode.wpi.edu . it automatically updates XRP lib to 2.0.1 by copying files into 2 new directories…

end result:

MicroPython v1.25.0-preview.402.g274c8c419 on 2025-03-25; SparkFun XRP Controller with RP2350

test file works !!!

Hi there,

Sorry to hear y’all were having this problem! It seems like some boards may have been shipped out with the wrong version firmware. Not sure how that happened, we’re going to investigate this to ensure it doesn’t happen again in future production runs.

This is the firmware / lib version displayed in the REPL:

MicroPython v1.25.0-preview.208.g1e83cd914 on 2025-01-14; SparkFun XRP Control Board V2 with RP2350

Thank you so much for posting this, very helpful! The boards from the first production run should report MicroPython v1.25.0-preview.beta06 on 2025-02-17; SparkFun XRP Controller with RP2350. @Fgrossman Maybe we can add a special check to XRPCode to force a firmware update if v1.25.0-preview.208.g1e83cd914 on 2025-01-14 is detected?

The reason for these error messages is because your boards have an outdated firmware version before we had finalized the pin names. The names used by XRPLib are correct, you just need to update your firmware to fix the pin names. See my other post here for how to do that:

Hope this helps!

1 Like

We want to thank you for bringing this problem to us. We put out an updated fix to XRPCode last night and it will now update to the correct version of MicroPython that matches with the XPRLib libraries under these conditions.

2 Likes

Thank you for making the fix! I’ve confirmed loading up XRPCode updates MicroPython to the expected version MicroPython v1.25.0-preview.beta06 on 2025-02-17; SparkFun XRP Controller with RP2350

1 Like

My SparkFun kit had the same issue. Thanks @csunwc for figuring out a proper factory reset workflow. MicroPython error during installation verification - #7 by csunwc