Commit Graph

1530 Commits

Author SHA1 Message Date
Kevin Stefanik 245761f894 pac55xx: implemented CAN module interface for qorvo pac55xx. 2020-11-28 22:13:25 +00:00
Karl Palsson cb83273416 stm32: dcmi: drop redundant @ingroups
@ingroup is only needed if you want to assign a doxygen group to
something other than the naturally containing outer group.
2020-11-28 22:13:25 +00:00
Karl Palsson daf99b9b76 stm32: dcmi: hook up doxygen again
We still need stub .c files as we're using shared common files, so .d
tracking doesn't work.  It lets us setup basic introductory text anyway,
and there will be .c files eventually, so acceptable.
2020-11-28 22:13:25 +00:00
Nikolai Smolyaninov 071d4680ec stm32f4/7: DCMI: extract common registers
And enable for the f7

Originally filed as: https://github.com/libopencm3/libopencm3/pull/1208
Rviewed-by: Karl Palsson <karlp@tweak.net.au>
2020-11-28 22:13:25 +00:00
Graham Keeth d4d4c798a6 add usb audio, cdc, and midi stub files for doxy
- add stub files to relevant makefiles
- include <stdint.h> in respective headers to fix compilation
2020-11-28 22:13:25 +00:00
Ben Brewer 05f07c1051 stm32f3: Add support for OPAMP 2020-11-28 22:13:25 +00:00
Fabio Pugliese Ornellas 2a4cf034c7 usb: dwc_otg: Add OTG_DSTS_SUSPSTS
Originally filed as: https://github.com/libopencm3/libopencm3/pull/1224

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2020-11-28 22:13:25 +00:00
Matt Walker 1c54d58c81 STM32H7: Support the RNG Peripheral
The random number generator on the STM32H7 is identical to the v1 RNG
already present in the library. So use that, and make sure that the RCC
knows about the peripheral.

Originally filed at: https://github.com/libopencm3/libopencm3/pull/1244

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
 * whitespace changes from review
2020-11-28 22:13:25 +00:00
tute-avalos b47d769369 stm32: uart: Add Trasmission Complete enable/disable interrupt functions 2020-11-28 22:13:25 +00:00
Matthew Lai c49b4d35c2 stm32f7: added USB OTG FS/HS
Originally tracked at https://github.com/libopencm3/libopencm3/pull/958
While it doesn't work for everyone, this is clearly the basic first
steps required for any progress to be made.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2020-11-28 22:13:25 +00:00
BOJIT 5d393b17a3 ethernet: stm32: PTP naming fixes.
Verify all hardware differences between F1 and F4/F7 Ethernet hardware.
Flags registers missing on F1 as well.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2020-11-28 22:13:25 +00:00
Karl Palsson 4eee1e9bde stm32f1: rcc: mark old style static routines deprecated 2020-11-28 22:13:25 +00:00
Karl Palsson 5f051241a8 stm32f1: rcc: provide struct based clock helpers
As on every other family.

Fixes: https://github.com/libopencm3/libopencm3/issues/1172
2020-11-28 22:13:25 +00:00
Karl Palsson a7902aa4d0 stm32l1: rcc/lcd: fix RTCSEL HSE definition
Wrong since original commit in 2013.

LCD code can't actually automatically determine clock speed if it's HSE,
as we don't know here whether what HSE is, nor what it's divided by.
For more fun, that old 2014 API doesn't have any way of flagging that it
failed either.  Hooray.
2020-11-28 22:13:25 +00:00
Devan Lai c13c2b3b3c usb: Allow registration of a single non-contiguous string descriptor for WinUSB
Classic WinUSB support is detected by probing for a string descriptor
at index 0xEE with a special string.
usbd_register_extra_string() allows registration of a string at this
index without having to provide 237 other string descriptors

Originally filed as https://github.com/libopencm3/libopencm3/pull/849

WCID reference: https://github.com/pbatard/libwdi/wiki/WCID-Devices
2020-11-28 22:13:25 +00:00
Manuel Bl ffe8ddfca2 stm32l4: Use USB_OTG_FS_BASE instead of OTG_FS_BASE
Use the standard definition name, so that all standard shared code for
this peripheral works.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2020-11-28 22:13:25 +00:00
Manuel Bl e9c94760e6 stm32l4: enable USB OTG driver 2020-11-28 22:13:25 +00:00
Karl Palsson c7d7a18dd7 stm32: rcc: Standardize prescaler define names
We did have
* _HPRE_SYSCLK_DIVN (3 parts)
* _HPRE_DIVN (5 parts)
* _HPRE_DIV_N (4 parts)

