503 Commits

Author SHA1 Message Date
Karl Palsson
f67e217ffb stm32: adc-v2: Pull up the two forms of the adc-v2
The adc v2 periph has the same register map, but comes in two flavours, one
supporting injected channels, more watchdogs, per channel sampling times and
so on, and one "simple" version.

Pull up the f3 and f0 portions into the appropriate files, after comparing with
L0 and L4 reference manuals, even if those are not fully landed yet.
2016-03-30 16:59:56 +00:00
Karl Palsson
4c550648c3 stm32: adc-v2: pull up common register definitions 2016-03-30 16:59:56 +00:00
Karl Palsson
1d090c840f stm32: adc-v2: pull up temp/vref switches
Common for f0,f3,l0,l4
2016-03-30 16:59:55 +00:00
Karl Palsson
7231b9a691 stm32: adc-v2: pull up single/continuous modes 2016-03-30 16:59:55 +00:00
Karl Palsson
a89cd86454 stm32f0/f3: adc: extract beginnings of common v2 periph
The f0, f30x and l0 have a very similar "v2" adc peripheral.
Start extracting out some of the common code, and fix the glaring bug in
adc_power_down that was affecting them both.

This is not intended to be a fully comprehensive extraction, just the first
easy steps.
2016-03-30 16:59:55 +00:00
Karl Palsson
0758deb04d stm32f3: adc: migrate CFGR -> CFGR1
The adc peripheral on F30x is the same as F0, L0 and L4.  In the reference
manuals, the following names are used.

F3:	 	CFGR  (no CFGR2)
F0 and L0:	CFGR1 and CFGR2
L4:		CFGR and CFGR2

Moving to a single consistent name, that's more likely to be inline with future
part numbers makes it much easier to extract common driver code for the
peripheral.

While all bit defines are moved to the CFGR1 style, core register definitions:
ADC_CFGR(adc) and ADCx_CFGR are kept to match the original register name in the
reference manual.

Fixes Github issue #548
2016-03-30 16:59:55 +00:00
Karl Palsson
ca50f069b6 stm32f3: adc: common registers are per master/slave
They're not a single set just based on ADC1.
2016-03-30 16:59:55 +00:00
Karl Palsson
7373d3ad58 stm32f3: adc: support voltage regulator on/off
The "Intermediate" value isn't a value you can do anything with, you need to
clear those bits when making changes.
2016-03-30 16:59:55 +00:00
Karl Palsson
6eb846d356 stm32f3: adc: rationalize Sampling Time definitions.
There are as many SMPRx registers are needed for channels supported, and on all
other families, the field definitions are just ADC_SMPR_SMP_XXX.  For
consistency, and to avoid any confusion or duplication, use the same style here
too.  Drop silly unused per channel definitions that have no purpose.
2016-03-30 16:59:55 +00:00
Karl Palsson
b2e6e5c3b9 stm32: standardize names for temp sensor calibrations
Instead of some parts using _30C and _110C and others using _30C and _110, use
the C suffix in all places to be consistent.
2016-03-30 16:59:55 +00:00
Karl Palsson
a22d6a8315 stm32: adc: standardize special channel names
At least temp sensor, vrefint and vbat/vlcd should have consistent names and
consistent doxygen.
Dropped channel definitions that are the same as the raw number.
2016-03-30 16:59:55 +00:00
Karl Palsson
50c056f965 stm32: adc: standardize adc_power_off naming. [BREAKING]
Instead of a mismatch of adc_power_on/adc_off, we now have a matched pair of
adc_power_{on,off}

For some people, this is a breaking change in the API!
2016-03-30 16:59:55 +00:00
tsaitgaist
c759ba59d0 stm32: timer: fix trigger selection names
correct TIMx_SMCR TS[2:0]: Trigger selection name are TI1F_ED, TI1FP1,
TI2FP2 according to RM0008 and RM0090
2016-03-28 22:57:01 +00:00
Anatol Pomozov
ae41782e1a Fix misspellings using codespell tool 2016-03-08 08:52:54 -08:00
Karl Palsson
20e1ee174d stm32l4: rcc: fix typo in RCC_CR_CSSON bit define
Reported by @benjaminlevine
2016-03-06 23:26:05 +00:00
Oliver Meier
92845bc508 stm32: usb-otg: added missing GOTGINT definitions. 2016-02-29 20:53:01 +00:00
Karl Palsson
5738e9515d stm32: rcc: fix missing ahb_frequency struct
Original commits, while appearing clean and tidy, hadn't even been
compile tested.  Trust no-one. Not even Scully.

