Commit Graph

1041 Commits

Author SHA1 Message Date
Karl Palsson 1379ab4777 stm32l4: enable common exti functionality
tested on l476 disco board.
2018-03-04 00:02:44 +00:00
Karl Palsson 8feb711ca0 stm32l0:rcc: add rcc_set_pll_source() as per L1
reported by: kaeipnos in https://github.com/libopencm3/libopencm3/pull/609
2018-03-02 22:42:05 +00:00
Karl Palsson 54b117c5a5 usb: Use enumerated return codes
The enum usbd_request_return_codes has been available for some time.  It
should be used internally, not just by users of this code.
2018-03-02 22:42:05 +00:00
Sebastian Holzapfel 64a6f362b8 usb-msc: fix write acknowledgement bug
Fixes https://github.com/libopencm3/libopencm3/issues/409
2018-03-02 22:42:05 +00:00
Sebastian Holzapfel f871e539ed usb-standard: fix alignment assumption for Cortex-M0 platforms 2018-03-02 22:42:05 +00:00
Sebastian Holzapfel 36a45c387d efm32hg: add linker script for efm32hg309f64 2018-03-02 22:42:05 +00:00
Sebastian Holzapfel 995d19ebfd efm32hg: usb: add usb support 2018-03-02 22:42:05 +00:00
Sebastian Holzapfel a0669421e1 usb-dwc: handle any-aligned buffers
This is required to support armv6m targets using this code.
2018-03-02 22:42:05 +00:00
Sebastian Holzapfel a2ee90fbfe usb: stm32fx07 -> usb_dwc_common
The stm32fx07 is common DesignWare IP, used in both STM32 and EFM32 chips.
Rename the files to make this more clear, and easier to use in other
targets.
2018-03-02 22:42:05 +00:00
Sebastian Holzapfel 3c855e75d1 efm32hg: cmu: add updated cmu implementation based on efm32lg 2018-03-02 22:42:05 +00:00
Sebastian Holzapfel 18f64812eb efm32hg/lg: timer: use common timer implementation 2018-03-02 22:42:04 +00:00
Sebastian Holzapfel c6296a4d88 efm32hg/lg: gpio: use common gpio implementation 2018-03-02 22:42:04 +00:00
Sebastian Holzapfel a86948ec6e efm32hg: add basic makefile, interrupts, device information 2018-03-02 22:42:04 +00:00
Joel Holdsworth 8cd36ae9f9 stm32f0: Removed duplicate uart_{enable,disable}_{rx,tx}_dma functions
These are now defined in lib/stm32/common/usart_common_all.c
2018-02-13 23:57:43 +00:00
Bruno Randolf 2e10acc0d4 stm32:l4: rcc: Use PLLM as factor, not register value
PLLM in the register is the "M" factor minus one and the macro is
already defined
2018-02-13 23:57:43 +00:00
Bruno Randolf b438edf45d stm32:l4: Add SPI
Same as F3, tested
2018-02-13 23:57:43 +00:00
Bruno Randolf 075ef82a4b stm32:l4: Enable USB FS support
Reviewed against RM0394 and tested with STM32L433CC.
Aparently some other L4 have USB OTG.
2018-02-13 23:57:42 +00:00
Bruno Randolf de39ab1584 stm32:l4: Add CRS
Reviewed against RM0394, untested
2018-02-13 23:57:42 +00:00
Bruno Randolf f2c629c4ff stm32:l4: rcc: Add support for HSI48 clock 2018-02-13 23:57:42 +00:00
Bruno Randolf 0cd92c31d6 stm32:l4: Add RTC
Use common, some additional registers missing
2018-02-13 23:57:42 +00:00
Bruno Randolf c90c9fe801 stm32:l4: Add IWDG
Same as F3, reviewed against RM0394, tested
2018-02-13 23:57:42 +00:00
Karl Palsson 55ea31fd04 stm32l4: crc-v2: enable common code
Possible now that the v2 unification code has landed.
2018-02-13 23:57:42 +00:00
Bruno Randolf 7b6710a914 stm32:l4: Add DMA
Same as L1 according to L1-L4 migration guide, untested
2018-02-13 23:57:42 +00:00
Karl Palsson 316c33a6a3 stm32: crc-v2: tweak doxygen output
Make it group better and include labels
2018-02-13 23:57:42 +00:00
Gregory Schlomoff 329b611e4f stm32: ethernet, flash: tagging some function arguments as const 2018-02-13 23:57:42 +00:00
Grigory Revzin 9ef5860863 stm32: can: removed canport argument from can_filter functions 2018-02-13 23:57:42 +00: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 533e71777b stm32f3: crc: drop unused empty file
Makefile doesn't even refer to it, and it's empty anyway.  Not required
for doxygen purposes, (anymore?) so just drop it.  File had _never_ been
included in the f3 makefile.
2018-02-13 23:57:21 +00:00
Karl Palsson 0a6b5653b5 doc: stm32: rcc all: fix typo in doxygen 2018-02-13 23:05:21 +00:00
Karl Palsson 01320881e7 stm32: adc-v2: don't attempt to wait for start.
The ADC v2 peripheral doesn't have the same behaviour of starting, where
the hardware clears the bit immediately, on v2, it is not cleared until
the ADC is stopped, or the end of sequence flag is set.

Fixes https://github.com/libopencm3/libopencm3/issues/557
2018-01-25 12:34:03 +00:00
Karl Palsson ed90df85f0 stm32:i2c-v2: Clarify digital filter setting
Drop redundant field definitions, fix truncation of argument bug and add
documentation.