Unify all on _HPRE_DIVN.  Provide deprecated definitions to not break
everything at once.

Also, standardize on "NODIV" instead of DIVNONE.
2020-11-28 22:13:25 +00:00
Karl Palsson 43b3fa5ddc stm32l0/l1: flash: support half page flashing
Tested on L1 and L0 using the "dapboot" project, see
https://github.com/devanlai/dapboot/pull/27 for L1
and
https://github.com/devanlai/dapboot/pull/30 for L0
2020-11-28 22:13:25 +00:00
Karl Palsson 636918732d stm32: i2c: drop useless integer defines I2C_CR2_FREQ_
These defines were simply a word containing the number, instead of the
number itself.  This provides no value, and implies that there's a
limited set of values.  The list was _already_ incomplete, so
misleading, _and_ just noise to maintain.  Burn it all.

(well, burn it just a little bit, provide deprecated aliases on the old
values so that code keeps compiling)
2020-11-28 22:13:25 +00:00
Michael Drake 90753950bb stm32f3: Enable support for GPIO ports G and H 2020-04-30 08:29:08 +01:00
Michael Drake 07bd38b814 stm32f3: Add GPIO ports G and H to memory map 2020-04-30 08:29:06 +01:00
Chuck McManis 2ce5cc58ce STM32F4: Add FMPI2C1 Peripheral to the memory map 2020-04-15 12:07:48 +00:00
Chuck McManis 3ee9710f35 STM32F4: I2C Noise Filter Register 2020-04-15 12:07:45 +00:00
Guillaume Revaillot 9bf6ce8b64 stm32g0: flash: add erase/program stuff
probably can be refactored with other chips, did not really looked yet.
2020-04-09 23:37:38 +00:00
Guillaume Revaillot dc98e2e6d9 stm32g0: flash: fix flash keys. 2020-04-09 23:37:38 +00:00
Guillaume Revaillot 7cb7d51273 stm32g0: flash: update registers documentation 2020-04-09 23:37:38 +00:00
Guillaume Revaillot d696e2c264 stm32g0: add device electronic signature offsets and build desig. 2020-04-09 23:37:38 +00:00
Guillaume Revaillot 2d9c01867f stm32g0: update sysconfig based on latest stm32g0x1 RM
add pin clamping diode control, available on g041 and g031
2020-04-09 23:37:38 +00:00
Karl Palsson 4e70d06d63 stm32g4: Add basic support
* memorymap
* vectors
* rcc
* gpios
* makefiles
* devices for linker script generation
* doc structure
2020-04-09 23:29:00 +00:00
Karl Palsson 57373b3413 stm32l4: rcc: fix bit error in BDCR
And add the new bit from later ref manuals
2020-04-09 22:04:49 +00:00
Kevin Stefanik 89e90e0e5d pac55xx: gpio: fix gpio_set_af for pin alternate function settings.
register bits were not cleared before setting. refactored to be similar
to how the drive strength register is being set.
2020-04-09 14:17:27 +00:00
Guillaume Revaillot abc74fd78b stm32g0: fix typos in rcc.h 2020-04-08 07:50:14 +02:00
Florian Larysch f4ec5b9f9b stm32g0: fix RCC enums for UCPD peripherals
The order of the UCPD1 and UCPD2 bits as described by the
rcc_periph_clken and rcc_periph_rst enums is swapped with regard to the
datasheet. Swap them.
2020-04-07 21:37:22 +02:00
Brian Viele b1d8a4c546 stm32h7: added minimal stm32h7 exti defs, which share with G0.
Separated definitions that did not seem consistent between the "v2" EXTI
platforms. Added SYSCFG defs needed for EXTICR settings.
2020-03-23 09:23:21 -04:00
Brian Viele 89074d6a13 stm32h7: fix inverted VOS settings for Vcore. 2020-03-10 10:16:26 +00:00
Karl Palsson 4a11e354a3 stm32l1: desig: use new mechanism to support different densities
Fixes: https://github.com/libopencm3/libopencm3/issues/234

uses the new mechanisms introduced to address a similar problem on F7.

