Commit Graph

906 Commits

Author SHA1 Message Date
BIGTREETECH ada571ecb8
stm32: Enable Automatic retransmission feature to avoid data loss caused by bus conflict for STM32G0B1 fdcan (#5550)
Signed-off-by: Alan.Ma from BigTreeTech <tech@biqu3d.com>
2022-06-06 10:59:18 -04:00
Kevin O'Connor db5a4351a5 Kconfig: Move CANBUS_FREQUENCY definition from src/stm32/Kconfig to src/Kconfig
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-06-04 11:56:59 -04:00
Kevin O'Connor c1f4bdebf2 armcm_reset: Add a armcm_reset.h header file for try_request_canboot()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-06-04 11:52:39 -04:00
Eric Callahan 39535b15ba stm32: use TME bits to find the canbus tx mailbox
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-03 14:51:01 -04:00
Eric Callahan 3c7eea7336 stm32: call "try_request_canboot" for bootloader requests
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-03 14:51:01 -04:00
Eric Callahan 129091d811 canbus: use "try_request_canboot" method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-03 14:51:01 -04:00
Eric Callahan 8b1e3c3fb2 armcm_reset: support canboot detection
When CanBoot is detected set its bypass signature when a
reset is requested.

Add a "try_request_canboot()" method that may be called
from from USB and Canbus bootloader requests.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-03 14:51:01 -04:00
Kevin O'Connor 63affd7006 stm32: Rework kconfig to use CONFIG_CANSERIAL for both can.c and fdcan.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-06-01 10:59:10 -04:00
BIGTREETECH 1ff7261203
stm32: stm32g0b1 fdcan support (#5488)
Signed-off-by: Alan.Ma from BigTreeTech <tech@biqu3d.com>
2022-06-01 10:43:45 -04:00
Kevin O'Connor 19a478de37 stm32: Don't allow USB on internal clock for stm32f103/stm32f070
Reported by @kaidegit.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-23 15:35:05 -04:00
Kevin O'Connor c14118e9c6 misc: Import misc.h in all files defining console_sendf()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-13 11:22:47 -04:00
Kevin O'Connor a6b3d2f18f stm32: Remove unused header from can.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-10 15:03:55 -04:00
Kevin O'Connor 2c441b4502 canbus: Rename CANBUS_CMD_SET_NODEID to CANBUS_CMD_SET_KLIPPER_NODEID
Rename the command name for consistency with the canbus_query.py
script.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-10 11:55:06 -04:00
Eric Callahan 60625f4422 stm32: add 8 KiB bootloader option for F0x2 devices
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-10 11:48:06 -04:00
Eric Callahan 81ff8e125c canbus: send 8 bytes in the id response
The last byte contains the "node id" command, which is used to
identify the application.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-10 11:48:06 -04:00
Eric Callahan 3505f4cae5 canbus: add bootloader support
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>
2022-05-10 11:48:06 -04:00
Kevin O'Connor c263f76f9f stm32: Fix typo in i2c.c
Reported by @kaidegit.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-07 10:13:34 -04:00
JamesH1978 542486fba7
stm32: Add 64kib bootloader offset option to STM32F401 (#5457)
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>
2022-04-25 12:07:48 -04:00
Martin Hierholzer 7793784640 spicmds: Allow inversion of CS pin for SPI busses
Signed-off-by: Martin Hierholzer <martin@hierholzer.info>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-04-22 13:25:03 -04:00
alstoepp 44567879f6
stm32: Add STM32F072 16KiB bootloader option (#5404)
Signed-off-by: Alexander Stöpperger <a.stoepperger@gmx-topmail.de>
2022-04-13 11:22:04 -04:00
Kevin O'Connor 38e82e8d8f stm32: Add support for additional i2c buses
Reported by @StoneColdCrazy.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-04-11 10:58:34 -04:00
Kevin O'Connor f9d505e376 sensor_angle: Support TLE5012b frame counter for timing
Use the tle5012b internal frame counter to calculate the time of each
measurement.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-03-29 20:34:46 -04:00
Kevin O'Connor 74937326d3 sensor_angle: Add support for bulk querying of spi angle sensors
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-03-29 20:34:46 -04:00
Alex Maclean 91ba9c00e3 atsam: Fix typo in sam4e_afec
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>
2022-03-28 10:19:58 -04:00
Alex Maclean 8049243221 atsam: Add support for SAM E70
Signed-off-by: Alex Maclean <monkeh@monkeh.net>
2022-03-26 11:59:27 -04:00
Blinker73 df79893dbc
linux: Update i2c.c (#5295)
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>
2022-03-14 14:24:27 -04:00
Kevin O'Connor 7731c30422 stm32: Allow 32KiB bootloader to be specified for all STM32F4 builds
Reported by @GerogeFu.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-03-14 12:26:41 -04:00
Kevin O'Connor e3beafbdb4 stm32: Clarify CCIPR2 setting in stm32g0.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-03-11 14:12:11 -05:00
Kevin O'Connor 4ce2d379bb stm32: Simplify CCIPR2 register assignment on stm32g0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-03-09 13:28:00 -05:00
BIGTREETECH d75154d695
stm32: USB clock source from PLLQCLK on stm32g0 (#5341)
Signed-off-by: Alan.Ma from BigTreeTech <tech@biqu3d.com>
2022-03-09 13:11:04 -05:00
Kevin O'Connor 7ce409d7a5 lpc176x: Fix serial ordering of initialization
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>
2022-03-01 12:55:06 -05:00
Kevin O'Connor e3cbe7ea36 stm32: Clear SPE flag on a change to SPI CR1 register
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>
2022-02-10 18:12:01 -05:00
Kevin O'Connor 99d55185a2 stm32: Wait for transmission to complete before returning from spi_transfer()
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>
2022-02-10 17:27:55 -05:00
adelyser 9174c0241e
stm32: Fix ADC on stm32h7 (#5239)
Don't reset the ADC peripheral if the clock is already enabled.
Fixes #5236

Signed-off-by: Aaron DeLyser <bluwolf@gmail.com>
2022-02-06 18:29:53 -05:00
Lasse Dalegaard a7b01857f5 flash_usb: use sudo for rp2040 flashing
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>
2022-01-31 11:10:02 -05:00
Sergey1560 fb6d6d381c
stm32: Add remap CAN to PD0/PD1 for stm32f103 (#5173)
Signed-off-by: Sergey Terentiev <sergey@terentiev.me>
2022-01-26 18:06:55 -05:00
Lasse Dalegaard 090fcf928f rp2040: implement I2C
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>
2022-01-12 11:44:31 -05:00
Kevin O'Connor 4c8d24ae03 stm32: Update Kconfig as CANBUS isn't available on stm32f401
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-01-07 22:17:26 -05:00
Lasse Dalegaard 7c0559c6e6 rp2040: add make flash support
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>
2022-01-06 17:32:54 -05:00
Kevin O'Connor 8b6753d68f stm32: Unify enable_pclock() code
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>
2021-12-30 12:18:05 -05:00
adelyser 9bdd61758e
stm32: Fix the GPIO register for stm32h7 (#5077)
Signed-off-by: Aaron DeLyser <bluwolf@gmail.com>
2021-12-29 18:01:28 -05:00
Kevin O'Connor 247cd753e2 stm32: Fix ADC on stm32f042
It seems the stm32f042 chip needs a small delay during ADC enable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-12-24 19:27:04 -05:00
Kevin O'Connor c89a01c83b stm32: Enable SPI support on stm32g0
Signed-off-by: Alan.Ma from BigTreeTech <tech@biqu3d.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-12-23 22:15:26 -05:00
Kevin O'Connor 1c24317380 stm32: Enable ADC support on stm32g0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-12-23 22:15:26 -05:00
Kevin O'Connor 88325b6c93 stm32: Rework register access on stm32f0_adc.c
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>
2021-12-23 22:15:26 -05:00
Kevin O'Connor 20ac48f680 stm32: Minor whitespace changes to stm32f0_adc.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-12-23 22:15:26 -05:00
Kevin O'Connor b710174107 stm32: Enable I2C on stm32g0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-12-23 22:15:26 -05:00
Kevin O'Connor 9549a3b4fb stm32: Add support for USB on stm32g0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-12-23 22:15:26 -05:00
Kevin O'Connor 8d7a6e4ca4 stm32: Rework USB transfer memory layout in usbfs.c
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>
2021-12-23 22:15:26 -05:00
Kevin O'Connor a4a02e86af stm32: Fix buffer size calculation in usbfs.c
When the buffers are over 32 bytes, a block count of 1 starts at 0.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-12-23 22:15:25 -05:00