Configuring rp2040

I see that rp2040 is supported in code but … I see no instructions on how to configure. Am I missing something? I’ve had these devices around for almost a year now, never used it but bought a couple c’ause they were cool.

I’m relatively new to Klipper but have read over all docs, have contributed to Marlin in the past, and built an I3 printer from scratch (here if anybody cares or is bored. :slight_smile: GitHub - kpishere/RepRap-iTopie: Prusa i3 Evolution).

The tech is so conveniant, it isn’t clear what to do. Do I use OpenOCD? I see how to put MicroPython on it but want to put the Klipper MCU code on it which looks like rp2040 bare-metal to me. What to do?

Moments later …

So, I did the make menuconfig. Made selections, updated usb Vendor Id, product Id, serial No. ran make. All made in Out, clearly for rp2040. Saw klipper.elf and klipper.uf2 (new to me) in output, copied that to the mount that appears with Pi Pico. it unmounts. Then you see new /dev/cu… device but the console.py returns errors …

INFO:root:Starting serial connect
DEBUG:root:Starting stk500v2 leave programmer sequence
DEBUG:root:Got '' from stk500v2

I don’t have answer to your question, but did you see the benchmarks? It’s pretty slow:

|rp2040 |ticks|

|1 stepper|5|
|3 stepper|22|

Yep, it is just conveniant for testing. I saw that others use it as a second MCU for a portable accelerometer. that is clever.

Ah! found it. I get it. Needed to copy just the klipper.uf2 file and then update printer config. simple but still useful to ground oneself on how it all works.
YTube vid

For any other newb out there … this is what it looks like when it is working. :stuck_out_tongue:

Mac-mini: ~/$ python klippy/console.py -v /dev/cu.usbmodem1461 

  This is a debugging console for the Klipper micro-controller.
  In addition to mcu commands, the following artificial commands are
  available:
    PINS  : Load pin name aliases (eg, "PINS arduino")
    DELAY : Send a command at a clock time (eg, "DELAY 9999 get_uptime")
    FLOOD : Send a command many times (eg, "FLOOD 22 .01 get_uptime")
    SUPPRESS : Suppress a response message (eg, "SUPPRESS analog_in_state 4")
    SET   : Create a local variable (eg, "SET myvar 123.4")
    STATS : Report serial statistics
    LIST  : List available mcu commands, local commands, and local variables
    HELP  : Show this text
  All commands also support evaluation by enclosing an expression in { }.
  For example, "reset_step_clock oid=4 clock={clock + freq}".  In addition
  to user defined variables (via the SET command) the following builtin
  variables may be used in expressions:
    clock : The current mcu clock time (as estimated by the host)
    freq  : The mcu clock frequency

==================== attempting to connect ====================
INFO:root:Starting serial connect
DEBUG:root:Starting stk500v2 leave programmer sequence
DEBUG:root:Got '\x05\x10\x9e\x81~' from stk500v2
Loaded 89 commands (v0.10.0-225-g6e6ad7b5 / gcc: (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.2.1 20201103 (release) binutils: (GNU Arm Embedded Toolchain 10-2020-q4-major) 2.35.1.20201028)
MCU config: BUS_PINS_spi0a=gpio0,gpio3,gpio2 BUS_PINS_spi0b=gpio4,gpio7,gpio6 BUS_PINS_spi0c=gpio16,gpio19,gpio18 BUS_PINS_spi0d=gpio20,gpio23,gpio22 STEPPER_BOTH_EDGE=1 ADC_MAX=4095 PWM_MAX=255 CLOCK_FREQ=12000000 MCU=rp2040 BUS_PINS_spi1c=gpio24,gpio27,gpio26 BUS_PINS_spi1b=gpio12,gpio15,gpio14 BUS_PINS_spi1a=gpio8,gpio11,gpio10 STATS_SUMSQ_BASE=256
DEBUG:root:new minimum rtt 9869.879: hrtt=0.000112 freq=12000000
DEBUG:root:new minimum rtt 9869.988: hrtt=0.000100 freq=11999947
DEBUG:root:new minimum rtt 9870.147: hrtt=0.000099 freq=12000445
DEBUG:root:new minimum rtt 9870.250: hrtt=0.000088 freq=12001479
====================       connected       ====================
DEBUG:root:new minimum rtt 9870.251: hrtt=0.000082 freq=12001097
004.992: stats count=384 sum=33286 sumsq=36369
009.992: stats count=67 sum=1966 sumsq=537
014.992: stats count=67 sum=1949 sumsq=524
019.991: stats count=67 sum=1949 sumsq=524
024.991: stats count=67 sum=1948 sumsq=523

It’s actually quite fast. Roughly the same speed as a SAM4E (Duet2 chip) or LPC1769 (SKR 1.4 Turbo).

Micro-controller 1 stepper active	3 steppers active
Smoothieboard (LPC1769)	    2353K	1622K
Raspberry Pi Pico (RP2040)	2400K	1636K
Duet2 Wifi/Eth (SAM4E8E)	2500K	1674K

Klipper also just added make flash support, so flashing is even easier now.

https://github.com/Klipper3d/klipper/commit/7c0559c6e62506af73d0e8f22733615705664dd5

1 Like