Tested on a medium density part (0x429) that returns the same ids as
before, tested on a high density part that now _doesnt_, but that's now
correct :)
2020-03-06 22:53:03 +00:00
Karl Palsson 78c23ba5a0 doc: stm32f4: fix broken groupings
Now all the register value sets are in the generated output
2020-03-06 01:14:44 +00:00
Karl Palsson b146fd6aa7 doc: stm32: flash: tidy up doxygen warnings and broken groupings 2020-03-06 01:14:17 +00:00
Karl Palsson dca79bfd7a doc: stm32l1: lcd: fix groupings and convert to doxygen 2020-03-06 01:11:45 +00:00
Karl Palsson 341bd84cb9 doc: stm32h7: cleanup warnings and groupings
Move shifts and masks outside groups to clarify docs from a user point
of view. fix missing or broken groupings
2020-03-06 01:10:20 +00:00
Brian Viele 4953d67aaa stm32h7: per comments, improved consistency with other rcc impls.
Reduced the sea of enums, and renamed config parameters to match other
implementations, cribbing off of the G0 config, as it is closer to the level
of complexity. Updated initialization code to utilize the new values.

Added flash and LDO configuration from RCC init to be more consistent with
STM32 platform initialization.
2020-03-05 22:07:10 +00:00
Karl Palsson 5f8cbb95e6 stm32: ltdc: clarify warning on faulty include
No code change.
2020-03-05 21:59:29 +00:00
François Finfe fb0cac49cb stm32: adc-v2: add adc_{en,dis}able_delayed_conversion_mode
To control AUTODELAY feature of the ADC.
2020-03-04 23:29:31 +00:00
Brian Viele 2ca56f4c21 stm32h7: updates to PWR and RCC to support PLL configuration.
PLL configuration on the H7 is pretty involved, and takes a number of
configurations to make it work. In order to make peripheral drivers a bit
easier to implement, working with a soft clock tree in the rcc module which
stores the clock settings for each clock as they are setup such that users
can request the clock value from the RCC module for configuration. Added
getter for the clock which allows the user to pass the base address of the
peripheral, and get the peripheral clock value for convenience.

Clock configuration is still missing values for setting up all of the kernel
clocks for the peripherals, but this is in work, and there is a framework to
do so.

Have tested to 400MHz without issue. Peripherals that are explicitly supported
are working and the clock tree values appear to follow correctly.

Added LDO settings to allow setting the scaling to support high frequencies.
2020-03-04 23:17:02 +00:00
Matthew Lai 97688b913e stm32: desig: refactor to allow targets to have different addresses
In this commit, support for the different base addresses for different
F7 parts is added, but the mechanism is now in place for L1 and others.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
(whitespace fixed, commit msg reworded)
2020-03-04 22:16:31 +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
Brian Viele cb0661f81d stm32h7: fmc: added bit defs for async configuration. 2020-02-16 13:52:04 +00:00
Karl Palsson 7da29d3d5f stm32: desig: doc: merge duplicate documentation sections
Use the best one.
2020-01-28 23:03:39 +00:00
Karl Palsson 8c37e5cea0 stm32: crc: merge duplicate documentation
Avoids warnings from doxygen.  Leaves it purely in the headers so it's
accessible in code completion as well.
2020-01-28 22:41:14 +00:00
Karl Palsson 26d6f8f77e swm050: timer: use more standard bit definitions
We normally use periph_reg_field naming, and most of this file was
already consistent. Switch the stragglers.
2020-01-28 22:31:38 +00:00
Karl Palsson a6aecf8ccd swm050: simplify doxygen
We don't need groupings around each enum, they format nicely into a
section already.  Likewise, the doxygen _is_ documentation, so we don't
need extra versions of it in places. Also fix a few warnings generated.
2020-01-28 22:31:24 +00:00
Caleb Szalacinski f06a1ca958 SWM050: Adds the timer peripheral and updates the README. 2020-01-28 20:58:50 +00:00
Fabio Pugliese Ornellas 7daa6f15bf usb: define USB_CLASS_DFU 2020-01-12 20:31:26 +00:00
Guillaume Revaillot 64baacfbbf rng: add irq enable/disable helper. 2020-01-05 00:24:43 +00: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
Jacob Walser 854da9635e stm32f0: adjust wwdg threshold signatures to support 12 bit resolution 2020-01-05 00:08:48 +00:00
Jacob Walser 5409ce73bd adc_common_v2: bugfix ADC_xT1_VAL(x)
mask out bits that must not be written
2020-01-05 00:08:48 +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
Guillaume Revaillot 9d15ac7ae7 cortex: FAULTMASK does not exist on armv6m. 2020-01-04 21:53:34 +00:00
Guillaume Revaillot db6237cd1e stm32: extract g0 exti stuff to exti_common_v2.
stm32l5 basically uses the same stuff.
2020-01-01 19:47:13 +01:00
Karl Palsson df15b263d2 usb: hid: add a stub file for doxygen
Unlike with the doxygen source generation, we can't autoguess which of
the class files are eligible automatically.  Instead, make a stub hid
file, (which we can now start adding to, if desired) and include it in
all builds that include other class stubs.
2019-12-25 21:04:17 +00:00
Fabio Pugliese Ornellas f2f5083761 usb: Add more HID Class constants 2019-12-25 20:44:46 +00:00
Karl Palsson aabd4da3c0 stm32g0: syscfg: doc: fix missing grouping 2019-12-25 20:43:02 +00:00
Guillaume Revaillot 87dbf40cde stm32g0: rcc: group rcc_registers and registers values 2019-12-25 20:34:11 +00:00
Guillaume Revaillot 48afe3ca67 stm32g0: flash: fix wrong comment. 2019-12-25 20:34:11 +00:00
Guillaume Revaillot ebd265ce42 stm32g0: rng: typo in header. 2019-12-25 20:34:11 +00:00
Guillaume Revaillot 070058f80c stm32: adc: doc fix
declare chselr group in v2 single header, where adc_chselr reg is declared
2019-12-25 20:34:11 +00:00
Guillaume Revaillot e7c8f18f7c stm32: adc: group adc_registers 2019-12-25 20:34:11 +00:00
Karl Palsson 86b4cf6787 stm32h7: fix typo in doxygen description 2019-12-25 20:30:17 +00:00
Brian Viele aabefeac92 stm32h7: usart: support new fifo features
Supported by H7 and G4 varieties at present.
2019-12-25 20:29:24 +00:00
Karl Palsson fa3c1df6f5 pac55xx: fix up and simplify some doxygen 2019-12-25 13:44:49 +00:00
Brian Viele a3406f100b pac55xx: gpio: Initial Implementation of PAC55xx GPIO Driver
* Conforms mostly to the STM32 GPIO API where possible.
* Supports pin configuration (direction, pull-up/down, etc.) as well
  as pinmux configuration.
