Commit Graph

1635 Commits

Author SHA1 Message Date
Karl Palsson
b8bdc87d2d trivial: stm32f0:crc fix typo in doxygen
Signed-off-by: Karl Palsson <karlp@tweak.au>
2023-02-02 23:15:54 +00:00
Karl Palsson
e54650fba4 stm32f0: adc: external trigger selection to unshifted
Cleanup one function at a time.  Use the correct doxygen references, use
unshifted forms in user facing apis.  Yes, only the trigger at the
moment, as the polarity is shared.

Signed-off-by: Karl Palsson <karlp@tweak.au>
2023-02-02 22:47:44 +00:00
neoxic
69e4ade399 stm32:f0/g0/l0: adc: Add EXTSEL defines
Add definitions for all the specific options, as is done for other
families.

Reviewed-by: Karl Palsson <karlp@tweak.au>
(Added extra g0 definitions that were missed)
2023-02-02 22:13:05 +00:00
neoxic
7bd0f4097b stm32g0:adc: drop non-existant ADC_OR register
Reviewed-by: Karl Palsson <karlp@tweak.au>
2023-02-02 21:43:43 +00:00
neoxic
d262e70fc3 stm32g4/g0: adc: fix clock prescalers
CCR register definitions were completely wrong, both decimal/hex mixups,
and straightup transcriptions from the reference manual errors.

Unify the styles for both g0 and g4, using the same (duplicated)
function for both implmentations.

Reviewed-by: Karl Palsson <karlp@tweak.au>
2023-02-01 21:40:56 +00:00
Karl Palsson
88e91c9a7c stm32:rcc: update _get_clock (uart/i2c) to handle all cases
Adds handling for missing cases.  While i2c only has 3 cases, uarts have
all 4, so make sure they're handled properly.
Removes duplicated/redundant definitions.
Adds doxygen wrappers, even if only for internal use.

Fixes: e41ac6ea71 stm32: added peripheral clock get helpers for all stm32
Signed-of-by: Karl Palsson <karlp@tweak.au>
2023-01-13 02:15:41 +00:00
Karl Palsson
df654d7f28 stm32: spi: drop spi_reset()
It's simply a wrapper around rcc_reset_pulse already.
Just drop it. See 034dbf20ff for the same deletion for timers.

Signed-off-by: Karl Palsson <karlp@tweak.au>
2023-01-13 02:15:41 +00:00
Karl Palsson
b3bdf025d7 stm32: i2c: drop i2c_reset()
It's simply a wrapper around rcc_reset_pulse already.
Just drop it. See 034dbf20ff for the same deletion for timers.

Signed-off-by: Karl Palsson <karlp@tweak.au>
2023-01-13 02:15:41 +00:00
Karl Palsson
2c180d8431 stm32g0: rcc: add missing periphs
A bunch of periphs on newer parts weren't defined.  Add their
enable/reset bit definitions so they can be used.

Signed-off-by: Karl Palsson <karlp@tweak.au>
2023-01-13 02:15:41 +00:00
Karl Palsson
5796f41caa [BREAKING] stm32g0: add/rename missing periphs/irqs
Updated to RM0444_rev5

Breaking: renames some irqs to be more specific and better match with
refman.  We're still in the "between" tags, so break all the toys!

Signed-off-by: Karl Palsson <karlp@tweak.au>
2023-01-13 02:15:41 +00:00
Karl Palsson
7c09d0d14c stm32f3: enable RTC
Fixes: https://github.com/libopencm3/libopencm3/issues/1446
Fixes: 18f4d7c1b7 stm32f3: rtc: include correct shared header

No testing on real hardware, but the docs imply that this should have
always had the "basic" rtc-v2 peripheral.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2022-11-17 21:15:47 +00:00
Karl Palsson
e1ec3e4e18 stm32: rcc: clarify flash_prefetch_enable documentation
It's not globally enabled by default, and it has consumption impacts as
well.  Reported on IRC.
2022-11-07 14:38:19 +00:00
Oskar
d8d33ca36d stm32: cordic: add new peripheral
Review-URL: https://github.com/libopencm3/libopencm3/pull/1418
Reviewed-by: Karl Palsson <karlp@tweak.net.au>

