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>
The gpio_peripheral() code is the same in stm32f0.c, stm32f4.c, and
stm32h7.c. Move that function to a new gpioperiph.c file to avoid
code duplication.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't go above 400Mhz as otherwise it causes 32bit rollover issues.
(Parts of the code expect a rollover will not occur faster than 10
seconds.)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Multiplying the desired bitrate by 4 results in half the
desired period and thus twice the desired bitrate.
Signed-off-by: Alex Maclean <monkeh@monkeh.net>
This clock is only needed for low-power operation mode,
and wasn't correctly configured anyway (should be 48MHz).
Signed-off-by: Alex Maclean <monkeh@monkeh.net>
Commit 9ecddd1b fixed a serious error (introduced in 7d95a004). Force
a protocol version change so users are aware of the need to update the
mcu code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 7d95a004 introduced a defect - if the cached timer pointed to
by last_insert did not reschedule itself then the cache would not be
in a valid state and other active timers may not get properly
rescheduled.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add an optimized step function for drivers that support stepping on
both rising and falling edges of the step pin. Enable this
optimization on 32bit ARM micro-controllers. Automatically detect
this capability in the host code and enable on TMC drivers running in
SPI/UART mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Remove the STEP_DELAY Kconfig option and replace it with a per-stepper
step_pulse_duration printer.cfg config option.
The AVR code will continue to have optimized code to step and "unstep"
in the same function (which is automatically activated when the step
delay is 40 ticks or less). This change removes the Kconfig option
for single function step/unstep on 32bit processors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The floating point unit must be enabled in order to use it and Klipper
does not currently implement that. Newer versions of gcc may spill
registers to the floating point unit causing failures.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The floating point unit must be enabled in order to use it and Klipper
does not currently implement that. Newer versions of gcc may spill
registers to the floating point unit causing failures.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The floating point unit must be enabled in order to use it and Klipper
does not currently implement that. Newer versions of gcc may spill
registers to the floating point unit causing failures.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Tracking of the last reset is no longer needed after commit 8f76e53c.
Remove the code tracking that status and remove the flag definition.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some architectures do better if the global variables accessed from the
timer dispatch code are in a struct.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some versions of gcc, in some cases, decide that it is OK to move the
read to `INTR` to right after clearing the `SETUP_REC` bit of
`SIE_STATUS`, instead of after the `memcpy`.
The rp2040 datasheet doesn't appear to say anything about how quickly
the `SETUP_REC` bit will be cleared in `INTR`, but regardless the
compiler should not be re-ordering the read like this.
Here we force the correct ordering using a memory barrier.
Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
Copy the parameters of calls to console_sendf() on pru1 to pru0 and
then call that function on pru0. Although copying the parameters is a
"hack", the code size reduction is notable.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The F042 and F072 chips are in the same series and the code should be
nearly identical for these chips. Implement the alias and enable USB
for the F072 chips.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The previous OSPEEDR value of 0x2 was copied from the stm32f4.c code,
but the stm32f0 interprets that value the same as 0x0 - which is "low"
speed. Change the OSPEEDR value to "medium" speed so that it matches
the configuration of stm32f1 chips.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This change has been expanded to include all STM32F4 processors, since they share a common TIMER mapping with some processors just not having all of the timers and pins.
Signed-off-by: Jerome Helbert <jerome@helbert.net>
This commit contains a configuration for the Anycubic Vyper printer from 2021.
It uses a clone of the STM32F103 chip named GD32F103.
There are 2 Mainboard versions out there v0.0.5 and v0.0.6, this config has
been tested with the v0.0.6 only. It should probably work for v0.0.5 as well
since there are no different changes in the Anycubic Marlin firmware.
The LCD is not supported yet (might work, but didn't try yet).
Signed-off-by: Marc Neuhaus <marc@neuhaus.nrw>
Signed-off-by: Manuel Fichtner <manuel.fichtner@me.com>
The F405, F407, and F429 chips are in the same series and almost all
code definitions should apply to all chips in that series. Implement
the alias and fix defintions in adc.c and Kconfig that were only
applying to a subset of that series.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Transmit data from mcu to host using 5 bytes per sample and up to 10
samples per message block. This improves bandwidth efficiency.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Query the adxl345 message counter every 100ms so that accurate timing
can be obtained during measurements. This allows the adxl345 data to
be exported with timestamps while captures are running.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>