Fixes: 770878e7b4ac12513e121e087261ca0972ba04e6
Fixes: 86d20ef00c00a14d7a4f0b834b9b608b2dd3638a
Fixes: 05ff0df32226dc28e22b98afde07bb886af9ddc9
2016-02-17 16:21:30 +00:00
Karl Palsson
609cfe7f28 stm32: spi: correct typo in PHILIPS
Fixes: #589 on github
2016-01-04 17:13:30 +00:00
Piotr Esden-Tempski
17f159dec9 [PWR] Removed unneeded vos_scale_t definiton. 2015-12-15 00:51:18 +01:00
Piotr Esden-Tempski
830cf7bfc4 [RCC] Added missing prefix to the hsi setup table in f3. 2015-12-15 00:28:52 +01:00
Karl Palsson
3a7cbec776 stm32l/stm32f: name space standardization [BREAKING]
As done by esden for the F4, remove typedefs and add prefixes to clock enums
This extends this to all stm32 families.

    Let's not hide the fact that these variables are structs/enums.

    We are filling up the namespace badly enough, we should be prefixing as
    much as we can with the module names at least. As users we already run
    often enough in namespace colisions we don't have to make it worse.

    * CLOCK_3V3_xxx enums renamed to RCC_CLOCK_3V3_xxx
    * clock enums (PLL, HSI, HSE ...) prefixed with RCC_
    * scale enum of pwr module prefixed with PWR_
2015-12-14 23:26:42 +01:00
Piotr Esden-Tempski
d680be81b5 [stm32f4] Remove rcc typedefs added prefixes to clock related enums.
Let's not hide the fact that these variables are structs/enums.

We are filling up the namespace badly enough, we should be prefixing as
much as we can with the module names at least. As users we already run
often enough in namespace colisions we don't have to make it worse.

* CLOCK_3V3_xxx enums renamed to RCC_CLOCK_3V3_xxx
* clock enums (PLL, HSI, HSE ...) prefixed with RCC_
* scale enum of pwr module prefixed with PWR_
2015-12-14 23:26:32 +01:00
Piotr Esden-Tempski
b1049f9a6f [Style] Stylefix sweep over the whole codebase. 2015-12-14 22:57:15 +01:00
Devan Lai
c28d9727d7 stm32f0: flash: Add BOOT_SEL and nBOOT0 definitions for FLASH_OBR
Checked against RM0091rev8
2015-12-13 01:07:26 +00:00
Karl Palsson
f14c678ccb stm32l4: add gpio support
Just the basic core common functionality gained for free by being a common
peripheral.  Enough for a miniblink.

Fixes some errors in the GPIO memory map.  ST's naming of AHB2 vs AHB3 is
confusing.
2015-11-13 02:13:31 +00:00
Karl Palsson
8afc983f3e stm32l4: Add RCC definitions
Bring in the core common code, and now that it's used, pull in the common
memorymap
2015-11-13 01:15:17 +00:00
Karl Palsson
507c184456 stm32l4: initial memorymap and vector support
Values from RM0351rev1, with the correction of the duplicate TIM1_CC entry.

Only stub support so far, but this opens up the beginning of build testing.
2015-11-10 23:47:57 +00:00
Karl Palsson
a939810940 stm32f0: Add rcc compatibility aliases
Many stm32 families have multiple ADC and DAC peripherals.  F0 (so far) only
has one.  To make it easier to use the same code on many stm32 families,
provide an alias for ADC1 to ADC.
2015-11-10 22:00:11 +00:00
Nicolas Schodet
9b8d44e8a3 stm32f4: add GPIOJ & GPIOK
They are available on STM32F429 and STM32F439.
2015-11-10 14:27:57 +01:00
Karl Palsson
fd100ea6c2 stm32f0: rcc: doxygen update prediv
After adding support to the f3, add missing doxygen support to the f0
equivalent.  This improves things and keeps them consistent until/if they are
pulled out as common code.
2015-11-08 15:36:32 +00:00
Karl Palsson
a444aa4476 stm32f3: rcc: Add pll source prediv support
Based on the f0 support, which has identical functionality, but with doxygen
added.  Bits renamed as they are only HSE prediv on some targets, and makes
things more consistent with the f0.