Edits: removed non-existant u5 code, squished to a single commit,
whitespace cleanup.
2022-10-27 21:37:00 +00:00
Karl Palsson
5980c58f9b stm32g4: syscfg: fix doxygen
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2022-09-19 12:59:05 +00:00
andrej
2f29614133 stm32: Support CRC, SYSCFG and USART on G4 2022-09-19 13:43:46 +02:00
neoxic
0a132c0f6c stm32: dmamux: Fix tabs as tab size 8 2022-09-16 10:24:45 +00:00
neoxic
b37811915e stm32:dmamux: fix individual DMAMUX register aliases DMAMUXn_*
Argument 'dmamux_base' is set by an alias and hence is always unused.
2022-09-15 21:36:38 -07:00
Karl Palsson
44e142d4f9 cm3: scb: C11 keyword compliance
Avoid use of the gnu specific "asm" keyword, and use the __asm__
keyword, as used everywhere else in the library.  This fixes compilation
in C11, and unifies all uses of asm literals in the codebase.

Reported-by: @dragonmux
Fixes: https://github.com/libopencm3/libopencm3/pull/1425

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2022-07-05 16:55:11 +00:00
Oskar
4675227783 stm32g4: rng: enable common code support
Also fixes an error in the memory map exposed by enabling this.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2022-06-03 21:02:19 +00:00
Oskar
1e71f18be2 stm32g4: i2c: enable common peripheral code. 2022-06-03 20:59:34 +00:00
Vlad Logyin
3122c0b33f stm32l4: rcc: Implement PLL helper as seen in other MCU families
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2022-06-03 20:53:15 +00:00
Stefan Tauner
757a0a14eb doc: cm3: mpu: document defines of individual register fields 2022-06-03 20:34:59 +00:00
Karl Palsson
e9d87a9cb7 stm32: adc-v2-multi: fix JSQR
Fixes: https://github.com/libopencm3/libopencm3/issues/1412

Verified against RM0394 (L4), RM0440 (G4) and RM0316 (F3)

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2022-05-17 11:06:53 +00:00
me@me.net
d8aa2f17b0 stm32: timer: Add API to set external clock mode 2 2022-04-27 13:11:58 +00:00
Stefan Tauner
5bcf2a0c35 stm32l4: fix various problems with rcc_get* functions
- rcc_get_i2c_clk_freq: Add support by taking RCC_CCIPR2 into account for I2C4.
 - rcc_get_timer_clk_freq: Add support for LP timers
 - rcc_get_usart_clk_freq: Fix APB freq used for LPUART1 and UART1, respectively.
2022-04-13 20:22:47 +00:00
Eduard Drusa
66bf499e1b NRF5x: I2C EasyDMA support for NRF5x, extended API
This commit adds support for NRF52 TWI Master mode and slightly extends
existing I2C API. This is a breaking change, while mode selection needs to be
done during enabling I2C. There is one additional breaking change done because:
1) Unicore MX API design was PITA for writes
2) It is incompatible with EasyDMA

I strongly apologize to all two users who might be affected by this change.
2022-04-05 15:40:44 +00:00
Karl Palsson
c78007338e stm32l: lptimer: stylecheck 2022-03-08 20:57:20 +00:00
Karl Palsson
bef7df02b0 stm32h7: rcc: stylecheck fixes 2022-03-08 20:57:20 +00:00
Karl Palsson
f92a52bef5 stm32g0: rcc: fix i2s1 clksel definition
Stylecheck uncovered a bad define.
2022-03-08 20:57:20 +00:00
Karl Palsson
c13ad2fce4 stm32g0:adc: stylecheck 2022-03-08 20:57:20 +00:00
Karl Palsson
bb31308bc7 stm32: hrtim: stylecheck cleanup 2022-03-08 20:57:20 +00:00
Karl Palsson
c08df942d7 msp432: replace spaces with tabs: stylecheck 2022-03-08 20:57:20 +00:00
Karl Palsson
b05865a854 pac55xx: fix stylecheck warning 2022-03-08 20:57:20 +00:00
Parth Panchal
192d7fec2e stm32f1:gpio: Added missing definitions for usart1
Add missing explicit gpio definitions for remainder of usart1 signals.