* Supports set/clear/get operations to the GPIO port/pins.
* Created base doxy header and groups to align with existing formatting.
2019-12-25 13:44:35 +00:00
Mathias Nord 9af9a1dbfa stm32g0: use spi v2 2019-12-03 14:45:47 +01:00
Karl Palsson af384dbc7c doc: fix some broken groups uncovered while reviewing h7 code 2019-11-28 22:16:54 +00:00
Karl Palsson af8a1773b7 stm32h7: doc: fix some missing group definitions 2019-11-28 22:16:34 +00:00
Brian Viele 53302439df stm32h7: Initial introduction into libopencm3.
Updates to a base set of includes to map to the h7 include files which are
mainly based on the f7 versions for simple devices (e.g. SPI, USART, GPIO).

Custom files that have been implemented from the datasheet/ref manual include
the memory map, RCC, PWR definitions, and irq.json file for generation of
nvic files for interrupt mapping.

Additional functionality, especially PLL and tweaks for non-F7 compatible
implementations coming in future commits.

Added documentation tree configuration.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
Changed dmaX_streamX to dmaX_strX in a few places for consistency
2019-11-28 22:15:24 +00:00
Karl Palsson da0c6a6724 swm050: wdt: doxygen polish 2019-11-28 11:43:01 +00:00
Caleb Szalacinski 47b59e2df4 swm050: Adds WDT peripheral
Reviewed-by: Karl Palsson <karlp@tweak.net.au> (Fixed an &| in
wdt_set_time)
2019-11-28 11:42:31 +00:00
Brian Viele dd18b9fdbc Qorvo pac55xx: initial support
Qorvo (Nee Active Semi) PAC55xx "Intelligent Motor Control" parts,
cortex-m4 SoCs
2019-11-26 23:28:02 +00:00
Guillaume Revaillot bcfdcc09ac stm32g0: add syscfg header. 2019-11-25 20:49:20 +00:00
larchuto 0a68b012a1 stm32l4: Fix typo impacting uart4 and uart5 2019-11-21 18:59:32 +01:00
Guillaume Revaillot 38b45c8786 stm32g0: add adc.
v2 "single" peripheral with a couple of tweaks :
 - added registers to configure two additionnal advanced analog watchdog.
 - different adc sampling time time based on channel groups.
 - 8 steps adc sequence injection, using chselr/chselrmode.

And a note on the rm explaining that after every configuration change to ADC_CFGR1's
SCANDIR or CHSELRMOD or CHSELR register, user need to check that configuration
is applied before any other modification / adc conversion start.. making adc_set_reqular
a bit painfull to read..
2019-11-08 14:19:17 +00:00
Guillaume Revaillot a34da53c30 stm32g0: add dmamux
DMAMUX peripheral is a dma request router/trigger, present on g0, wb, h7 and l4+.

