Commit Graph

1021 Commits

Author SHA1 Message Date
Kevin O'Connor 1a693c18d6 stm32: Fix CAN2 handling in can.c
Using the CAN2 interface still requires that CAN1 be enabled, and the
filtering hardware is always on the CAN1 hardware block.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:32:37 -05:00
Kevin O'Connor 80943d3846 stm32: Increase sample time in stm32h7_adc.c
The existing sample times are not long enough to reliably sample the
internal temperature sensor.  Longer sample times should also improve
results with temperature sensors that have a higher inductance.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:22:21 -05:00
Kevin O'Connor 33f973e452 stm32: Don't set boost nor linear calibration on stm32h723 adc3
Only adc1 and adc2 have these CR register bits on stm32h723.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:22:21 -05:00
Kevin O'Connor cefbad9ef4 stm32: Reduce read-modify-write of CR in stm32h7_adc.c init
Prefer explicitly setting the CR hardware register to defined values
during initialization.

Also, prefer "#if CONFIG_MACH_STM32H7" over bit definitions to make it
clear that the code applies only on stm32h7.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:22:21 -05:00
Kevin O'Connor d372f913ef stm32: Don't use read-modify-write on ISR register in stm32h7_adc.c
Bits are cleared in the ISR register by writing 1, not by masking.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:22:21 -05:00
Kevin O'Connor 51526fd627 stm32: ADC timing rework and fixes in stm32h7_adc.c
The stm32l412 doesn't have a PLLSAI1 clock and therefore the CKMODE
should not be set to zero.

The stm32h7 chips run the adc at 25mhz, so BOOST should be set to
0b10.