Fixes: https://github.com/libopencm3/libopencm3/issues/1326
2022-03-08 20:18:54 +00:00
Marek Koza
bd4a970de9 stm32:fdcan: Fix FDCAN_FIFO_XTD bit position 2022-03-08 20:07:43 +00:00
Keenan Tims
9a5a6a2bfd LM4F: Make SYSCTL enum definitions C++ compliant
Refactor definitions to remove pointer-to-int casts
2022-03-03 09:18:27 +00:00
Evgenii Iarkov
72d4064744 stm32/g0: rcc: Correct RCC_CCIPR_TIM1SEL_SHIFT value (20 -> 22)
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2022-02-02 12:47:18 +00:00
Karl Palsson
1b83a3ce47 stm32g4: pwr: Fix CR3 USB PD option bits
Presumably copy/paste error in original submission.
Verified in RM0440rev1 and rev5.

Fixes: c26eab251
Reported-by: qyx on the internet
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2022-01-22 00:06:32 +00:00
Eduard Drusa
213a6b4244 Initial merge of Nordic Semi nRF51/52 from Unicore MX back into Libopencm3
* merged: nrf tree from unicore-mx
* fixed: small changes to make merged code play with rest of locm3 again
* added: linker script generator defines for nRF51/52 stubs
* added: doxygen support

This removes code and changes names and styles where relevant to be more
inline with normal libopencm3.

NRF52x library is built for hardfloat, M4F by default.  The M4 no float
variants are less common, and if needed, the library can be built
manually for those variants.  Unless some very common boards show up
using those parts, we don't need an extra library build.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
Tested-by: Karl Palsson <karlp@tweak.net.au>
2021-12-05 16:52:36 +00:00
Will Gallia
c36a4538b0 stm32: fix typo for auto baud rate request bit in USART_RQR 2021-12-01 22:38:30 +00:00
Karl Palsson
ed2aada3e8 doc:stm32f4:pwr: link more doxygen
f4 extensions weren't being included in generated documentation.
2021-11-10 20:36:29 +00:00
Dima Barsky
3e480eecae stm32f4: pwr: add missing bits
Extra bits have these names per RM0430 at least.
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2021-11-10 20:21:21 +00:00
Luna Gräfje
9fb39ed743 stm32l4: define CAN2 address and RCC bits 2021-11-03 16:04:29 +01:00
Tim Børresen
f5813a547a stm32f4: rcc: F411: support Full speed with usb.
F411 parts, found on "black pill" boards support 100MHz operation,
but only 96MHz with USB.  Provide default clock structures for this
common max speed.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2021-09-27 10:42:24 +00:00
Bastian de Byl
6763681c26 STM32: Fixed ltdc_setup_windowing helper 2021-08-14 21:44:10 +00:00
Karl Palsson
2483e2e358 stm32f1:gpio: docs: clarify more AF remaps 2021-07-17 23:06:09 +00:00
Mikael Lövqvist
eb52a1a1fb stm32f1: gpio: Fixed misleading comments on AFIO remaps
Added some explantory text to some of the remap options.
2021-07-17 23:05:22 +00:00
Stephen Holdaway
3ab83bc078 stm32g0: Support DAC
Nothing extra needed to be defined here - this might've just been missed
when adding STM32G0 support. Tested and works well on an STM32G051. Registers
in `stm32/common/dac_common_v1.h` match the STM32G0x1 reference manual.
2021-07-01 22:05:41 +00:00
Eduard Drusa
e9c68ff9e8 Fix STM32H7 FDCAN FIFO acknowledgment process
Fix FDCAN FIFO acknowledge register definition to make it correct for H7
MCUs. Previous definition contained hardcoded offset instead of using
MCU-specific macro.

Fix incorrect decoding of buffer element size. During decoding, value
returned was erratically set to 7 instead of setting 4th LSB. Buffer
element size was then always reported as 15 bytes.
2021-07-01 22:02:44 +00:00
Eduard Drusa
1033131eb7 Fix #1328: Make error return codes negative values
Fix the bug where certain functions were returning meaningful return
and/or error code, where positive values of error codes were interfering
with meaningful return value. Error codes now have negative values as it
was originally intended but never implemented.
2021-07-01 21:45:52 +00:00