631 Commits

Author SHA1 Message Date
Jordi Pakey-Rodriguez
c7d46c4fbb stm32f4: adc: Correct ADC documentation 2018-04-14 18:40:54 +00:00
Karl Palsson
23fc65d44c ethernet: ksz80x1: fix build/compile
Originally sourced from: https://github.com/libopencm3/libopencm3/pull/382

fixed some typos from the manual and poor merging/rebaseing,
and one judgment call on using a specific name for a conflicting
bit definition.
2018-04-14 18:40:54 +00:00
Frantisek Burian
20b7956d82 [ETH/PHY] Add support for Micrel KSZ80X1 family of PHYs 2018-04-14 18:40:54 +00:00
Guillaume Revaillot
c670bdca1a stm32l0: enable iwdg 2018-03-28 13:06:57 +00:00
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
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
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
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
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
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
Karl Palsson
b0e050d10d stm32: can: fix can_reset()
Clearly staging branch testers weren't testing.
Also, clearly the separation of RST_ bits and RCC_ bits is a complicated
annoyance.

Fixes: d9615a2eb728 update to modern include apis
2017-08-25 09:44:03 +00:00
Karl Palsson
e11e64330c stm32f0: can: add to build
Added the CAN1 compatibility aliases as has been done for adc and dac to
make code reuse easier.  Only for the magic enums, the raw bit
definitions remain as per the ref mans

Originally suggested as https://github.com/libopencm3/libopencm3/pull/802
2017-07-04 23:24:49 +00:00
Jonathan Halmen
83adad0aed stm32: can: change filter match index to uint8_t
The variable can only be 8bits, and converting pointers resulted in
cases of overwriting nearby variables.
2017-07-04 23:23:29 +00:00
Karl Palsson
5a517f7854 stm32:adcv1: correct documentation for AWD
remove misleading atttempt at describing that the thresholds are
compared before any alignment changes takes place.
2017-06-23 23:17:23 +00:00
Fabián Inostroza
98ff5c23aa stm32: can: Add support for getting the message timestamp.
Provide an optional parameter to receive the timestamp in
2017-06-08 23:01:45 +00:00
Karl Palsson
192c2eacb7 stm32: can: Correct mask/id order in filters
Checked against RM0090r11 and confirmed.

Reported-by: Warren Gay <ve3wwg@gmail.com>
2017-06-08 23:01:45 +00:00
Karl Palsson
bc898d1f92 stm32l0: rcc: Add clock struct setup helper
Based on l1, l4 and friends.
2017-06-08 23:01:45 +00:00
Karl Palsson
ec1d2855b0 stm32l1: rcc: use better naming for flash wait states
More compatible with developments in l0/l4/f7, and just a better choice
of names overall.
2017-06-08 23:01:45 +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