Commit Graph

141 Commits

Author SHA1 Message Date
Karl Palsson b146fd6aa7 doc: stm32: flash: tidy up doxygen warnings and broken groupings 2020-03-06 01:14:17 +00:00
Karl Palsson f1b4a4dfff stm32f3: adc: consistently use unshifted
and tweak teh docs a little
2020-03-04 22:02:45 +00:00
François Finfe 49285ed8e1 stm32f3: fix missing reg mask for adc_set_multi_mode
Missing defines for ADC_CCR DUAL values have also been added.
2020-02-19 00:13:00 +01:00
Jacob Walser e2ac1a6358 stm32f3: bugfix + adjust wwdg threshold signatures to support 12 bit resolution
- these registers are 12 bits wide
- bugfix clearing thresholds so that both upper and lower thresholds can be
  configured on the **window** watchdog
2020-01-05 00:10:12 +00:00
Karl Palsson 18f4d7c1b7 stm32f3: rtc: include correct shared header
rtc_common_all never existed, and f3 has the same "v2" peripheral used
by ~all parts other than the f1.  We don't have any f3 rtc test code,
but the existing code was clearly wrong, and this is at least including
the correct basic defines.

Fixes: https://github.com/libopencm3/libopencm3/issues/1106
2020-01-04 23:13:08 +00:00
Bryan PEREIRA 1fbfdecb17 stm32f3: Add SPI4 BASE 2019-10-16 14:41:00 +00:00
Karl Palsson 1964fd72f2 doc: stm32f3: adc: register base addresses had landed outside a group 2019-06-25 21:15:35 +00:00
Karl Palsson 867bd164eb doc:stm32: usart: fix grouping and heirarchy of base addrs
They were always landing on the top level, or not even present.
2019-06-12 23:06:22 +00:00
Karl Palsson 64893177ed doc: stm32f3: rcc: add groupings for periph resets 2019-06-12 22:56:38 +00:00
Karl Palsson ce5d1ca9a2 doc: restore targets as pages.
You can't have two mainpage items, and the second was just being
ignored.  This restores them, which makes the left side list longer,
which we may or may not like, but it's at least how it was documented to
be.
2019-06-10 11:10:34 +00:00
Guillaume Revaillot ff9664389b stm32: exti: move register definition of all current stm32 devices to common_v1
Preparation for stm32g0 support, as this chip's exti register map evolved and is
no longer common ...
2019-01-18 18:33:55 +01:00
Karl Palsson 0e58ee2f65 stm32: support i2c3 properly
I2C3 is on many parts, but wasn't properly supported with the register
definitions.  Declare them centrally, just depending on the memorymap
defining them. On some parts, the rcc bits were defined, but not the
base registers.

Fixes: https://github.com/libopencm3/libopencm3/issues/820
2018-08-17 00:15:01 +00:00
Karl Palsson b8ede60d9d stm32f3: flash: support basic write/erase operations
Originally filed as https://github.com/libopencm3/libopencm3/pull/627
2018-08-17 00:15:01 +00:00
Karl Palsson 3293913be2 stm32f3: flash: add clear write protect flag
Could actually move to flash_common_f, but they have different names for
the same bit at present.
2018-08-17 00:15:01 +00:00
Karl Palsson 49a8c041ff stm32f3: comparator: fix doxygen and use standard mask/shifts
Convert to standard style of unshifted field values.
2018-08-17 00:15:01 +00:00
Markus Kasten 0d0f59d8ce stm32f3: add comparator register definitions 2018-08-17 00:15:01 +00:00
Karl Palsson 76d392ee47 stm32: flash: drop common_f234
Move the last few register defines back to their relevant headers, add
doxygen and groups.  While these registers _were_ "common" they were the
_only_ common things, so it's simpler for future work (merging f7 with
f2/4) to move them back separately.
2018-07-29 20:31:17 +00:00
Karl Palsson a949b223c3 stm32f3: flash: pgerr is not the same as pgperr
F3's flash interface is actually quite different, don't try and force
sharing code that isn't really related.  The "PGERR" is a very different
bit than the parallelism error that f2/4/7 have.
2018-07-29 20:31:17 +00:00
Karl Palsson 850931dbcd stm32: flash_unlock_option_bytes is common code.
The keys differ between some familes, but the documentation and
implementation are standard.
2018-07-29 20:31:17 +00:00
Karl Palsson 4840b6bc7e stm32: flash: pull up clear_eop
All the "f" type flash parts have an EOP flag, even if it's in different
bit positions.  Add a header for this common functionality, and move
it's implementation to the existing common file.
2018-07-29 20:31:17 +00:00
Karl Palsson b23dccc7ae stm32: flash: pull up prefetch to _all
Turns out, there's lots of common code for flash.  Pull up prefetch
on/off to start with, as there's only a single bit name different.

