436 Commits

Author SHA1 Message Date
Karl Palsson
d67aec1cc8 stm32: Clock Recovery System is a common peripheral.
Pull it out of the F0 directory ready to be used by other devices with this
peripheral.
2015-10-06 00:52:39 +00:00
Karl Palsson
f5eb96caf3 usb: Add st_usbfs_v2 for f0/l0 devices
Based on previous work, add a new driver for the v2 usb peripheral found on
stm32f0 and l0 devices.

Correspondingly, add a usb gadget zero test suite for the f0.  L0 device level
code isn't yet ready, but will add the test case when it moves in.

Work by Frantisek Burian, Kuldeep
Singh Dhaka, Robin Kreis, fenugrec and zyp on irc, and all those forgotten.
2015-10-03 02:03:58 +00:00
Karl Palsson
cffaf1ee60 stm32:f0: Add a common range of ld scripts
a couple from the f03, f04, f05 and f07 ranges, which, while having ST wide
consistent flash size codes, differ in ram amounts.
2015-10-03 01:57:01 +00:00
Karl Palsson
b9c3c14d7a usb: core code cannot use bitbanding.
Bitbanding is not available on CortexM0/M0+, so don't use any bitbanding
accesses in core code.
2015-10-03 01:32:46 +00:00
Karl Palsson
e121243ce2 usb: extract ST USB FS peripheral core. [BREAKING CHANGE]
The breaking changes here changes in header location, and changes in driver
name passed down to the usb stack.

Changes affect: stm32f102/f103, stm32l1, and some f3 parts

* instead of the confusingly generic "usb" use the name "st_usbfs" for the USB
  Full speed peripheral ST provides in a variety of their stm32 products.
  Include directives should change as:
      #include <libopencm3/stm32/usb.h> => <libopencm3/stm32/st_usbfs.h>

* instead of the confusingly specific "f103" name for the driver, use
  "st_usbfs_v1"  [BREAKING_CHANGE]

  Instead of:
    usbd_init(&stm32f103_usb_driver, .....) ==>
    usbd_init(&st_usbfs_v1_usb_driver, .....) ==>

The purpose of these changes is to reduce some confusion around naming, but
primarily to prepare for the "v2" peripheral available on stm32f0/l0 and some
f3 devices.

Work by Frantisek Burian, Kuldeep Singh Dhaka, Robin Kreis, fenugrec and zyp
on irc, and all those forgotten.
2015-10-03 01:32:34 +00:00
Karl Palsson
eb18cc19cb stm32l1: Add eeprom to memory maps
By adding an "eep" memory section, and a NOLOAD step into the linker
scripts, you can now let gcc allocate variables in eeprom for you.
However, as fitting for eeprom, they cannot be initialized, and will not
be loaded at any time.  This simply lets you get place variables in the
eeprom space.

Example:

struct whatever __attribute__((section(".eeprom"))) blah;
struct another __attribute__((section(".eeprom"))) wop;
printf("%#x", &blah); // ==> 0x08080000
printf("%#x", &wop); // ==> 0x08080000 +  sizeof(blah)

You can read directly out of these variables, but need to use the
eeprom_ routines for writing to them.
2015-09-22 22:26:48 +00:00
Karl Palsson
7063e5cdc9 stm32f0: rcc: properly set USB clock source
Missing breaks in switch statement.

Fixes Github issue #524
2015-09-05 16:12:39 +00:00
Karl Palsson
4053bd6e14 stm32f1: add standard ldscripts for medium/high density
We haven't yet moved everything over to any autogenerated linker scripts, so
include more common templates instead of proliferating mountains of them in
every example.
2015-08-31 22:35:23 +00:00
FrancoisFinfe
7b29caed1a stm32l1:rcc: allow pll source to be HSE.
The existing rcc_clock_setup_pll only allowed HSI as the clock source, even
though the existing clock structure contains pll source variables.

Check this value, and switch to the corresponding clock source, rather than
blindly assuming that we are tryign to operate from HSI.
2015-07-31 05:21:52 +00:00
Karl Palsson
a2af34d0e1 stm32f1:rtc: whitespace/style cleanup.
Improperly checked pulls before commiting.  Trivial whitespace only change.
2015-07-31 05:21:46 +00:00
Ken Sarkies
86f3e4a648 stm32:f1:RTC rtc_awake_from_off function originally reset the backup domain.
(probably because the Ref Manual erroneously required it).
This has a naughty side-effect in that unrelated user data in the BD would be wiped.
Replaced this call by clearing the RTC registers to their default values.