Basically it allows to easily map peripheral requests to whatever dma channel we
want to use (similarily to the DMA_CSELR register, but without limitation) but,
it also also adds some clever dma request synchronization and even some dma request
generation logic via internal request generator "channels", allowing some requests
chaining, or triggering reqs from non dma capable peripherals.

nb: g0 only features 1 dmamux bloc, supports 7 irq and 4 generators, l4+ supports 13
dma channels and 3 generators and h7 has two dmamuxes, with support for the 15 dma
channels and 7 generators - so as much CxCR and RGxCR register - but they are bit
to bit compatible - excluding of course the sync/sig and dma requests id mappings.
btw, currently, request generator channels are defined in common header, but maybe
we should define them in device header ? or we dont care (like for dma channels,
only defined in dma_f24 but not for other devices ?).

See ST AN5224 for more information
2019-11-08 13:47:41 +01:00
Guillaume Revaillot b9f183bf1e stm32g0: add dma.
same same, bit for bit, except not ;) - Channel request mapping now
depends on a new DMAMUX peripheral, and there's no default preset.
So, before enabling dma channel after its configuration, request
must be configured by :

dmamux_set_dma_channel_request(DMAMUX1, DMA_CHANNELx, request_number_from_datasheet);
2019-11-08 13:47:41 +01:00
Karl Palsson 7a27397b9e stm32: rtcv2: don't shift the "month tens" bit
None of the other masks are shifted, don't shift this field either.

Fixes: https://github.com/libopencm3/libopencm3/issues/1123
2019-11-06 19:45:20 +00:00
Karl Palsson 2b54119b78 cm3: scs: drop all duplicate information
Keeps the best version of the documentation.

Fixes: https://github.com/libopencm3/libopencm3/pull/269
2019-10-18 22:38:16 +00:00
Karl Palsson 833da4b672 cm3: extract SCB SHPR to the SCB world it belongs to
Pull out the duplicate into the right file, keeping the newly fixed
version.
2019-10-18 22:33:23 +00:00
Karl Palsson 3ebd71b464 cm3: extract Coresight LSR/LAR definitions
Use a single point of definition for the offset, and add it where it was
missing.
2019-10-18 22:29:13 +00:00
Matt Anderson d8579dde95 CortexM0: IPR and SHPR are only word addressable
For ARMv6M, the IPR and SHPR registers are accessible only when
adddressed with a 32bit word read or write.

Currently in libopencm3 all NVIC interrupt priority register accesses
are made using an 8bit read or write, which results in the hardware
ignoring the write or always returning 0 on read.

Address this by introducing NVIC_IPR32() and SCS_SHPR32() macro and
conditional implementation of nvic_set_priority when building for
cortex-m0.

See ARMv6M developer documentation:
IPR: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/Cihgjeed.html
SHPR: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CIAGECDD.html
2019-10-17 21:26:13 +00:00
Caleb Szalacinski 3c4ee6f4c0 SWM050: Finishes GPIO, IAP flash, sysclock, sleep/stop, and the sysctl memory map.
Updates the main memory map and the makefile.
Adds the SWM050 to devices.data, so that a linker script can be automatically generated.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2019-10-17 11:41:33 +00:00
Bryan PEREIRA 1fbfdecb17 stm32f3: Add SPI4 BASE 2019-10-16 14:41:00 +00:00
Nicholas Rossomando 77d96a3430 stm32l0: crc: enable common code 2019-10-12 14:11:39 +00:00
Jonathan Halmen ec2d96433f stm32f4: rcc: add plli2s config function 2019-09-27 13:55:56 +00:00
Jonathan Halmen 203d0ca295 stm32f4: rcc: remove unnecessary pllsai functions
existing standard functions for these are
 * rcc_osc_on(RCC_PLLSAI);
 * rcc_is_osc_ready(RCC_PLLSAI);
2019-09-27 13:43:06 +00:00
Guillaume Revaillot 8a1cfa8ceb stm32g0: use proper register for gpio peripheral clock sleep enable.
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2019-08-28 20:54:35 +00:00
Guillaume Revaillot 998e647dde stm32g0: memorymap: get rid of apb1/apb2 reference, device only has one apb.
I apparently based memorymap.h on previously written header without noticing
that g0 has only one apb despite a big hole in the memory space and addresses
matching usual apb1/apb2 split..
2019-08-28 12:03:55 +02:00
Guillaume Revaillot 1928e6eb3c doc: typo 2019-08-28 01:41:14 +00:00
Guillaume Revaillot 562dca7358 stm32f4: doc: f4 are cortex m4f based 2019-08-28 01:41:14 +00:00