Pull up the definitions of common API functions too, starting with
flash_set_ws.  Even if the implementations are different, things that
meant to be the same, should be defined centrally.
2018-07-29 20:31:17 +00:00
Karl Palsson 33ef6fd816 stm32f3: rcc: fix extern name for hsi structs
Fixes: ab9e425272
2018-07-29 20:31:17 +00:00
Karl Palsson ab9e425272 stm32f3: rcc: add hse preconfigurations
Just a single 8Mhz in, 72mhz (max) out, which suits the f3 discovery
boards for instance.
2018-07-03 22:23:00 +00:00
Karl Palsson ee8b5bf4ac stm32f3: rcc: drop useless 44MHz clock structure.
This clock speed is not USB compatible, it's not the maximum for
anything, nor the minimum, it's just a distraction.  Drop it.
2018-07-03 22:23:00 +00:00
Karl Palsson b47b967440 doc: use common naming for peripheral apis
Only applied to STM32 doc trees at present.

Instead of declaring a group for "STM32blah" in the doc-blah.h files,
and then trying to put all the common+specific peripheral code into
those groups, (which is what led to the stub doxygen holder empty .c
files)  Just use a standard name like "Peripheral APIS" and place
everything into that.

Demonstrated by converting ADC and USART peripherals, which is
definitely not complete, but it shows how to make things less magical,
and less prone to copy/paste errors.  Now, you can copy/paste and it
will do the right thing, because everyone uses the same group names.

This is also how to unify the mix of "STM32blah->Periphblah" and _also_
the dangling "periph_file" modules in doxygen, it merges them together
properly, as they're intended to be really.
2018-07-03 22:23:00 +00:00
Karl Palsson 2204f447bb BREAKING: stm32f3:rcc: add more generic pll setup routines
Deprecate the old routine and make a new one that actually handles HSI
and HSE properly, and includes the predivider and the usb divider
settings as well.
2018-05-01 22:23:44 +00:00
Karl Palsson 622475f543 BREAKING: stm32f3:rcc: use more common MUL names
Make the defines as they are on other families, try and make more
defines the same, not arbitrarily different.
2018-05-01 22:19:28 +00:00
Karl Palsson 389ec82538 stm32f3: flash: add prefetch helpers
Should be added to f2/f4 as well, but the bit definitions are different.
2018-05-01 22:19:28 +00:00
Guillaume Revaillot bf125e91f9 stm32: rework spi, based on PR #740 and #742.
split spi stuff in three part:
 - v1 : basic spi peripheral
 - v1_frf : v1 spi with frf mode additional bit in spi_cr2 / spi_sr
 - v2 : spi with variable datasize, fifo and other fancy stuff.

v1 maps to f1 chips
v1_frf to f2, f4 and l0,l1
v2 to f0, f3 and l4

This breaks spi_master_init API for v2 devices : function prototype from
common spi header used to be abused, with DFF bit reused for CRCL bit.
New v2 spi_master_init does not handle anymore CRCL bits, as it does not
usually mess with other crc configuration.
2018-04-28 21:12:27 +00:00
Guillaume Revaillot 207eb07d4c stm32: centralize additionnal iwdg window register definition into iwdg-v2.
stm32f0, l3, l4 are currently sharing the same duplicated header, and
stm32l0 uses the same peripheral. Stop copy-pasting stuff and centralize
definitions into a iwdg_common_v2.h header.
2018-03-28 13:06:57 +00:00
Guillaume Revaillot b79de32e9e stm32: iwdg: fix typo in (unused) register name 2018-03-27 18:35:23 +02:00
Cem Basoglu 34f57ae06e stm32: crc-v2: STM32F0/3 extended crc unit
Implementation of extended crc unit in f0 and f3
2018-02-13 23:57:21 +00:00
Karl Palsson 297d996fa0 stm32f3: pwr: drop duplicate definitions
These definitions were in the already included pwr_common_v1.h file.

And add extra WKUP bit definitions.
2017-12-07 10:33:09 +00:00
Karl Palsson a23d65e7dd stm32: usart-v2: pull up remaining f3/f0 defns
Final chunk of register definitions to be pulled up.

