340 Commits

Author SHA1 Message Date
Kevin O'Connor
d93645a750 stm32: Simplify Makefile
Breakout selection of timer and gpioperiph objects.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-04-16 13:54:44 -04:00
Kevin O'Connor
8c67adc164 Kconfig: Add new WANT_ADC option to reduce code size
Make it possible to not compile in support for ADC on chips with small
flash sizes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-04-16 13:54:44 -04:00
Kevin O'Connor
04e7eb20fd Kconfig: Add new WANT_I2C option to reduce code size
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>
2025-04-16 13:54:44 -04:00
Kevin O'Connor
868760f5b1 Kconfig: Add new WANT_SPI option to reduce code size
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>
2025-04-16 13:54:44 -04:00
Kevin O'Connor
b0fa36e221 Kconfig: Add new WANT_HARD_PWM option to reduce code size
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>
2025-04-16 13:54:44 -04:00
Kevin O'Connor
6356e3d35c stm32: Enable gcc -Os option on CONFIG_HAVE_LIMITED_CODE_SIZE
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-04-16 13:54:44 -04:00
Kevin O'Connor
8176ba22aa stm32: Turn on can.c error interrupts
It seems both ERRIE and LECIE must be enabled to get hardware error
interrupts.  Without this, the rx_error and tx_error reports are
likely to always be zero.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-04-03 13:32:23 -04:00
Russell Cloran
4b9add2fc3 stm32: Add support for additional i2c bus
Signed-off-by: Russell Cloran <rcloran@gmail.com>
2025-04-02 10:07:52 -04:00
Kevin O'Connor
55f60601ca stm32: Fix RESERVE_PINS_CAN pin ordering in fdcan.c
Always report the reserved pins in the same order (rx,tx).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-04-01 21:25:34 -04:00
FrY Sennberg
d679f711eb
stm32: Added PH13/14 CAN pin option for stm32h743 (#6857)
Added the option to select PH13/PH14 as CAN pins.

Signed-off-by:  Christoph Frei <fryakatkop@gmail.com>
2025-03-27 19:25:26 -04:00
Kevin O'Connor
8faed8d9fe stepper: Support step on both edges with custom minimum pulse duration
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>
2025-03-20 19:56:55 -04:00
Marius Petcu
3e7efe5ef1 stm32: Add support for USART6 on STM32F401
STM32F401 has USART6 on PA12/PA11 and PC7/PC6 with alternate
function mapping AF08. This can be used, for example, to connect
to the Elegoo Neptune 3, where PA12/PA11 are wired to an RJ10 plug
going to the stock screen.

Signed-off-by: Marius Petcu <marius@petcu.me>
2025-03-07 17:52:46 -05:00
Kevin O'Connor
1fc6d214f4 stm32: Add support for stm32f070x6 mcus
This mcu has smaller memory and may require remapping of PA11/PA12.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-02-16 13:57:59 -05:00
Timofey Titovets
fec3e685c9 stm32: h7 spi support reload mode & frequency
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-02-06 12:10:29 -05:00
Kevin O'Connor
b7366ae3fc stm32: Add support for reporting canbus state from fdcan.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-02-02 18:43:34 -05:00
Kevin O'Connor
6cdcf75e6b stm32: Add support for reporting canbus state from can.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-02-02 18:43:34 -05:00
Timofey Titovets
48590a35e4 stm32: forward i2c errors to i2ccmd
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2024-10-26 22:06:30 -04:00
Timofey Titovets
a4aa2a9002 i2c: handle errors at i2ccmds
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2024-10-26 22:06:30 -04:00
Liam Powell
fe89c19ac0
stm32: Add support for USART3 on PC11/PC10 on STM32G474. (#6704)
Signed-off-by: Liam Powell <liam@liampwll.com>
2024-10-24 11:10:09 -04:00
Timofey Titovets
b89d552387
stm32: allow 400Khz in stm32f0_i2c.c (#6694)
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2024-10-09 20:00:38 -04:00
Kevin O'Connor
064eee6859 stm32: Fix i2c clock speeds for chips with a peripheral clock over 48Mhz
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-09-22 22:14:47 -04:00
Kevin O'Connor
8b7cc43952 stm32: Reduce peripheral clock speed on stm32g4 chips
A 170mhz (or 150mhz) peripheral clock is too fast for some peripherals.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-09-22 21:18:34 -04:00
Timofey Titovets
d9236f1c20
STM32: Check for NACK (#6687)
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2024-09-22 19:24:29 -04:00
Kevin O'Connor
f71d2c7cfc stm32: Fix setting USB clock with USB to CANbus mode on stm32g4/stm32l4
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-08-29 22:31:13 -04:00
Nicholas Huskie
ca815f52c8
stm32: Fix getting wrong ADC value on PA0 of STM32G431 (#6660)
* Fix getting wrong ADC value on PA0

* Fix invalid/unused pin being used as adc channel on STM32H7/G431/L4

Signed-off-by: Nicholas Huskie <huskie@idealfuture.org.cn>
2024-08-08 22:45:12 -04:00
Kevin O'Connor
ae227d485c armcm_link: Fix build on recent arm gcc/newlibc versions
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>
2024-06-17 12:45:07 -04:00
Elias Bakken
3078912f1d
stm32: STM32F031 updates (#6607)
Add support for STM32F031x6 which is the 32 KB version of the STM32F031 MCU.

Add new I2C bus variant.

Signed-off by: Elias Bakken <elias@iagent.no>
2024-05-25 15:47:48 -04:00
Dropeffect GmbH
472d8e5b66 stm32: Add STM32G474 chip to Kconfig
Signed-off-by: Amr Elsayed from Dropeffect GmbH <code@dropeffect.com>
2024-05-14 11:53:38 -04:00
Dropeffect GmbH
80b55d3528 stm32: Add FDCAN2 channel needed for stm32g4 alternate pins
Some of the alternate pins defined are routed to FDCAN2 instead of
FDCAN1, this commit uses the correct IRQ register and peripheral
clock enable bit to enable FDCAN on those pins.

Signed-off-by: Amr Elsayed from Dropeffect GmbH <code@dropeffect.com>
2024-05-14 11:53:38 -04:00
Dropeffect GmbH
8f510da12b stm32g4: Fix ADC3 common interface registers name to ADC345_COMMON
Use ADC345_COMMON instead of ADC3_COMMON for stm32g4 ADC3 channel.

Signed-off-by: Amr Elsayed from Dropeffect GmbH <code@dropeffect.com>
2024-05-14 11:53:38 -04:00
Donald A. Cupp Jr
434770eaf9
stm32: Add new spi2 on stm32g0 chips (#6569)
Signed-off-by: Donald A. Cupp Jr <doncuppjr@yahoo.com>
2024-05-03 13:30:45 -04:00
TheFeralEngineer
36f9b26ef9
config: Artillery Sidewinder X3 (#6534)
Signed-off-by: Phil Timpson <theferalengineer@gmail.com>
2024-04-12 12:27:36 -04:00
Robert Cambridge
75a40e817d stm32: fix support for USARTs on STM32G0B0
Signed-off-by: Robert Cambridge <robert@cambridge.me>
2024-04-03 12:01:00 -04:00
FOG_Yamato
67c152745e
stm32: Add i2c3 bus to STM32H7 (#6541)
Signed-off-by: Balanuta Simion <simion@fogyamato.dev>
2024-04-02 22:02:22 -04:00
BIGTREETECH
bfb71bc2dc
stm32: Add i2c3_PC0_PC1 for stm32g0 (#6529)
Signed-off-by: Alan.Ma from BigTreeTech <tech@biqu3d.com>
2024-03-15 10:12:05 -04:00
Attila
18de421c4a
stm32: Fix USART3 ALT pinout on STM32G0 (#6523)
Signed-off-by: Attila Rakosi <rattila5@hotmail.com>
2024-03-10 18:48:48 -04:00
Kevin O'Connor
2e8b54ae5f stm32: Remove product names from bootloader choices menu
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-22 18:58:41 -05:00
Jakub
f653db9c88
stm32: Add 36KiB bootloader offset option (#6449)
- This offset is used by Anycubic Kobra 2 Neo bootloader

Signed-off-by: Jakub Przystasz <jakub.przystasz@gmail.com>
2024-01-22 18:55:34 -05:00
BIGTREETECH
daf875e6e4
stm32g0: Disable internal pull-down resistors on UCPDx CCx pins, because klipper never uses UCPD (#6462)
Signed-off-by: Alan.Ma from BigTreeTech <tech@biqu3d.com>
2024-01-21 20:23:12 -05:00
Alex Maclean
77619e912c stm32: Fix CAN for STM32G4
Signed-off-by: Alex Maclean <monkeh@monkeh.net>
2023-12-21 20:58:57 -05:00
Alex Maclean
147492b253 stm32: Fix ADC for STM32G4
At least STM32G4 requires four ADC clock cycles between hardware
clearing ADCCAL and setting ADEN or the write disappears. Make a
tenacious write attempt.

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
2023-12-21 20:58:57 -05:00
Alex Maclean
71ab6240f2 stm32: Fix STM32G4 USB
STM32G4 USB controller requires 8 or 16-bit access, not 32-bit

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
2023-12-21 20:58:57 -05:00
Will Puckett
fc102edc24
hard_pwm: Add pin defs for STM32F070 and STM32F072 (#6409)
Define hard_pwm pins for STM32F070 and STM32F072, and update KConfig accordingly. 

Signed-off-by: Will Puckett <willpuckett@gmail.com>
2023-12-05 17:44:51 -05:00
docgalaxyblock
83df4a8627 stm32: enable 64KiB bootloader offset for all F4
Signed-off-by: Joshua Schlicker <potter-91@web.de>
2023-11-16 22:09:59 -05:00
Kevin O'Connor
83ef0e135e stm32: Make sure to limit tx during usbfs startup
Wait for two tx packets before startup, and make sure one of those
packets is acked before sending a third tx packet.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-10-05 00:47:42 -04:00
Kevin O'Connor
043f18da26 stm32: Fix usbfs spurious USB packet transmit on startup
Commit cd8d57c2 added USB double buffering mode on transmits.
However, when enabling double buffering mode, the hardware seems to
always send at least two packets.  Spurious transmissions could cause
the Linux gs_usb driver to get confused, which could lead to the can0
device becoming unavailable on restarts.  Fix by waiting for two USB
packets to be available before enabling the endpoint.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-10-04 22:11:22 -04:00
Kevin O'Connor
615db729e7 stm32: Only enable one direction on usbfs double buffered end points
The bulk out endpoint should not be enabled in tx mode, and the bulk
in endpoint should not be enabled in rx mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-10-04 18:49:46 -04:00
Kevin O'Connor
cd8d57c2c6 stm32: Add usbfs double buffer support for bulk tx messages
Implement the usbfs fast buffer switching mechanism on the "bulk in"
endpoint.  This can improve the overall USB throughput and bus
utilization.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-10-03 23:26:46 -04:00
Kevin O'Connor
b1361d9e5b stm32: Add usbfs double buffer support for bulk rx messages
Implement the usbfs fast buffer switching mechanism on the "bulk out"
endpoint.  This can improve the overall USB throughput and bus
utilization.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-10-03 23:26:46 -04:00
Kevin O'Connor
01ac5334e9 stm32: Update usbfs to support setting both buffers for each endpoint
The usbfs device supports two buffers for each endpoint - typically
one for rx and one for tx.  Add support for explicit handling of both
buffers.  This is in preparation for improved "double buffering"
support.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-10-03 23:26:46 -04:00