Rework `generic/serial_irq` to handle multiple serial connections. Buffers
are now allocated dynamically during setup.
Rework board-specific serial implementations to handle multiple serial
connections and runtime configuration.
Move host-communication related code to separate files.
`sendf()` now returns a value indicating whether it succeeds or not.
Host-communication serial interrupts are given priority over other serial
interrupts.
For STM32: merge STM32F0 serial implementation with generic STM32 serial
implementation and use a separate, static implementation on STM32F031 to
limit footprint.
This adds a command which allows an external script to broadcast a
bootloader request, using a supplied UUID to match the request.
Included is a method to process requests to enter the canboot
bootloader.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This is needed for the Creality Ender 3 S1 with the STM32F401 chips to enable a 64kib bootloader offset
Signed-off-by: James Hartley <james@hartleyns.com>
Accidentally introduced in 8049243221,
renders the AFE non-functional on SAME70. Should have had little impact
on SAM4E.
Signed-off-by: Alex Maclean <monkeh@monkeh.net>
Similarly to commit 8cf1b512 for SPI, the Rpi4 has more i2c busses to offer
This change allows klipper to use up to I2c bus 6
/boot/configtxt
dtparam=i2c_arm=on
dtoverlay=i2c6
and
pi@fluiddpi:~ $ ls -1 /dev/i2c*
/dev/i2c-1
/dev/i2c-6
Signed-off-by: Sylvain Dansereau <brutus_dansereau@hotmail.com>
The serial device needs to be enabled before setting the DLAB bit.
This prevented UART3 from working.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The stm32 specs indicate that the SPE bit must be cleared before
changing the CPHA or CPOL bits.
Reported by @cbc02009 and @bigtreetech.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's possible for the SCLK pin to still be updating even after the
last byte of data has been read from the receive pin. (In particular
in spi mode 0 and 1.) Exiting early from spi_transfer() in this case
could result in the CS pin being raised before the final updates to
SCLK pin.
Add an additional wait at the end of spi_transfer() to avoid this
issue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The rp2040 can be flashed without sudo when using udev rules to give the
user permission, but in a standard configuration sudo is required.
Here we make it possible for flash_usb to use sudo for the rp2040
target, and make it the default when using `make flash` for the rp2040.
As for other targets, one can set `NOSUDO=1` to not call through sudo.
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
This implements I2C for the rp2040 target. All output groupings of both
I2C blocks are available for use.
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
This adds `make flash` support for the rp2040 target. Flashing is
performed using a custom `rp2040_flash` tool that uses the PICOBOOT
protocol. Root is not required.
The user specifies the serial device of the rp2040 they wish to flash as
the device. This device is reset into bootsel mode and `rp2040_flash`
is invoked on the original USB device path.
If the device is already in bootloader mode, the user can specify
'first' as `FLASH_DEVICE` which will simply invoke `rp2040_flash` with
no bus/address options.
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
Unify the handling of the enable_pclock() and is_enabled_pclock() code
across all stm32 chips. All chips will now perform a peripheral reset
on enable_pclock() (this is a change for stm32f0 and stm32h7). The
enable_pclock() code will now also disable irqs during the enable.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid read-modify-write operations where possible. The register
values are in a known state so prefer absolute writes.
Improve handling of race conditions with hardware updates.
Remove the adc reference from "struct gpio_adc" as it is a constant.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use a fixed layout for the USB transfer memory and remove the ep_mem
struct definition.
This is in preparation for stm32g0 support.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>