Fixes: https://github.com/libopencm3/libopencm3/issues/831
2018-01-08 11:16:24 +00:00
Paul Fertser 965d28ecbe stm32: ethernet: clarify DMA descriptors buffer requirements 2018-01-08 11:14:07 +00:00
Karl Palsson c4cf904ef6 spi: drop misleading explicit baudrate comments
The SPI br parameter has always been the 3 bit fpclk divider field, and
was never a target or explicit bit rate.  Correct the comments, and drop
the duplicate commentary that wasn't included in the doxygen output
anyway.

Fixes: a7a3770d Add initial SPI code
2018-01-04 09:59:18 +00:00
Yonghua Zheng 580a2a4a63 stm32f7: usart: enable usart peripheral
Add usart-v2 to stm32f7 to provide usart support in f7 series.
2017-12-07 10:59:32 +00:00
Baker Ngan 41e14b71b7 stm32: pwr-v1: fix voltage detection logic
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2017-12-07 10:33:06 +00:00
Baker Ngan e1914eba74 stm32f3:include power ctrl module object files 2017-12-07 10:25:04 +00:00
Karl Palsson f67966046a stm32:l4: enable usart peripheral
Tests in https://github.com/karlp/libopencm3-tests/tree/master/tests/uart-basic
2017-10-25 23:54:32 +00:00
Karl Palsson c119ee7f9a stm32:l0: enable usart peripheral
Now that the usart-v2 peripheral is extracted cleanly, adding it for l0
is very simple.
2017-10-25 23:26:52 +00:00
Karl Palsson 670a7cd83e stm32f0: use usart-v2 instead of private usart
Use the usart-common base plus the usart-v2 code, instead of private
implementations.  Less code, more common apis across targets.

Of note is the trick to make F0 look like it has an APB2 bus.  It's the
only stm32 that doesn't have a documented APB2 bus, but still has
peripherals enabled via an "APB2" register, and they match how other
targets have an APB2.  Simply make APB2 an alias of APB1, as it's only
used for clock speed detection.
2017-10-25 22:55:10 +00:00
Karl Palsson 5dd0b46298 stm32: usart_common_all: fix bug in baudrate calculation
This function was using apb1 for quite a few families instead of apb2.
This only mattered for L1 and F3, and for USART1/USART6, and only if
apb1 speed != apb2 speed.

Instead of using families explicitly, just check for the peripherals
themselves.  On F0,F1,F2,F3,F4,F7,H7,L0,L1,L4, usart1/6 are _always_ in
the rcc_apb2 register and the other uarts are all on apb1.
(F0 doesn't actually _have_ apb2, but it's still called the apb2
register)
2017-10-25 22:55:09 +00:00
Karl Palsson 874af2e846 stm32: usart: pull f3 code up to common v2
This is currently duplicated across f0 and f3 code.  Pull up to the
common -v2 code, so it can be used by both, as well as L0/L4/F7
2017-10-25 22:55:09 +00:00
Karl Palsson 38125e9941 vector: fix externs
Improper/lazy build testing.

Fixes: c6743f9 vector: make common linker definitions available to users
2017-10-18 20:51:33 +00:00
Vegard Storheil Eriksen ef07b970f3 stm32: timer: Remove TIMER_IS_ADVANCED() checks
The ADVANCED_TIMERS define/check was added in 523943a as part of adding L1
support. The runtime checks against TIM1/TIM8 already existed. Since L1
doesn't have TIM1/TIM8, those names are undefined, resulting in a compilation
error until ifdeffed out.

Since I throw out all TIM1/TIM8 checks, there's no references to those names
left, thus no need to keep the ifdef either.

As for the registers themselves, l1/timer.h pulls in common/timer_common_all.h
which defines macros for the superset of all timers, so e.g. TIM_BDTR() is
still available regardless of whether or not the particular chip we're building
for has any timers with a BDTR register.
2017-10-18 20:39:51 +00:00
Karl Palsson c6743f9ecd vector: make common linker definitions available to users
_data_loadaddr, _data, _edata, _ebss, _stack and vector_table all now
available in vector.h.

Suggested on IRC
2017-10-18 20:05:14 +00:00
Karl Palsson b2079f10af stm32:can: help gcc recognise deliberate fall through
Very new gcc versions add a warning on switch cases that fall through.
While there's an option that accepts any comment as explaining it, it's
easier in our case to just use one of the "blessed" comments.  We can't
use the [[]] attributes for standards code, and the gcc specific
attributes are worse than the comments.  This has no functional change
whatsoever.
2017-10-07 21:06:51 +00:00
Karl Palsson af7b2190a9 timers: define ADVANCED_TIMERS in a "portable" manner
gcc7.2 complained about the old syntax.  So, be more verbose.

Fixes: https://github.com/libopencm3/libopencm3/issues/826
2017-10-06 15:43:31 +00:00
Adam Heinrich 08dc7dac1c stm32f1: rcc: Fix number of wait states in comment to match the code
Signed-off-by: Adam Heinrich <adam@adamh.cz>
2017-10-02 21:47:06 +00:00
Adam Heinrich e9a8c5106e stm32f0: rcc: Enable prefetch buffer in rcc_clock_setup_*()
Prefetch buffer makes the code execution from the Flash memory faster.

Signed-off-by: Adam Heinrich <adam@adamh.cz>
2017-10-02 21:47:06 +00:00
Diego Herranz 1b64b1494b stm32f1: doc: Fix gpio cnf parameter
GPIO_CNF_INPUT (non existing) -> GPIO_CNF_INPUT_FLOAT
2017-09-26 09:42:47 +00:00
Amitesh Singh e3c78b8825 stm32f1:rcc: fix typo in usb prescaler api document
usb scalar value 1.5 is used when clock runs at 72MHz not 64MHz

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2017-09-01 22:02:28 +00:00