-
Notifications
You must be signed in to change notification settings - Fork 78
Add RP2040 Support for JackW01 and BTT SKR Pico boards #280
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
Open
EricSchubert
wants to merge
5
commits into
OpenAstroTech:develop
Choose a base branch
from
EricSchubert:RP2040-Support
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
25dae05
Add RP2040 Support for JackW01 and BTT SKR Pico boards
72fc46b
Update platformio.ini
EricSchubert 0b7b6d1
Add pins file for JackW01 Pi Pico Printer Board
2cdf29a
Merge branch 'RP2040-Support' of https://github.com/EricSchubert/Open…
275fe74
Address PR review feedback
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ | |
| #endif | ||
|
|
||
| // Platform | ||
| #if defined(ESP32) || defined(__AVR_ATmega2560__) | ||
| #if defined(ESP32) || defined(__AVR_ATmega2560__) || defined(ARDUINO_ARCH_RP2040) | ||
| // Valid platform | ||
| #else | ||
| #error Unsupported platform configuration. Use at own risk. | ||
|
|
@@ -30,6 +30,8 @@ | |
| && ((DISPLAY_TYPE == DISPLAY_TYPE_NONE) || (DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD) || (DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23008) \ | ||
| || (DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23017)) | ||
| // Valid display for ATmega | ||
| #elif defined(ARDUINO_ARCH_RP2040) && (DISPLAY_TYPE == DISPLAY_TYPE_NONE) | ||
| // Valid display for RP2040 (no display in Phase 1) | ||
| #else | ||
| #error Unsupported display configuration. Use at own risk. | ||
| #endif | ||
|
|
@@ -81,16 +83,15 @@ | |
| #else | ||
| #error Defined an AZ driver, but no AZ stepper. | ||
| #endif | ||
| #elif defined(__AVR_ATmega2560__) | ||
| #elif defined(__AVR_ATmega2560__) || defined(ARDUINO_ARCH_RP2040) | ||
| // Azimuth configuration | ||
| #if (AZ_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) | ||
| #ifndef AZ_DRIVER_ADDRESS | ||
| // Serial bus address must be specified for TMC2209 in UART mode | ||
| #error AZ driver address for DRIVER_TYPE_TMC2209_UART not specified. | ||
| #endif | ||
| #endif | ||
| #elif defined(OAE) | ||
| // Valid OAE configuration | ||
|
|
||
| #else | ||
| #error Configuration does not support AZ. Use at own risk. | ||
| #endif | ||
|
|
@@ -102,7 +103,7 @@ | |
| #else | ||
| #error Defined an ALT driver, but no ALT stepper. | ||
| #endif | ||
| #elif defined(__AVR_ATmega2560__) | ||
| #elif defined(__AVR_ATmega2560__) || defined(ARDUINO_ARCH_RP2040) | ||
| // Altitude configuration | ||
| #if (ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) | ||
| #ifndef ALT_DRIVER_ADDRESS | ||
|
|
@@ -166,8 +167,8 @@ | |
| // External sensors | ||
| #if (USE_GPS == 0) | ||
| // Baseline configuration without GPS is valid | ||
| #elif defined(ESP32) || defined(__AVR_ATmega2560__) | ||
| // GPS is supported on ESP32 and ATmega | ||
| #elif defined(ESP32) || defined(__AVR_ATmega2560__) || defined(ARDUINO_ARCH_RP2040) | ||
| // GPS is supported on ESP32, ATmega, and RP2040 | ||
| #else | ||
| #error Unsupported GPS configuration. Use at own risk. | ||
| #endif | ||
|
|
@@ -197,7 +198,7 @@ | |
| #warning Missing pin assignments for MS pins | ||
| #endif | ||
| #elif (DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) | ||
| #if !defined(DEC_STEP_PIN) || !defined(DEC_DIR_PIN) || !defined(DEC_EN_PIN) | ||
| #if !defined(DEC_STEP_PIN) || !defined(DEC_DIR_PIN) || !defined(DEC_EN_PIN) || !defined(DEC_DIAG_PIN) | ||
| // Required pin assignments missing | ||
| #error Missing pin assignments for configured DEC DRIVER_TYPE_TMC2209_UART driver | ||
| #endif | ||
|
|
@@ -217,7 +218,7 @@ | |
| #warning Missing pin assignments for MS pins | ||
| #endif | ||
| #elif (RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) | ||
| #if !defined(RA_STEP_PIN) || !defined(RA_DIR_PIN) || !defined(RA_EN_PIN) | ||
| #if !defined(RA_STEP_PIN) || !defined(RA_DIR_PIN) || !defined(RA_EN_PIN) || !defined(RA_DIAG_PIN) | ||
| // Required pin assignments missing | ||
| #error Missing pin assignments for configured RA DRIVER_TYPE_TMC2209_UART driver | ||
| #endif | ||
|
|
@@ -229,15 +230,21 @@ | |
|
|
||
| #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) | ||
| #if (AZ_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC) || (AZ_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE) | ||
| #if !defined(AZ_STEP_PIN) || !defined(AZ_DIR_PIN) || !defined(AZ_EN_PIN) | ||
| // Required pin assignments missing | ||
| #if !defined(AZ_STEP_PIN) || !defined(AZ_DIR_PIN) || !defined(AZ_EN_PIN) || !defined(AZ_DIAG_PIN) | ||
| // Required pin assignments missing (ATmega uses SoftwareSerial for this driver) | ||
| #error Missing pin assignments for configured AZ DRIVER_TYPE_A4988_GENERIC or DRIVER_TYPE_TMC2209_STANDALONE driver | ||
| #endif | ||
| #elif (AZ_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) | ||
| #if !defined(AZ_STEP_PIN) || !defined(AZ_DIR_PIN) || !defined(AZ_EN_PIN) | ||
| // Required pin assignments missing (ATmega uses SoftwareSerial for this driver) | ||
| // Required pin assignments missing | ||
| #error Missing pin assignments for configured AZ DRIVER_TYPE_TMC2209_UART driver | ||
| #endif | ||
| #if !defined(AZ_DIAG_PIN) | ||
| // AZ_DIAG_PIN (TMC2209 DIAG output) is used only for stallGuard-based homing. | ||
| // It is optional: omit it if your hardware does not wire the DIAG output to a GPIO. | ||
| // Without it, stallGuard homing is unavailable but all other AZ motion works normally. | ||
| #pragma message "AZ_DIAG_PIN not defined. StallGuard homing unavailable for AZ axis." | ||
| #endif | ||
| #if !((defined(AZ_SERIAL_PORT_TX) && defined(AZ_SERIAL_PORT_RX)) || defined(AZ_SERIAL_PORT)) | ||
| // Required pin assignments missing for UART serial | ||
| #error Missing pin assignments for configured AZ DRIVER_TYPE_TMC2209_UART driver serial connection | ||
|
|
@@ -247,15 +254,21 @@ | |
|
|
||
| #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) | ||
| #if (ALT_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC) || (ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE) | ||
| #if !defined(ALT_STEP_PIN) || !defined(ALT_DIR_PIN) || !defined(ALT_EN_PIN) | ||
| // Required pin assignments missing | ||
| #if !defined(ALT_STEP_PIN) || !defined(ALT_DIR_PIN) || !defined(ALT_EN_PIN) || !defined(ALT_DIAG_PIN) | ||
| // Required pin assignments missing (ATmega uses SoftwareSerial for this driver) | ||
| #error Missing pin assignments for configured AZ DRIVER_TYPE_A4988_GENERIC or DRIVER_TYPE_TMC2209_STANDALONE driver | ||
| #endif | ||
| #elif (ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) | ||
| #if !defined(ALT_STEP_PIN) || !defined(ALT_DIR_PIN) || !defined(ALT_EN_PIN) | ||
| // Required pin assignments missing (ATmega uses SoftwareSerial for this driver) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't remove this comment |
||
| // Required pin assignments missing | ||
| #error Missing pin assignments for configured ALT DRIVER_TYPE_TMC2209_UART driver | ||
| #endif | ||
| #if !defined(ALT_DIAG_PIN) | ||
| // ALT_DIAG_PIN (TMC2209 DIAG output) is used only for stallGuard-based homing. | ||
| // It is optional: omit it if your hardware does not wire the DIAG output to a GPIO. | ||
| // Without it, stallGuard homing is unavailable but all other ALT motion works normally. | ||
| #pragma message "ALT_DIAG_PIN not defined. StallGuard homing unavailable for ALT axis." | ||
| #endif | ||
| #if !((defined(ALT_SERIAL_PORT_TX) && defined(ALT_SERIAL_PORT_RX)) || defined(ALT_SERIAL_PORT)) | ||
| // Required pin assignments missing for UART serial | ||
| #error Missing pin assignments for configured ALT DRIVER_TYPE_TMC2209_UART driver serial connection | ||
|
|
||
154 changes: 154 additions & 0 deletions
154
Configuration_local_examples/Configuration_local_rp2040_skr_pico.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| /** | ||
| * @brief Local hardware configuration for a Raspberry Pi Pico (RP2040) | ||
| * on the BigTreeTech SKR Pico v1.0 printer controller board. | ||
| * | ||
| * This file is NOT tracked by Git and will survive branch changes. | ||
| * It is automatically included by LocalConfiguration.hpp when | ||
| * BOARD == BOARD_RP2040_SKR_PICO. | ||
| * | ||
| * Hardware summary | ||
| * ---------------- | ||
| * MCU : RP2040 (Raspberry Pi Pico) | ||
| * Board : BTT SKR Pico v1.0 | ||
| * Stepper slot : X -> RA (TMC2209, UART addr 0) | ||
| * Stepper slot : Y -> DEC (TMC2209, UART addr 2) | ||
| * Stepper slot : Z -> AZ (TMC2209, UART addr 1) | ||
| * Stepper slot : E0 -> ALT (TMC2209, UART addr 3) | ||
| * Motor rating : 0.9 deg / step (400 SPR), 470 mA | ||
| * Pulley : 16T aluminium GT2 | ||
| * RA homing : Hall sensor on GPIO4 (X-STOP / RA_DIAG_PIN) | ||
| * | ||
| * All pin assignments are in boards/RP2040_SKR_PICO/pins_RP2040_SKR_PICO.hpp. | ||
| * R_SENSE (0.11 ohm) is set globally in src/a_inits.hpp for all TMC2209_UART | ||
| * builds and does not need to be repeated here. | ||
| * | ||
| * Key difference from JackW01: each stepper driver has its own EN pin. | ||
| * AZ_ALWAYS_ON and ALT_ALWAYS_ON are NOT required on this board. | ||
| */ | ||
| #pragma once | ||
|
|
||
| // ── Board ───────────────────────────────────────────────────────────────────── | ||
| #define BOARD BOARD_RP2040_SKR_PICO | ||
|
|
||
| // ── Hemisphere ──────────────────────────────────────────────────────────────── | ||
| #define NORTHERN_HEMISPHERE 1 | ||
|
|
||
| // ── Display (none) ──────────────────────────────────────────────────────────── | ||
| #define DISPLAY_TYPE DISPLAY_TYPE_NONE | ||
| #define INFO_DISPLAY_TYPE INFO_DISPLAY_TYPE_NONE | ||
|
|
||
| // ── Stepper motor types ─────────────────────────────────────────────────────── | ||
| #define RA_STEPPER_TYPE STEPPER_TYPE_ENABLED | ||
| #define DEC_STEPPER_TYPE STEPPER_TYPE_ENABLED | ||
| #define AZ_STEPPER_TYPE STEPPER_TYPE_ENABLED | ||
| #define ALT_STEPPER_TYPE STEPPER_TYPE_ENABLED | ||
|
|
||
| // ── Stepper driver types ────────────────────────────────────────────────────── | ||
| #define RA_DRIVER_TYPE DRIVER_TYPE_TMC2209_UART | ||
| #define DEC_DRIVER_TYPE DRIVER_TYPE_TMC2209_UART | ||
| #define AZ_DRIVER_TYPE DRIVER_TYPE_TMC2209_UART | ||
| #define ALT_DRIVER_TYPE DRIVER_TYPE_TMC2209_UART | ||
|
|
||
| // ── Steps per revolution (0.9 deg motor = 400 full steps/rev) ───────────────── | ||
| #define RA_STEPPER_SPR 400 | ||
| #define DEC_STEPPER_SPR 400 | ||
| #define AZ_STEPPER_SPR 400 | ||
| #define ALT_STEPPER_SPR 400 | ||
|
|
||
| // ── Pulley tooth count (16T aluminium GT2) ──────────────────────────────────── | ||
| #define RA_PULLEY_TEETH 16 | ||
| #define DEC_PULLEY_TEETH 16 | ||
| #define AZ_PULLEY_TEETH 16 | ||
| #define ALT_PULLEY_TEETH 16 | ||
|
|
||
| // ── Microstepping ───────────────────────────────────────────────────────────── | ||
| // TMC2209 UART mode can switch microstepping dynamically at runtime. | ||
| // RA switches between slew (8×) and fine tracking (256×). | ||
| // DEC switches between slew (16×) and fine guiding (256×). | ||
| // AZ and ALT use a fixed microstepping mode (no dynamic switching). | ||
| #define RA_SLEW_MICROSTEPPING 8 // µsteps used while slewing RA | ||
| #define RA_TRACKING_MICROSTEPPING 256 // µsteps used for sidereal tracking | ||
| #define DEC_SLEW_MICROSTEPPING 16 // µsteps used while slewing DEC | ||
| #define DEC_GUIDE_MICROSTEPPING 256 // µsteps used for guide pulses | ||
| #define AZ_MICROSTEPPING 64 | ||
| #define ALT_MICROSTEPPING 4 | ||
|
|
||
| // ── Motor direction ─────────────────────────────────────────────────────────── | ||
| // Set to 1 to reverse the direction of an axis if it moves the wrong way. | ||
| // Verify with manual move commands: :Mw#/:Me# (RA), :Mn#/:Ms# (DEC), | ||
| // :MAL#/:MAR# (AZ), :MAU#/:MAD# (ALT). Then set the appropriate flag to 1. | ||
| #define RA_INVERT_DIR 0 | ||
| #define DEC_INVERT_DIR 1 | ||
| #define AZ_INVERT_DIR 0 | ||
| #define ALT_INVERT_DIR 0 | ||
|
|
||
| // ── StealthChop (silent mode) ───────────────────────────────────────────────── | ||
| // Configuration_adv.hpp defaults both to 0 (SpreadCycle = noisy). | ||
| // Set to 1 to enable StealthChop (silent) for RA tracking and DEC moves. | ||
| #define RA_UART_STEALTH_MODE 1 | ||
| #define DEC_UART_STEALTH_MODE 1 | ||
|
|
||
| // ── Motor current ───────────────────────────────────────────────────────────── | ||
| // Motors are rated at 470 mA. Run at 75 % of rated current to reduce heat | ||
| // while maintaining adequate torque. RMS current is computed automatically: | ||
| // RMSCURRENT = RATING * (SETTING / 100) / sqrt(2) => ~249 mA RMS | ||
| // Do NOT define XXX_RMSCURRENT directly; Configuration_adv.hpp will error. | ||
| #define RA_MOTOR_CURRENT_RATING 470 // mA | ||
| #define RA_OPERATING_CURRENT_SETTING 75 // % | ||
|
|
||
| #define DEC_MOTOR_CURRENT_RATING 470 // mA | ||
| #define DEC_OPERATING_CURRENT_SETTING 75 // % | ||
|
|
||
| #define AZ_MOTOR_CURRENT_RATING 470 // mA | ||
| #define AZ_OPERATING_CURRENT_SETTING 75 // % | ||
|
|
||
| #define ALT_MOTOR_CURRENT_RATING 470 // mA | ||
| #define ALT_OPERATING_CURRENT_SETTING 75 // % | ||
|
|
||
| // ── AZ/ALT hold current ─────────────────────────────────────────────────────── | ||
| // AZ must hold position against backlash forces; use 40 % of run current. | ||
| // ALT is held by friction and gearing; bleed hold current to zero. | ||
| // These are percentages (0-100) converted to TMC2209 IHOLD by the firmware. | ||
| #define AZ_MOTOR_HOLD_SETTING 40 // % | ||
| #define ALT_MOTOR_HOLD_SETTING 0 // % | ||
|
|
||
| // ── DEC axis travel limits ──────────────────────────────────────────────────── | ||
| // Physical limits measured from the home (level) position. | ||
| // These must be defined here; Configuration_adv.hpp defaults to 0.0f for | ||
| // non-OAM builds, which makes :Mn#/:Ms# target position 0 and do nothing. | ||
| #ifndef DEC_LIMIT_UP | ||
| #define DEC_LIMIT_UP 135.0f // 135° north of home | ||
| #endif | ||
| #ifndef DEC_LIMIT_DOWN | ||
| #define DEC_LIMIT_DOWN 35.0f // 35° south of home | ||
| #endif | ||
|
|
||
| // ── RA Hall sensor auto-home ────────────────────────────────────────────────── | ||
| // Hall sensor is wired to GPIO4 (X-STOP input / RA_DIAG_PIN on SKR Pico). | ||
| // Active state LOW: sensor pulls GPIO4 LOW when the magnet is present. | ||
| // Search distance: 30° default (RA_HOMING_SENSOR_SEARCH_DEGREES in Configuration_adv.hpp). | ||
| // GPIO4 is configured INPUT (no pull-up); add external 10kΩ to 3.3V if sensor | ||
| // is open-drain, or change to INPUT_PULLUP in b_setup.hpp. | ||
| #define USE_HALL_SENSOR_RA_AUTOHOME 1 | ||
| #define RA_HOMING_SENSOR_PIN 4 // GPIO4 = RA_DIAG_PIN (X-STOP) | ||
| #define RA_HOMING_SENSOR_ACTIVE_STATE LOW // sensor pulls LOW when active | ||
|
|
||
| // ── GPS ─────────────────────────────────────────────────────────────────────── | ||
| // ATGM336H-5N wired to left-side header: GPS TX→IO1, GPS RX→IO0, VCC→5V, GND. | ||
| // GPS_SERIAL_PORT, RP2040_GPS_TX_PIN, RP2040_GPS_RX_PIN defined in pins file. | ||
| // GPS_BAUD_RATE defaults to 9600 in Configuration_adv.hpp (matches module default). | ||
| #define USE_GPS 1 | ||
|
|
||
| // ── FAN ─────────────────────────────────────────────────────────────────────── | ||
| // FAN1 power level as a percentage (0 = off, 100 = full speed). | ||
| // The pin and PWM are defined in pins_RP2040_SKR_PICO.hpp. | ||
| #define RP2040_FAN1_POWER_PERCENT 60 | ||
|
|
||
| // Track immediately after boot | ||
| #define TRACK_ON_BOOT 0 | ||
|
|
||
| // Uncomment to override defaults for stepper speeds and accelerations | ||
| //#define RA_STEPPER_SPEED 1200 // You can change the speed and acceleration of the steppers here. Max. Speed = 3000. | ||
| //#define RA_STEPPER_ACCELERATION 6000 | ||
| //#define DEC_STEPPER_SPEED 1300 // You can change the speed and acceleration of the steppers here. Max. Speed = 3000. | ||
| //#define DEC_STEPPER_ACCELERATION 6000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't remove the comment