aboutsummaryrefslogtreecommitdiffstats
path: root/src/rp2040
Commit message (Collapse)AuthorAgeFilesLines
* Rename everything significant to Kutter except for docsTomasz Kramkowski2025-08-151-9/+9
|
* rp2040: Prefer larger postdiv1 on rp2040 chipsKevin O'Connor2025-06-021-2/+2
| | | | | | | The rp2040 uses a pll vco divider of 6. Prefer setting postdiv1=6 and postdiv2=1 (instead of the previous postdiv1=3 and postdiv2=2). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Add comments on PLL frequency requirements to clock setup codeKevin O'Connor2025-06-021-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Fix spi overflow issueKevin O'Connor2025-05-301-4/+9
| | | | | | | | | | | Completely filling the spi transmit fifo could lead to a situation where the rx fifo overflows. Make sure not to write past the rx fifo size. Also, be sure to wait for the transmission to fully complete before exiting spi_transfer(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: spi - enable fifoTimofey Titovets2025-05-301-4/+8
| | | | Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
* rp2040: add a delay on SCK polarity changeTimofey Titovets2025-05-261-0/+7
| | | | Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
* Kconfig: Note which chips require software divide operationsKevin O'Connor2025-04-171-0/+2
| | | | | | | Add a new HAVE_SOFTWARE_DIVIDE_REQUIRED that indicates which chips require software divide. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Kconfig: Add new WANT_I2C option to reduce code sizeKevin O'Connor2025-04-161-1/+1
| | | | | | | Make it possible to not compile in support for I2C on chips with small flash sizes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Kconfig: Add new WANT_SPI option to reduce code sizeKevin O'Connor2025-04-161-1/+1
| | | | | | | Make it possible to not compile in support for SPI on chips with small flash sizes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Kconfig: Add new WANT_HARD_PWM option to reduce code sizeKevin O'Connor2025-04-161-1/+1
| | | | | | | Make it possible to not compile in support for hardware pwm on chips with small flash sizes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: define spi bus on pins 12,11,10Timofey Titovets2025-03-251-0/+3
| | | | | | Mellow FLY SHT36 Pro toolboard uses those pins Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
* stepper: Support step on both edges with custom minimum pulse durationKevin O'Connor2025-03-201-1/+1
| | | | | | | | | | Add support for "step on both edges" to the main stepper_event_full() code. This makes that mode of operation available even when the micro-controller is not compiled for "optimized step on both edges". It also enables the custom pulse duration support (step_pulse_ticks) when in "step on both edges" mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Fix build of rp2350Kevin O'Connor2025-02-261-6/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: set clock to 200MhzTimofey Titovets2025-02-261-2/+18
| | | | Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
* rp2040: Add support for reporting canbus stateKevin O'Connor2025-02-021-1/+18
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Add spi0_gpio4_gpio3_gpio2 bus to support fysetc PITB V2 (#6683)Jessica Hunt2024-11-271-3/+24
| | | | | | | | | | | | | | | | The Fysetc PITB V2 board uses a spi bus config that is supported by the RP2040 chip, but not klipper, so this adds the relevant config to the file to allow you to run the tmc5160's on the board via hardware SPI. This resolves the issue of software spi not working on this board, which I was unable to fully understand. I have also seen other users encounter similar bus config issues with the rp2040 setting up things like accelerometers and such with this pin layout. As requested, this also uses the new convention for spi bus naming, while maintaining the old bus names for compatibility. Signed-off-by: Jessica Hunt <hunt.jessica@proton.me>
* rp2040: Improve indentation in Kconfig fileKevin O'Connor2024-11-141-34/+34
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Add rp2350 bootrom based chipid and reboot to bootloader codeKevin O'Connor2024-11-144-9/+65
| | | | | | | This adds the bootrom code needed to implement "reboot into bootloader" and "chipid" capabilities. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Move chipid reading to bootrom.cKevin O'Connor2024-11-144-108/+120
| | | | | | | | | | | Rewrite chipid.c so that it contains just the USB and canbus id manipulation code. Move the low-level chipid reading to bootrom.c. Also, introduce a new bootrom_reboot_usb_bootloader() function in bootrom.c so that the main.c code does not need to know the specifics of rebooting into the bootrom. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Initial rp2350 supportKevin O'Connor2024-11-145-23/+61
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Use a higher USB PLL internal frequencyKevin O'Connor2024-11-141-1/+5
| | | | | | | The rp2350 chip requires a higher internal frequency, so choose a value that works for both rp2040 and rp2350. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Avoid using memcpy() on USB dpramKevin O'Connor2024-11-141-7/+30
| | | | | | | | Some versions of the system memcpy() may make unaligned memory accesses, which can result in a bus fault when accessing the usb dpram device memory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Rename rp2040_link.lds.S to rpxxxx_link.lds.SKevin O'Connor2024-11-133-3/+3
| | | | | | This is in preparation for rp2350 support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Rename CONFIG_RP2040_yyy Kconfig symbols to CONFIG_RPXXXX_yyyKevin O'Connor2024-11-134-33/+43
| | | | | | | Rename the Kconfig symbols. This is in preparation to adding support for the rp2350 mcu. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* lib: Update lib/rp2040 to v2.0.0 SDK releaseKevin O'Connor2024-11-131-6/+11
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* lib: Move lib/rp2040/elf2uf2 to lib/elf2uf2Kevin O'Connor2024-11-131-4/+4
| | | | | | | | Recent versions of the rp2040 sdk no longer contain the elf2uf2 tool. So, move that code to a new dedicated directory. This is in preparation for updating the rp2040 sdk version. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: forward i2c errors to i2ccmdTimofey Titovets2024-10-261-18/+24
| | | | Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
* i2c: handle errors at i2ccmdsTimofey Titovets2024-10-262-5/+10
| | | | Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
* rp2040: Check for i2c NACK/Start NACK (#6692)Timofey Titovets2024-09-221-0/+22
| | | Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
* rp2040_link: Explicitly set klipper.elf output section flags to avoid warningKevin O'Connor2024-06-171-5/+15
| | | | | | | Avoid pointless "LOAD segment with RWX permissions" linker warnings during the rp2040 build. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* armcm_link: Fix build on recent arm gcc/newlibc versionsKevin O'Connor2024-06-172-4/+6
| | | | | | | | It seems recent arm gcc versions no longer build correctly using the "--specs=nano.specs --specs=nosys.specs" linker flags. Replace those linker flags with "-nostdlib -lgcc -lc_nano". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Add kconfig options for rp2040 uart (#6549)Amken USA2024-04-242-23/+97
| | | | | Modified serial.c and Kconfig to dynamically select all possible UART combinations for RP2040 Signed-off-by: Hriday Keni <info@amken.us>
* rp2040: Only change SPI settings while peripheral is disabledKevin O'Connor2024-01-251-0/+4
| | | | | | | Make sure to disable/enable the peripheral to ensure the clock polarity is properly set prior to a change in CS. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Load vectortable into ramKevin O'Connor2024-01-252-0/+27
| | | | | | | Load the interrupt vector table into ram at startup. This reduces the chance of a flash cache access causing timing instability. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Run all code from ramKevin O'Connor2024-01-251-2/+3
| | | | | | | Place all normal code into ram. This reduces the chance that rp2040 instruction cache misses could cause subtle timing issues. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Always link using rp2040_link.lds.SKevin O'Connor2024-01-252-3/+11
| | | | | | Use the rp2040 specific linker script even when using a bootloader. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Add support for double buffering on USB bulk tx packetsKevin O'Connor2023-10-031-4/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Add support for double buffering on USB bulk rx packetsKevin O'Connor2023-10-031-6/+15
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Open code usb_read_packet() and usb_write_packet() in callersKevin O'Connor2023-10-031-36/+58
| | | | | | | Copy the code for these two functions to their respective callers. This is in preparation for double buffer support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Add helper functions to usbserial.cKevin O'Connor2023-10-031-20/+56
| | | | | | | Add helper functions for manipulating the buffer memory and packet control registers. This is in preparation for double buffer support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Kconfig: Support selecting optional features on chips with small flash sizeKevin O'Connor2023-06-081-1/+0
| | | | | | | | | | | | | Add a new HAVE_LIMITED_CODE_SIZE symbol that enables a menu to select optional features. This symbol is enabled on chips with small build sizes. Replace the HAVE_GPIO_BITBANGING with four new symbols: WANT_GPIO_BITBANGING, WANT_DISPLAYS, WANT_SENSORS, WANT_SOFTWARE_SPI, and WANT_SOFTWARE_I2C. This allows users a little more flexibility when selecting features they need. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Handle USB resetsKevin O'Connor2023-04-251-4/+9
| | | | | | | | | | | | On a USB bus reset the controller address needs to be reset to zero. Otherwise, the device becomes unresponsive after a USB reset and will remain unresponsive until a power cycle. This often shows up in the Linux system logs as "device descriptor read/64, error -32" messages. Make sure USB_INTE_BUS_RESET_BITS is enabled and clear the USB address on a bus reset. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb_cdc: Only call bootloader_request() if CONFIG_HAVE_BOOTLOADER_REQUESTKevin O'Connor2022-12-301-0/+1
| | | | | | | | | | Check for the build symbol prior to calling bootloader_request(). Enable the build symbol on rp2040, atsam, and atsamd chips. This also enables serial bootloader requsts on rp2040, atsam, and atsamd. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* scripts: support CanBoot on RP2040 in flash_usb.pyChris Lee2022-12-191-4/+5
| | | | Signed-off-by: Chris Lee <clee@mg8.org>
* rp2040: Move watchdog code to new watchdog.c fileKevin O'Connor2022-12-143-27/+32
| | | | | | | Move the watchdog code to its own file so that it is easier to disable it for development builds. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* armcm_link: Rename CONFIG_FLASH_START to CONFIG_FLASH_APPLICATION_ADDRESSKevin O'Connor2022-12-141-1/+1
| | | | | | Rename the build symbol name for better clarity on what it represents. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Rename canbus_send() to canhw_send()Kevin O'Connor2022-12-141-2/+2
| | | | | | | | Rename canbus_send() to canhw_send() and rename canbus_set_filter() to canhw_set_filter(). This makes it more clear where the code should reside. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Fix copy-paste error in Kconfig commentKevin O'Connor2022-12-141-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Fix watchdog enableKevin O'Connor2022-11-191-0/+3
| | | | | | | | | | | | The rp2040 watchdog does not actually reset anything by default. The psm_hw->wdsel field must be programmed to actually get a reset on a watchdog failure. Program that field so the watchdog is usable. Also, disable the watchdog before attempting a reboot into the bootloader. Otherwise the machine may just reboot a second time due to a missed watchdog event in the bootloader. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rp2040: Fix boundary check for max gpio pinKevin O'Connor2022-11-191-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>