Tested with ET-STAMP-STM32 to verify RTC starts from power-on and reset with expected behaviour.
2015-07-31 04:51:07 +00:00
Ken Sarkies
d316bbca39 stm32:f1:RTC: Replace direct register access with API calls
Some additional functions added to rcc to support the rtc.
2015-07-31 04:49:56 +00:00
Ken Sarkies
957c5233f4 stm32:f1:RTC: add documentation 2015-07-31 04:48:57 +00:00
Karl Palsson
40cde559a7 stm32: f24: doxygen updates for flash program width.
More doxygen, more better.
2015-07-31 03:51:32 +00:00
Karl Palsson
ec15c1ca64 stm32: f24: flash: Make code match documentation
This removes the shift from the defines, and includes them in the helper
function, making the code match the documentation, and following how the
rest of the library commonly operates.

Code using the existing defines will continue to work.
2015-07-31 03:51:25 +00:00
Jorik Jonker
07ee71cf23 stm32f4: rcc: Add 84Mhz, max speed for f401
Basic helpers to at least support common configurations for the f401.

Original submission specified 5 wait states, but the reference manual and other
reviewers all believe that 2ws is sufficient for these modes.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2015-07-31 02:25:23 +00:00
Karl Palsson
b1e495f51a stm32f3: adc: Add support for sequence completion flags
The f3 adc has separate bits for end of conversion and end of sequence.
Support those fully, with the regular enable/disable irq methods, and
the flag checking methods.

Discovered in github bug: #493
2015-07-29 13:28:18 +00:00
Karl Palsson
e65140d0d3 stm32f3: adc: remove invalid eoc group methods.
This code was copied from the f4, and blindly modified to make it seem
to work.  The f3 has separate flags for EOC and EOS, it doesn't use a
second bit to configure what the EOC bit does.

Consequently, update the documentation to correctly indicate that the
EOC bits are only set per conversion.

Discovered in github bug: #493
2015-07-29 13:22:17 +00:00
Karl Palsson
42983e2790 stm32f3: adc: Overrun flag is cleared by writing 1
Unlike the ADC peripheral on most other stm32 parts, the bits in the
ADC_ISR register are r_w1, not rc_w0.

Fixes github bug: #493
2015-07-29 13:18:26 +00:00
Karl Palsson
9f8e0ac1ba stm32f3: adc: consistently return flags
No reason to explicitly check against 0.  We just return the flag
directly as a bool in many other places.
2015-07-29 12:57:55 +00:00
Karl Palsson
3a106dbd10 stm32: spi: add more cross linking documentation 2015-05-25 13:03:23 +00:00
Kuldeep Singh Dhaka
c28d7bc187 stm32: spi: Standard mode selection
Allow setting cpol/cpha via standard mode numbers, instead of separate calls
for each bit.
2015-05-25 13:03:20 +00:00
Chuck McManis
fb1a365423 stm32: Disable SSOE if slave management is enabled
As called out by flixr, if you want slave select management then
you don't want SSOE active. This turns it off when enable_slave_management
is called.
2015-05-25 01:35:21 +00:00
Chuck McManis
f80bff2133 stm32: Fix common case SPI handling
The common case for SPI ports in master mode is that they are not
also running as Slaves some times. For these chips the SSOE bit must
be set (or NSS tied high). Since it is common for people to use a separate
GPIO to select remote slaves and they expect the master to always be the master
this sets that up by default.
2015-05-25 01:34:57 +00:00
Karl Palsson
6d658c20b8 make: use shared DEBUG_FLAGS (-gdb3) by default
-ggdb3 make slightly bigger .elf files, but allows gdb to understand
macros, which libopenocm3 uses somewhat extensively.  Make this the
default, and pull it up to the common base makefile, so it can be easily
substituted.
2015-05-04 13:45:07 +00:00
Karl Palsson
5746fd4d25 stm32: common: Extract MCO source setting
This adds MCO source selection to some targets, and removes and standardizes
the mask/shift usage for all targets.  For devices that support MCO2, this
supports only MCO1.  No attempt has been made to extract MCO prescaler, which
is not available on all F1 and F3.
2015-04-29 01:22:27 +00:00
Karl Palsson
f473d40038 stm32f0: check correct registers for ready flags
F0 should check the oscillator ready bits in the regular registers, just
like the docs claim, and just like every other stm32, rather than trying
to check for the interrupt flags.

