Skip to content
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

[FR] Raspberry Pi Pico #20877

Closed
Doyle4 opened this issue Jan 25, 2021 · 23 comments
Closed

[FR] Raspberry Pi Pico #20877

Doyle4 opened this issue Jan 25, 2021 · 23 comments
Labels
A: RP2040 C: Boards/Pins T: Feature Request Features requested by users. T: HAL & APIs Topic related to the HAL and internal APIs.

Comments

@Doyle4
Copy link

Doyle4 commented Jan 25, 2021

Hello,

Will the Raspberry Pi Pico be supported in the future?

Thanks :)

@Doyle4 Doyle4 added the T: Feature Request Features requested by users. label Jan 25, 2021
@Doyle4 Doyle4 changed the title [FR] (feature request title) [FR] Raspberry Pi Pico Jan 25, 2021
@thawkins
Copy link
Contributor

This beast has 16 pwm and pulse train generators built in, it should be capible of very high step rates.

@ellensp
Copy link
Contributor

ellensp commented Jan 31, 2021

A nice fairly unbiased comparison to other commonly available chips
https://www.youtube.com/watch?v=cVHCllbN3bQ

@panchalnikunj
Copy link

https://www.youtube.com/channel/UCA4j-J-TFW_9Dt4iTwIjtYQ

Once visit this channel for raspberry pi pico projects.

@KillerBug
Copy link

I built one. It's a Delta with a 3-in-1-out effector...so 6 stepper drivers. Running the thermistors into the stock ADC to see if it's good enough. If not, there is an i2c header that could be used for a different ADC (and maybe a pendant).