Improve timing comments.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:22:21 -05:00
Kevin O'Connor cef0b70c88 stm32: Move clock line mapping from stm32h7_adc.c to lookup_clock_line()
Use the common lookup_clock_line() code to lookup the adc clock lines.
This also enables resets on the adc1/adc2 hardware block.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:22:21 -05:00
Kevin O'Connor 1034f19134 stm32: Simplify setting of adc_common fields in stm32h7_adc.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:22:21 -05:00
Kevin O'Connor 0bf073ba08 stm32: Use a consistent bank size of 20 across all chips in stm32h7_adc.c
Add a pad entry to adc_pins[] on stm32l4 so that it matches the other
chips.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:22:21 -05:00
Kevin O'Connor f571618376 stm32: Simplify setting of 12bit mode on stm32h7 in stm32h7_adc.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:22:21 -05:00
Kevin O'Connor 876c3ffffd stm32: No need to use hardware oversampling in stm32h7_adc.c
Not all chips implement hardware oversampling.  The software already
implements oversampling, and additional hardware oversampling is
unlikely to improve results.  Remove the hardware oversampling to
simplify the code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:22:21 -05:00
Kevin O'Connor efdc29f589 stm32: Simplify CFGR register setup in stm32h7_adc.c
On all chips, the JQDIS bit is set and the CONT, RES, ALIGN bits are
clear after a reset.  There is no need to program the OVRMOD bit.  Use
the same logic across chips to help unify the adc implementation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:22:21 -05:00
Kevin O'Connor 9b7dcfa333 stm32: No need for LDORDY check in stm32h7_adc.c
Not all chips have the LDORDY flag, while all chips will stabilize in
10us.  There is no need for two different implementations as it is
safe to wait 20us on all chips.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-17 18:22:21 -05:00
Stefan Dej 5502be01f7 linux: add -I attribute for user defined socket paths
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2023-01-17 18:17:25 -05:00
Kevin O'Connor 448c1a1488 stm32: Reindent ifdefs in stm32f0_i2c.c
A whitespace and comment change only - no functional changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-01-03 12:52:35 -05:00
Alex Voinea 9c2ccceb9f
stm32: Expand stm32g0 family (#5838)
Add stm32g07x family support.

Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
2023-01-03 12:43:46 -05:00
Kevin O'Connor 1ff0a5494a stm32: Check for CONFIG_HAVE_BOOTLOADER_REQUEST in dfu_reboot.c
Support disabling dfu_reboot if HAVE_BOOTLOADER_REQUEST is disabled in
the Kconfig rules.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-30 21:28:32 -05:00
Kevin O'Connor b51b068442 avr: No need to define bootloader_request()
Since avr does not define HAVE_BOOTLOADER_REQUEST it is not necessary
to define the function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-30 21:28:32 -05:00
Kevin O'Connor c620f4836e canserial: Only call bootloader_request() if CONFIG_HAVE_BOOTLOADER_REQUEST
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-30 21:28:32 -05:00
Kevin O'Connor 34fd3f41ea usb_cdc: Only call bootloader_request() if CONFIG_HAVE_BOOTLOADER_REQUEST
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>
2022-12-30 21:28:32 -05:00
Kevin O'Connor 806cf233ec stm32: Include "misc.h" in stm32l4.c and stm32g4.c
Include for bootloader_request() definition.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-30 21:28:32 -05:00
Kevin O'Connor 4ca1e5f670 serial_irq: Rename SERIAL_BOOTLOADER_SIDECHANNEL to HAVE_BOOTLOADER_REQUEST
Rename the build symbol.  This is in preparation for enabling
HAVE_BOOTLOADER_REQUEST on usb and canbus.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-30 21:28:32 -05:00
Kevin O'Connor 4753315601 Kconfig: No need to specify "default n" in main Kconfig file
A "bool" option already defaults to "n" so no need to state that
explicitly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-30 21:28:32 -05:00
Chris Lee aac613bf44 scripts: support CanBoot on RP2040 in flash_usb.py
Signed-off-by: Chris Lee <clee@mg8.org>
2022-12-19 15:42:53 -05:00
Kevin O'Connor 4af8786587 stm32: Move dfu reboot logic to new dfu_reboot.c file
Move the stm32 DFU reboot logic to a new dfu_reboot.c file.  This
simplifies the per-chip code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-18 19:50:08 -05:00
Kevin O'Connor b6cd77f6e3 stm32: Separate out USB DFU reboot logic in stm32l4.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-18 19:50:08 -05:00
Kevin O'Connor be74c72555 stm32: Separate out USB DFU reboot logic in stm32g4.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-18 19:50:08 -05:00
Kevin O'Connor 3c1ed3bb27 initial_pins: Add check to reduce compile time size when not in use
Add a check to the start of initial_pins_setup() to make it easier for
gcc to optimize the code if it is not in use.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-16 22:46:47 -05:00
Kevin O'Connor 0c43ae1fd4 stm32: Just clean dcache instead of disabling on stm32h7 dfu reboot
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-16 17:29:45 -05:00
Kevin O'Connor 02b45c91fb armcm_reset: Flush dcache before rebooting into canboot
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-16 17:26:41 -05:00
Kevin O'Connor b0d9cbfb4b stm32: Fix usb build on stm32g0b0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-15 18:43:25 -05:00
Kevin O'Connor 7d1df81e5e stm32: Fix USB support on stm32g0b1
A typo in commit e33b41ab broke USB selection on stm32g0b1.

Reported by @Pmant.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-15 11:44:12 -05:00
Kevin O'Connor ac090d9d52 stm32: Fix stm32l4 build
Commit c5d56f44 neglected to define ADCIN_BANK_SIZE in stm32h7_adc.c
on stm32l4.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-15 11:27:19 -05:00
Kevin O'Connor f31540b357 stm32: Minor changes to stm32g0b0 ifdefs
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-15 10:27:51 -05:00
Alex Voinea e33b41abaa stm32g0: add stm32g0b0 support
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
2022-12-15 10:05:43 -05:00
Kevin O'Connor 9d668d63a7 stm32: Rework usb_reboot_for_dfu_bootloader() so it works on stm32h723
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-15 09:52:21 -05:00
Kevin O'Connor fe0fc29616 rp2040: Move watchdog code to new watchdog.c file
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>
2022-12-14 19:21:25 -05:00
Kevin O'Connor 9b342c65c8 armcm_link: Rename CONFIG_FLASH_START to CONFIG_FLASH_APPLICATION_ADDRESS
Rename the build symbol name for better clarity on what it represents.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-14 18:44:07 -05:00
Kevin O'Connor dc94a35752 lpc176x: Fix lpc176x build
Fix build error introduced in commit 6ba2c3e1.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-14 14:50:31 -05:00
Kevin O'Connor d40ebdab06 canbus: Rename canserial_send() to canbus_send()
Rename canserial_send() to canbus_send() and canserial_set_filter() to
canbus_set_filter().  This makes it more clear where the code should
reside.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-14 14:25:21 -05:00
Kevin O'Connor 52a6bed24e canbus: Rename canbus_send() to canhw_send()
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>
2022-12-14 14:15:14 -05:00
Kevin O'Connor e16a693b1e rp2040: Fix copy-paste error in Kconfig comment
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-14 13:34:15 -05:00
Kevin O'Connor 6ba2c3e1d1 lpc176x: Use "Bootloader offset" prompt in "make menuconfig"
Use the same bootloader offset terminology that is used with other
chips (eg, stm32).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-14 13:29:39 -05:00
Kevin O'Connor 69f76b3b66 stm32: Apply race fixes to stm32h7_adc.c
Improve handling of race conditions with hardware updates.  This is
the same changes applied to stm32f0_adc.c in commit 88325b6c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-12 23:46:49 -05:00
Alex Voinea c7f323e863 stm32g0: Do not disable SWD by accident
Keep SWEN as 1 in FLASH->ACR register such
that the SWD interface doesn't get disabled.

Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
2022-12-11 20:09:50 -05:00
Alex Voinea 0972561783 stm32g4: Do not disable SWD by accident
Keep SWEN as 1 in FLASH->ACR register such
that the SWD interface doesn't get disabled.

Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
2022-12-11 20:09:50 -05:00
BIGTREETECH 516fdae2b7
linux: add 'GPIOI' for linux process (#5926)
Signed-off-by: Alan.Ma from BigTreeTech tech@biqu3d.com
2022-12-11 20:07:58 -05:00
bigtreetech a42f615881 stm32: add STM32H723 support
Signed-off-by: Chen.BJ from BigTreeTech chenbj@biqu3d.com
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-02 13:55:23 -05:00
Matt Baker c5d56f4438 stm32g4: implement build,usb,can,i2c,spi,serial,adc.
Signed-off-by: Matt Baker <baker.matt.j@gmail.com>
2022-12-02 11:31:42 -05:00
Kevin O'Connor 8977c4e764 rp2040: Fix watchdog enable
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>
2022-11-19 10:13:50 -05:00