Reported-by: n1b on irc
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2015-04-21 17:24:23 +00:00
Piotr Esden-Tempski
5658a4ebcf [stm32f4-ltdc] Style cleanup.
Mainly replaced function like defines with static inline functions.
2015-02-12 19:02:51 -08:00
Piotr Esden-Tempski
8591a5aa20 [stm32-common-i2c] Style fix. 2015-02-05 20:14:29 -08:00
Angus Peart
b58ac190bb Fixed unwanted deletions... 2015-02-05 20:11:06 -08:00
Angus Peart
60739968bd STM32F1: Support for I2C_OAR2 (Dual addressing) 2015-02-05 20:11:06 -08:00
Piotr Esden-Tempski
98855af279 Indentation and style fix. 2015-02-05 19:13:49 -08:00
Chuck McManis
d7c83348c0 Doxygen fix
Timer docs were a bit out of date just brought them up to date
and added the Quadrature example.
2015-02-05 19:08:25 -08:00
Oliver Meier
276600b511 [stm32f4-ltdc] commented out assertions. will remove them later 2015-02-05 16:44:38 -08:00
Oliver Meier
d5112bc9e7 [stm32f4-ltdc] The Makefile change got lost somehow 2015-02-05 16:44:38 -08:00
Oliver Meier
eaae7731e9 [stm32f4-ltdc] initial commit 2015-02-05 16:44:38 -08:00
Pavol Rusnak
4b8f6e01ab stm32: f2: Add missing desig.o to Makefile
Basically the same as ad937e00fd04d1a618146b20f04ebc8460bf98b2 but for stm32/f2
2015-01-31 11:24:50 +01:00
Felix Ruess
f206fcb57e [stm32] desig: high nibble to hex char first
When converting the uniqute id to a hex string, it seems more sensible to put the higher nibble in the string before the lower nibble.
2015-01-16 19:12:21 +01:00
Daniel Serpell
ca41131f97 stm32: f0: Fixes setting of PLL multiplication factor
Really use RCC_CFGR_PLLMUL negated as a mask.

Signed-off-by: Daniel Serpell <daniel.serpell@gmail.com>
2015-01-12 22:44:03 -03:00
Felix Ruess
40d9ffcb6b stm32: f1: fix missing ahb_freq 2014-12-29 19:52:23 +01:00
Karl Palsson
8a15cec6bf stm32: f4: flash: support extended sector ranges
F42xx and F43xx have extended sector ranges.

Reported-by: H2OBrain@irc
2014-12-18 23:29:10 +00:00
Kuldeep Singh Dhaka
342ec6e9e3 [STM32F0] Add support functions for USB clock setup in F072 chips.
There is remaining an issue with PREDIV connected just after clock multiplexer (only F072). This should be fixed in another commit.
2014-12-18 23:43:04 +01:00
Kuldeep Singh Dhaka
331acce4fc [STM32F0] add support of autotrimming HSI to USB SOF frames
Signed-off-by: Frantisek Burian <BuFran@seznam.cz>
2014-12-18 23:43:04 +01:00
brabo
bb8980efc6 [ETH] Make support of ethernet for F1 family 2014-12-17 23:58:55 +01:00
Chuck McManis
9ddfcb0e53 Rename rcc_ppre1_frequency and rcc_ppre2_frequency
Rename rcc_ppre1_frequency and rcc_ppre2_frequency to rcc_apb1_frequency and rcc_apb2_frequency
Also add rcc_ahb_frequency (although it is not set correctly in all cases) which will be fixed by
the rcc commits later. Also fixup the only use in the library of these variables, the USART code.

And fix the typos that resulted
Make l1 generic too
2014-12-13 19:49:04 -08:00
Daniel Thompson
ad937e00fd stm32/desig: include in f4 library
The code is all there and working but simply isn't being built.
2014-12-07 12:47:19 +01:00
Chuck McManis
99f83eedcd stm32/f0: rcc.c Use common version instead of duplicate code.
Pulls out duplicate calls from f0/rcc.c and uses the common version which
also means that f0 can use rcc_peripheral_enable() now which is in common
but not the old rcc versions.
2014-12-03 11:14:26 +00:00
Karl Palsson
f51698fff4 stm32:l0: RCC: add osc_on/osc_off helpers
These are the routines that have custom switch cases, and aren't easy targets
for pulling out.
2014-12-03 11:13:39 +00:00
Karl Palsson
160a644bc6 stm32:l0: Add linker script / memory sizes
Easier to pick a corresponding part.
2014-12-03 11:13:39 +00:00
Karl Palsson
378069091a stm32:l0: Add RCC register definitions
Tested with a miniblink example on the l053 discovery board.

Only register definitions at this stage, no helpers.
Register definitions from RM0367r2, hopefully the biggest
superset of L0 parts.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2014-12-03 11:13:39 +00:00