It's on a custom board...it has a few issues but I don't want to spin a new one before I know if the stock ADC will work (if not, I'll include something onboard in the next revision).

At the moment my problem is getting marlin to compile for it. The people over at the marlin forum say I need a new HAL, but I have no idea how to even start with that.

Happy to alpha/beta test.

Here's the post from the Marlin forum with my config files: https://reprap.org/forum/read.php?415,882792

https://ibb.co/tKhKm8V

@Hedda
Copy link

Hedda commented Jun 9, 2021

This is more interesting now that Raspberry Pi Foundation started selling RP2040 MCU to other board manufacturers for $1 US:

https://www.raspberrypi.org/blog/raspberry-pi-rp2040-on-sale/

https://www.cnx-software.com/2021/06/01/buy-raspberry-pi-rp2040-one-dollar/

https://www.tomshardware.com/best-picks/best-rp2040-boards

https://blog.arduino.cc/2021/01/20/welcome-raspberry-pi-to-the-world-of-microcontrollers

https://docs.arduino.cc/hardware/nano-rp2040-connect

https://learn.adafruit.com/adafruit-feather-rp2040-pico

Marlin Firmware core developers would first need to add a HAL for this new "RASPBERRYPI" platform which could support RP2040, (and later also future MCUs in that series that based on a similar architecture), then you can add support for each board based on that MCU.

https://github.com/MarlinFirmware/Marlin/tree/2.0.x/Marlin/src/HAL

One of the prerequisite is normally that there is already support for that platform by PlatformIO, and PlatformIO at least now look have platformio platform-raspberrypi platform suppport for RP2040 on Raspberry Pi Pico and Arduino Nano RP2040 Connect boards:

https://github.com/platformio/platform-raspberrypi

https://github.com/platformio/platform-raspberrypi/blob/develop/boards/pico.json

https://github.com/platformio/platform-raspberrypi/blob/develop/boards/nanorp2040connect.json

https://docs.platformio.org/en/latest/platforms/raspberrypi.html

https://docs.platformio.org/en/latest/boards/raspberrypi/nanorp2040connect.html

https://docs.platformio.org/en/latest/boards/raspberrypi/nanorp2040connect.html

https://docs.platformio.org/en/latest/boards/#raspberry-pi-rp2040

https://docs.platformio.org/en/latest/boards/raspberrypi/pico.html

https://docs.platformio.org/en/latest/boards/raspberrypi/nanorp2040connect.html

PS: Suggest maybe raise this as a feature request/suggestion to the Raspberry Pi Foundation (as well as well as to their Raspberry Pi Community) as would think that it would also be in their interest to have support for RP2040 and Pico boards in Marlin Firmware. Should be very cool to start seeing different RepRap 3D-printer custom boards built based on RP2040 MCU natively or breakout boards using Raspberry Pi Pico and Arduino Nano RP2040 Connect running Marlin Firmware.

https://www.raspberrypi.org/

@CaptainNico54
Copy link

I am looking at developing a new board using the RP2040 (Pi Pico) and I am looking for Marlin support.

Now that the MCU is fully supported by Arduino and Platform.io, what would we need to do to get the Marlin team to add support for this?

@thinkyhead
Copy link
Member

Here is a basic starting-point that I "quickly" cobbled together… https://github.com/thinkyhead/Marlin/tree/bf2_RP2040_target_PR

The HAL code is simply a copy of HAL/STM32 with slight modifications. I picked HAL/STM32 because Malyan M200 has an ARM Cortex-M0 and uses HAL/STM32 so it ought to be pretty close. Pretty much all the functions. methods, and macros in HAL/RP2040 will need to be modified with code appropriate to the RP2040.

@pkElectronics
Copy link

Based on the previous work from @thinkyhead and @p3p I started implementing the required macros and functions on my own fork.

If someone want´s to have a testdrive have a look at https://github.com/pkElectronics/Marlin/tree/pr_RP2040
But beware, it´s absolutely work in progress and probably will not yet work as expected.

@pkElectronics
Copy link

Alright, I wanted to give a short update on this.

I finished the implementation of the most basic Marlin subsystems (Analog, Timers, Watchdog) and some more advanced (TMC Uart, SoftSerial). It compiles and is able to move steppers on a rp2040 based control board. If someone wants to have a look please check the branch I provided above.

I´m not yet sure if the way I implemented the timer subsystem is the best approach to this topic but by now it´s the best one I came up with. The timing of the stepper pulses definetly needs some verification if this is as accurate as necessary.

@terjeio
Copy link

terjeio commented Dec 5, 2021

The timing of the stepper pulses definetly needs some verification if this is as accurate as necessary.

You may use PIO code for pretty accurate timing.

@thinkyhead
Copy link
Member

thinkyhead commented Jan 1, 2022

… If someone [wants] to have a testdrive …

I got pretty far in compiling the code, rebased with the current bugfix-2.0.x but it stalls because I need to install LVGL someplace. I assume it'll build for a Linux-like target.

You may use PIO code for pretty accurate timing.

We will seldom need to send pulses in the way that this facilitates. The pulses out of Marlin are tied to the Bresenham algorithm, so they are interleaved in an irregular manner, and also spend a majority of the time in acceleration / deceleration.

@AlexFroio
Copy link

AlexFroio commented Jan 22, 2022

Adding onto this thread so I don't make a new one, but a pico based board has been released by BIQU:
BTT SKR Pico v1.0

It's aimed at Klipper but can still benefit from a Marlin port.

This may make it easier to test on actual hardware without making custom boards.

Edit:
Updating to add the SKR Pico Github link

@thinkyhead
Copy link
Member

a pico based board has been released by BIQU

I have it here and I am working on getting Marlin installed onto it.

@thinkyhead
Copy link
Member

It's aimed at Klipper but can still benefit from a Marlin port.

I see one immediate limitation is there's no supported way to attach a common LCD controller, so you need to use OctoPrint or some other host to get an interface. The provided demo HAL for RP2040 has a dubious dependency on LVGL, so I'm working on removing that and getting it to the point of having a working console. At that point I'll post a PR for further testing.

@pkElectronics
Copy link

The provided demo HAL for RP2040 has a dubious dependency on LVGL

Which HAL are you currently working with? I´m pretty sure I have neither installed nor used LVGL anywhere

@thawkins
Copy link
Contributor

thawkins commented Jan 27, 2022 via email

@ellensp
Copy link
Contributor

ellensp commented Jan 27, 2022

@thawkins most touch displays on 3d printers are serial devices... we are not short on serial display options.

@Hedda
Copy link

Hedda commented Jan 28, 2022

most touch displays on 3d printers are serial devices... we are not short on serial display options.

@bigtreetech Does Biqu have any specific ideas, suggestions or recommendations for screens/displays + controller system or touchscreens with serial interface for BTT SKR Pico if would use it as stand-alone with Marlin Firmware without a Raspberry Pi?

I guess one example is BIQU BIGTREETECH TFT24 V1.1 LCD? -> https://www.biqu.equipment/products/tft24v1-1-gd-version

@AlexFroio
Copy link

AlexFroio commented Jan 28, 2022

You could technically use the laser port for the touch screen yeah. RST just doesn't have anywhere to go to on the board (but that's a hardware problem, not Marlin's) and it can't run an LCD interface.
IO0 and IO1 are both UART capable. The SKR Pico schematic even labels them as TXD0 and RXD0, and they only hook up to this port, and are unused otherwise.
image

EDIT: Dug a little deeper and found that the pico labels its RST as RUN. So you'd need to tap into the following switch to hook up RST through P9 on the board.

image
image

@thisiskeithb thisiskeithb added the T: HAL & APIs Topic related to the HAL and internal APIs. label Apr 12, 2022
@DottiestDuke47
Copy link

Has anyone begun any work on a HAL for this platform, I wanted to experiment by adapting/writing my own, but it would be easier if somesones already laid some groundwork. If not, what exactly does a HAL need to incorperate, I've had a look at avrious HAL.cpp files and https://marlinfw.org/docs/development/hal.html, I just want to know if theres a sort of checklist to what needs to be done.

@thisiskeithb
Copy link
Member

Has anyone begun any work on a HAL for this platform

Yes: #20877 (comment)

@thisiskeithb
Copy link
Member

Closing since there’s now a PR: #24042

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A: RP2040 C: Boards/Pins T: Feature Request Features requested by users. T: HAL & APIs Topic related to the HAL and internal APIs.
Projects
None yet
Development

No branches or pull requests