Fixes part of github issue #560
2015-11-08 15:36:32 +00:00
Karl Palsson
489dc5125e stm32f3: rcc: support setting ADC prescalers
If you are in async mode (ADC_CCR.CKMODE == 0) (the reset default) you still
need to set the prescalers before the ADC will actually enable.
2015-11-08 15:36:32 +00:00
Karl Palsson
674cd9bfe9 stm32f3: rcc: Update ENR/RST definitions for newer docs
Based on latest RM0316rev5, and fixed a bug in f37x CEC bit definition that
overlapped.
2015-11-08 15:36:32 +00:00
Karl Palsson
4d7694b454 stm32f3: rcc: consistent masks for pll multiplier
All other masks consistently used a separate mask/shift define, bring the pll
multiplier function in line, and use the same form as other functions.
2015-11-08 15:36:32 +00:00
Karl Palsson
129a874cf8 stm32f3: rcc: Correct name of pll multiplier helper.
This function was badly copied and pasted from the f4 library, where there are
two functions, rcc_set_main_pll_hsi and rcc_set_main_pll_hse which combine
source, multipliers, dividers and other pll factors.

On F3, (not all of them, but the ones we support now), the function as
implemented has nothing to do with hsi / hse, and instead is simply selecting
the PLL multiplier.
2015-11-08 15:36:32 +00:00
Karl Palsson
10ef294e5d stm32f3: rcc: Set prescalers properly.
Copypasta from f4 rcc code was only modified to shift the result, but not clear
the existing settings properly. Add mask/shift definitions and use them
properly.
2015-11-08 15:36:32 +00:00
Karl Palsson
e6f267e103 stm32f7: Update TODO memory map items
DBGMCU and flash size and unique id registers had simply been copied from F4,
with TODO markers.  Checked against current datasheet and ref manual
2015-11-01 14:21:07 +00:00
Karl Palsson
ab0552b1f7 stm32f7: correct addresses for calibration values 2015-11-01 14:12:37 +00:00
Alexandru M Stan
435cbcc675 stm32f0: Fix TSC_IOGxCR
TSC_IOGxCR is actually a 32 bit register, of which 13 bits are used
(rest are reserved).

Also, added x-1 since G0 is not a valid group, TSC_IOGCSR_GxE(1) is supposed
to be at 0x34, not 0x38.
2015-10-24 20:06:12 -07:00
Karl Palsson
ff6cc954b7 stm32: adc: drop non-existant adc_set_single_channel
Was only in the (obviously out of date) documented example and as a
declaration.  No implementations.  Dropping immediately, but documentation
still needs further work.
2015-10-17 01:23:56 +00:00
Karl Palsson
fbd25fb16f stm32f7: missing ; in rcc enumerations 2015-10-15 12:31:01 +00:00
Karl Palsson
5ece67ad5d stm32f7: Add rcc.h
Full clean manually checked against RM0385rev2.

Header definitions only.
2015-10-15 11:49:28 +00:00
Karl Palsson
c1c37a8b0f stm32f7: Update IRQs from latest ref manual
One name change and some new ones.
2015-10-15 10:36:54 +00:00
Frantisek Burian
3ef2c38120 [stm32f7] Add initial support of the family, GPIO support.
Most changes are noise from doxygen.
Readme udpated to explain newer FP_FLAGS for m7
stm32f7 library is skipped if the toolchain doesn't support it yet.
2015-10-15 10:34:28 +00:00
Karl Palsson
2e25d678ba Surround all macro parameters with ()
Followup from c72f3d588a637101262d5e2b276dc6cc5d926a6d
2015-10-15 01:03:18 +00:00
Karl Palsson
75d508246e usb: otg: drop confusing invalid definitions
GUSBCFG TRDT fields have very particular meanings, and the field should be set
depending on your bus speed.  There's no 8/16bit meaning in any current
reference manual for this field.

Fixes github issue #530
2015-10-14 22:42:49 +00:00
Karl Palsson
c72f3d588a Surround all macro parameters with ()
All the macro arguments that are user supplied, or potentially, wrap properly
in () as good practice.

Probably missed one or two, and a lot of them are possibly unnecessary, but
it's straightforward to just do it always.

Fixes github issue #321
2015-10-14 22:15:15 +00:00
Devan Lai
5270c11a09 stm32f0: Fix offset for GPIO_BRR
Correct as per RM0091rev5
2015-10-07 10:08:47 +00:00
Karl Palsson
17bc66c46b stm32f4: fmc: Use standard form shift definitions.
It's confusing and unhelpful to use a different style of shift definitions for
bitfields.

Originally reported by "mox-mox" in
https://github.com/libopencm3/libopencm3/pull/467
2015-10-06 01:26:56 +00:00
Karl Palsson
f1d8a7ef04 stm32l0: Add USB support via st_usbfs driver. 2015-10-06 00:54:17 +00:00