Now the "target" files are _only_ defining the list of u(s)arts
available, and any _specific_ functions for that target.
2017-10-25 23:03:48 +00:00
Karl Palsson b20d0ff1fb stm32: usart-v2: pull up CR2 register values from f0/f3
Just small pieces at a time to make it easy to see what's happening.
Taking definitions currently implemented in both f0/f3 headers and
making combined, documented versions in the -v2 header.
2017-10-25 22:57:18 +00:00
Karl Palsson 9d709e52b4 stm32: usart: move USARTX definitions to target/version specific
Instead of declaring that _every_ device has USART1,2,3 and UART4,5, let
the targets themselves define what periphs they do, along with their
USARTx_BASE defines, and let the common headers just have the common
abstractions.
2017-10-25 22:55:09 +00:00
Karl Palsson 0b84caa13e stm32: usart: Move f3 TDR/RDR definitions to -v2
Data registers are standard.
2017-10-25 22:55:02 +00:00
Karl Palsson 557e2a0b09 stm32: uart: add USART_FLAG_ defines
Similar to how we have abstract defines for the stop bits, parity and
flow control common mode namees, provide abstract flag names for the
"standard" flags.  This allows us to start using common API code for v1
and v2 uarts

For stm32f3, drop the "compatibility" defines that simply pollute the
namespace, making it confusingly appear as if f3 has both SR and ISR
registers.
2017-10-25 22:53:31 +00:00
Karl Palsson 2bc19d499c stm32:usart: Pull stop bit definitions up as common 2017-10-25 22:42:26 +00:00
Karl Palsson fb520ff3dc stm32:usart-v2: pull out registers and values
Only pulling out the _common_ stuff.  This is a single step in a long
process of eliminating all the duplication and "same, but different"
implementations that are stalling adding nice clean easy support for
l0/f7/l4.

This _ignores_ all currently conflict register definitions, even if they
"do the same thing" it just pulls up the common stuff.  A subsequent
commit can look at resolving the implementatations to a single version.
2017-10-25 21:19:23 +00:00
Florian Larysch 1bc8b4e719 stm32f3/rcc: add HRTIM RCC bits 2017-10-12 10:24:21 +00:00
Florian Larysch 5a80eb4bee stm32f3: add HRTIM definitions
Add definitions for the High Resolution Timer peripheral (currently only
present on the F334).
2017-10-12 10:24:15 +00:00
Karl Palsson 29c712326f stm32: rcc: extract osc_bypass functions
rcc_osc_bypass_enable and rcc_osc_bypass_disable have been copy/pasted
around for the last time!  There's a compile bit to check for L0/L1, but
otherwise this is just code duplication for no gain.
2017-06-08 23:01:45 +00:00
Karl Palsson 5af89ae596 stm32f3: can: use CAN1 compatibility naming
Makes it far easier to write portable code when CAN1 is always
available, not having to decide between CAN and CAN1.
2017-06-08 23:01:45 +00:00
Matthew Lai 383fafc862 stm32: renamed pwr_common_all to pwr_common_v1, and pwr_common_l01 to pwr_common_v2 2017-03-30 21:48:08 +00:00
Sergey Matyukevich ef91856ac1 stm32: unify i2c implementations
The f1, f2, f4, l1 chip families have a similar "v1" i2c peripheral on board.
More recent f0, f3, l0, l3 chip families share another "v2" version  of i2c.

This patch unifies headers and implementation for two types of i2c peripherals:

- rename: i2c_common_all.[ch] to i2c_common_v1.[ch]
- remove i2c_common_f24.h: extra I2C blocks are defined in specific headers
- use f3 i2c code as a basis for common "v2" i2c implementation
- add f0 i2c support: use "v2" i2c implementation

Tests:
- tested on a custom f0 board
- compile-tested both libopencm3 and libopencm3-examples for all stm32

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
2017-03-30 21:48:07 +00:00
Jonathan Challinger 7f8b32efed stm32f3: include CAN 2017-03-30 21:48:07 +00:00
Karl Palsson da91794f52 stm32: rcc: Rationalize MCO definitions
Some parts used HSICLK, some used HSI.  Most used NOCLK, f3 used
DISABLED.  Try and move all to the shorter, simpler forms, instead of
having mixed defines for different targets for the same thing.  Just
because the bits themselves are different doesn't mean we should make it
more difficult for users to port code.
2016-11-29 15:06:19 +00:00
Karl Palsson 41fa001620 doc: adc: fix syntax and missing groupings 2016-08-18 23:51:49 +00:00
Karl Palsson 4eb51ecaea stm32: rcc: rcc_wait_for_osc_ready is always available
Move the prototype to the common_all header and include documentation.
2016-08-18 23:41:04 +00:00