Commit Graph

345 Commits

Author SHA1 Message Date
Federico Ruiz Ugalde 6af6cec101 stm32f3: dma support added. 2013-07-07 16:01:48 -07:00
Federico Ruiz Ugalde 433c1c9db8 stm32f3: spi support added. 2013-07-07 16:01:48 -07:00
Federico Ruiz Ugalde 5c825a78c7 stm32f3: watchdog support added. 2013-07-07 16:01:48 -07:00
Federico Ruiz Ugalde 6b522fc644 stm32f3: Crc support added. 2013-07-07 16:01:48 -07:00
Federico Ruiz Ugalde ef762f0448 Stm32f3: usart support added. 2013-07-07 16:01:48 -07:00
Federico Ruiz Ugalde 49fe59e82d stm32f3: adding external interrupts support. 2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde a7bcf6446b stm32f3 dac support added. 2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde 0a39eab19a Missing files for adc stm32f3 support added. 2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde 6732ae25cb Adc stm32f3 support added. 2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde be841154a9 i2c support added.
Most of the changes went to i2c_common_all.h file.
F3 is considerably different than all the other in i2c.
2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde b6bae46b71 Unnecessary include of pwr.h removed from rcc.c. Pwr.h becomes unnecessary to run the f3 2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde 934821aa42 Partial flash support added. 2013-07-07 16:01:47 -07:00
Federico Ruiz Ugalde 45035f2f3c Fixed compile warning, function declaration in rcc.h wrong 2013-07-07 16:01:46 -07:00
Federico Ruiz Ugalde 0ca18eb09f Added interrupts for f3, Pre_main rutine in vector_chipset, nvic.h modified to include f3. 2013-07-07 16:01:46 -07:00
Federico Ruiz Ugalde b8764d0214 Makefile for f3 lib added. Gpio.c and rcc.c also in. 2013-07-07 16:01:46 -07:00
Federico Ruiz Ugalde 67c979e5fa Fixed compile of f4 and l1 after gpio_common_f234.c renaming. 2013-07-07 16:01:46 -07:00
Federico Ruiz Ugalde a156b9e8fc linker script file for f3 added. 2013-07-07 16:01:45 -07:00
Federico Ruiz Ugalde 3af5833b83 Initial support for stm32f3. Changes in makefiles, gpio.
- Makefiles now include building f3 src directory.
- Gpio support added. gpio_common_f24 changed to support also f3.
- f3 still not compiling, but f2 compile not broken (probably also f4).
2013-07-07 16:01:45 -07:00
Piotr Esden-Tempski 2f425af647 [Style] A small coding style fixing session. 2013-07-05 20:35:13 -07:00
Piotr Esden-Tempski beeb9c3f65 [Style] Do not declare new types if not really necessary. 2013-06-30 22:20:51 -07:00
Piotr Esden-Tempski 647b878031 [Style] Coding style fixes.
* No trailing white spaces
 * No sapces before tabs
 * "int *var" and not "int * var"
2013-06-30 22:09:25 -07:00
BuFran 035c67ced6 Add preliminary support for Cryptographic coprocessor on stm32 F2 and F4 2013-06-30 21:20:42 -07:00
Piotr Esden-Tempski 8da7fbd71e Changed to use accessors instead of casting to volatile pointers.
In places where we were defining memory mapped peripheral buffers we
were using directly a cast to "volatile int_type *". For consistency we
should use dereferenced accessor like: &MMIO32(address)
2013-06-12 21:37:55 -07:00
Piotr Esden-Tempski 39fa9e4c58 Stile fixes run, 80 char boundry. 2013-06-12 21:07:35 -07:00
Piotr Esden-Tempski 34de1e776e Changed to use stdint types. 2013-06-12 19:11:22 -07:00
Piotr Esden-Tempski 7df63fcae0 First coarse run to fix coding style in locm3.
Added --terse and --mailback options to the make stylecheck target. It
also does continue even if it enounters a possible error.

We decided on two exceptions from the linux kernel coding standard:
- Empty wait while loops may end with ; on the same line.
- All blocks after while, if, for have to be in brackets even if they
  only contain one statement. Otherwise it is easy to introduce an
  error.

Checkpatch needs to be adapted to reflect those changes.
2013-06-12 18:22:56 -07:00
Felix Ruess 0bf8324c91 stm32f1: add timer.o to objects for timer_ic_set_polarity 2013-06-04 18:44:19 +02:00
Karl Palsson a5966093e6 [stm32l1] Never write illegal values to voltage range selection
According to the reference manual, you are _forbidden_ from writing 00 to the
VOS[1:0] bits in PWR_CR.  Writing a 00 is automatically turned into range 2,
or, 10.  Attempting to then |= the bits for range 1 (01) results in the final
result of choosing voltage range 3 (11).  This has fairly catastrophic effects
if you then attempt to switch to PLL clock at 32Mhz.

Oddly, the existing code was working fine on STM32L151C6 revision W, but
failing with revision V silicon.  Regardless, the existing code was wrong and
not following the reference manual.

Further, attempting to change any power voltage range settings without the RCC
enabled will have no effect, so all the higher level helper routines
have added peripheral enable lines before attempting to set the range.
2013-06-03 19:38:37 +00:00
Karl Palsson 8cfaef7fb6 [stm32l1] Don't use an intermediate clock in setup
This switch to HSI was an attempt to run the setup code faster. However,
there's no real need for this, and it just confuses things by switching first
to one clock, and then to another.  Just keep running on the existing clock
until switching to the clock actually chosen by the user's arguments.
2013-06-03 19:38:37 +00:00
Ben Gamari d90ec98f52 stm32: Add missing exti_get_flag_status 2013-06-02 18:32:40 -07:00
Mikhail Avkhimenia 15e35d5bc1 [stm32] Added basic support for hash processor
Added hash processor register definitions and main functions. Hash
processor is supported in stm32f21, stm32f41 and stm32f43 and can be
used to calculate Md5 and Sha1.
2013-06-02 18:23:49 -07:00
Ken Sarkies f5c9bdfe61 Changes to doxygen markup to solve a few problems that upset
doxygen, and to correct minor errors.
2013-06-02 18:17:49 -07:00
Fergus Noble 4ad30d56b4 Add higher level flash_program function for f2/f4 to write a buffer into flash. 2013-05-10 18:53:19 -07:00
Fergus Noble 410be2a39a **** WARNING **** This change may break your code!!!
Change flash_erase_sector (f2/f4) to take numerical sector argument.

As opposed to using one of the defines in the header, this is more convenient when programatically deciding which sectors to erase.
2013-05-10 18:51:01 -07:00
Fergus Noble b039504494 Moving stm32 f2/f4 flash code into the common area. 2013-05-10 18:34:55 -07:00
Michael Aherne b9a6bbe56e Minor fix to compile functions in rtc.h 2013-05-10 14:09:06 -07:00
Felix Ruess af98521301 [stm32] update doxy for usart_set_baudrate 2013-04-29 18:35:06 +02:00
Felix Ruess 1b818a3679 [stm32] usart6 for F2/F4 2013-04-29 18:14:36 +02:00
Ken Sarkies 92d1134a16 STM32: moved timer_ic_set_polarity from timer_common_all to
f1/timer.
Added timer_ic_set_polarity to timer_common_f24 with
the enum tim_ic_pol now including trigger on both edges.
Changed timer_slave_set_polarity to use enum tim_et_pol
rather than tim_ic_pol.

In response to suggestion of stinkydiver73 on 24 March that
timers in all families have an option for triggers on both
edges, except F1.
2013-04-26 15:30:07 +09:30
Ken Sarkies cbb4756440 As requested (6 Feb 2013) change DMA interrupt flag names
in STM32/common, for dma_common_f24, to match those used in dma_common_f13.
Examples compile OK
2013-04-26 12:12:03 +09:30
Matthew Peddie ea15d962ab Remove redundant access size argument in F4 flash code. 2013-04-25 17:13:51 -07:00
millerd 6313af8869 Small improvements of using FLASH memory in STM32F1XX 2013-04-24 15:55:15 -07:00
Nicolas Schodet b2df978eae Add support for static constructors and destructors 2013-04-24 22:49:25 +02:00
Felix Ruess a12614054c [stm32][f4] ld file for f405x6 2013-04-23 17:55:04 +02:00
Gautier Hattenberger a4b582f91d add 16MHz resonator for stm32f4 2013-04-23 17:52:27 +02:00
Alan Braithwaite 67903bfbfe API change to remove dual loading default case for dac_load_data_buffer_single
Also change dac_data from u32 to u16
2013-04-20 00:31:30 +02:00
Alan Braithwaite 2288e35739 Fixed bug with dac_load_data_buffer_dual with register offsets 2013-04-17 09:36:28 +02:00
molnarkares 93007d20d9 Fixes:
CAN RX: ID conversion was incorrect
2013-04-16 17:12:10 -07:00
molnarkares 162522b3b2 can speed optimizations 2013-04-16 17:10:56 -07:00
molnarkares 9585e59df1 CAN2 on STM32F1 is slave and its filter banks are configured thru CAN1 FMR 2013-04-16 17:10:03 -07:00
molnarkares 867b57a1d2 can.c >> bug fixed in receive 2013-04-16 17:08:50 -07:00
Karl Palsson 69902568d1 [stm32-l1] Turn on the DMA code.
It appears to be the same dma peripheral as in the F1 and F3, so just
enable it as is.
2013-04-14 14:51:30 +02:00
Karl Palsson 4636eb134c [stm32l1] Update linker scripts
Add the M+ and H density parts, and include the EEPROM sizes
2013-04-14 14:49:57 +02:00
Ken Sarkies 5b8953124e This mainly moves the STM32 timers' code to the common area.
F2 and F4 have a common section to deal with the options register (TIM2 and TIM5 only)
L1 has been made common with timer_common_all as its options register has very different settings to F2/F4. Code is in the L1/timer.c L1/timer.h files

Note that F3 and F05 timers should fit into this scheme, with F3 having additional features.

Bundled with this is L1/pwr.h to change a documentation setting
Also all the Doxyfiles have added "ENABLE_PREPROCESSING = NO" to fix a problem introduced by commit 118.
2013-03-09 14:39:01 +10:30
Ken Sarkies a9a85f080b Add test in common headers for improper inclusion of such files in application.
(prevents inclusion and also issues warning)
Changes to some source files to remove references to common headers.
Changes to rng.h to make guard symbols the same in f2 and f4.
2013-03-07 18:35:04 +10:30
Ken Sarkies e2022f5884 Repair to documentation (most documented files)
to remove errors, duplications and inconsistencies.
File lib/stm32/f1/pwr.c - all code removed as it duplicates that in common/pwr_common.c
Remaining changes do not affect code. Compiles OK.
TODO efm32 has no code so generates no modules
TODO F2 needs pwr.c
TODO L1 needs dma.h and dma.c
2013-03-07 11:14:06 +10:30
Austin Palmer 31aa3b6f5a EXTI: Added function to get flag status 2013-03-01 10:36:57 -08:00
Michael Aherne 93f2b1ad5b Fixing some errors introduced with #107.
Namely:
 - I never added rtc to the makefile, so it wasn't getting compiled
 - I missed 2 includes that are needed once it's actually compiling
2013-02-27 13:21:21 -08:00
Michael Aherne dd75633245 Adding some useful functions for wakeup timer interrupts 2013-02-26 21:22:58 -08:00
Michael Aherne a121769785 Adding f4-specific rtc functions
These should also work with the f2
2013-02-26 21:22:58 -08:00
Zachary Crockett 9d24a480ae Implement SPI clean disable from TODO comment 2013-02-26 19:59:15 -08:00
Piotr Esden-Tempski ea67d6a36a Fixed all warnings in stm32l1 lib. 2013-02-26 17:28:20 -08:00
Piotr Esden-Tempski 1a025b5379 Fix all warnings for stm32f4 lib. 2013-02-26 17:19:22 -08:00
Piotr Esden-Tempski 7cd9b43529 Fix all warnings for stm32f2 lib. 2013-02-26 17:17:43 -08:00
Piotr Esden-Tempski b0233ae6fb Added more warning CFLAGS to all makefiles. 2013-02-26 16:42:20 -08:00
Piotr Esden-Tempski 5e7ec39440 FLASH: Make sure that the flash unlock register state is cleared before trying to unlock the flash. 2013-02-26 15:25:55 -08:00
Vegard Storheil Eriksen bc853e7ebd Fixed gpio_primary_remap; swjdisable is pre-shifted and therefore needs to be u32. 2013-02-26 13:49:42 +01:00
Piotr Esden-Tempski 1e1859e8c7 ADC: Fix CR usage in adc_enable_discontinuous_mode_regular. Fixes #101 2013-02-25 17:15:43 -08:00
alexn aa54eae5be CAN support STM32F4 2013-02-25 14:04:18 +01:00
Piotr Esden-Tempski 46263e90b4 Merge pull request #88 "Fix logical operator error in tim_ic_set_input reported by hmjack2008"
Merge remote-tracking branch 'ksarkies/timer'
2013-02-18 14:19:53 -08:00
Piotr Esden-Tempski b4634ba8ff Merge pull request #92 "DMA tidyup"
Merge remote-tracking branch 'karlp/dma_tidy'
2013-02-18 14:14:22 -08:00
Piotr Esden-Tempski b13e55da8c Adjusted code for l1 to the new api introduced by karlp in pr #84 2013-02-18 14:12:48 -08:00
Piotr Esden-Tempski 6eef01ce26 Merge pull request #84 "Pr flash reg rename"
Merge remote-tracking branch 'karlp/pr_flash-reg-rename'

Conflicts:
	include/libopencm3/stm32/l1/flash.h
2013-02-18 14:09:31 -08:00
Piotr Esden-Tempski 9095f58fa3 Merge pull request #79 "More L1 support (and f2/f4 rtc)"
Merge remote-tracking branch 'karlp/pr_more_l1_rtc'
2013-02-18 14:06:02 -08:00
Karl Palsson e4c0a50286 [stm32-dma] Eliminate redundant write.
Clearing a single bit in DMA_CCR, then immediately writing a 0 over the
entire register is completely redundant on the F1, F3 and L1 DMA
peripherals.  (Unlike the F2 & F4 DMA Peripheral, where this is
required)
2013-02-06 11:43:20 +00:00
Ken Sarkies e20ef7a416 Fix logical operator error in tim_ic_set_input reported by hmjack2008 2013-02-01 21:44:00 +10:30
Piotr Esden-Tempski c9276b7aa2 Fixing gpio_set_af now really... 2013-01-29 13:42:11 -08:00
Piotr Esden-Tempski ae55194d4a Fix gpio_set_af register usage. 2013-01-29 13:33:58 -08:00
Karl Palsson 40d9d630f0 [flash] f4: use "proper" bit definition naming.
Part 4 of 4: updated f4 to use flash_<reg>_bit instead of just
flash_bit
2013-01-23 13:58:11 +00:00
Karl Palsson 316b068cb4 [flash] f2: use "proper" bit definition naming.
Part 3 of 4: updated f2 to use flash_<reg>_bit instead of just
flash_bit
2013-01-23 13:58:11 +00:00
Karl Palsson 1eb4e6ed29 [flash] f1: use "proper" bit definition naming.
Part 2 of 4: updated f1 to use flash_<reg>_bit instead of just
flash_bit
2013-01-23 13:58:11 +00:00
Karl Palsson c0ea749452 [flash] l1: use "proper" bit definition naming.
Part 1 of 4: updated l1 to use flash_<reg>_bit instead of just flash_bit
2013-01-23 13:58:06 +00:00
Karl Palsson d9fb4f7401 Add examples making use of the RTC
Add an example using the RTC to help with a lower power design.  This is
a sister example to the existing "button-irq-printf", which is
functionally identical, but uses far less power.

There's more tricks that can be done to lower the power even further,
but this shows a few of the early steps that can be done, using the RTC
wakeup instead of a timer.
2013-01-23 00:01:46 +00:00
Karl Palsson e5b3250382 [stm32] Support the "new" BCD style RTC peripheral
Add the register definitions and some of the most basic helper functions
for the new style BCD RTC module found on the F2, F4, L1, F3 and F0.

This tries to keep as close to HACKING_COMMON_DOC as possible, while
maintaining sane names.
2013-01-22 23:55:59 +00:00
Karl Palsson b6ee57a5b9 [l1] rcc: support MSI clocking
Some new definitions and helpers.  Main change really that the list of
preconfigured clock configs is no longer restricted to HSI/PLL
2013-01-22 22:55:25 +00:00
Karl Palsson df5e3e5ff1 [l1] PWR: fix style for common code
Code added for L1 to support the PWR Control block didn't properly
follow the HACKING_COMMON_DOC guidelines.  The naming was wrong, and
some headers were missing.  This commit has no functional changes, it
only addresses the style and structure problems.
2013-01-22 22:55:19 +00:00
Karl Palsson 48eed286b9 [l1] fix whitespace and missing license info
Earlier additions to the L1 support were not correctly using linux
coding guidelines as specified in /HACKING.

Some examples were also missing license information.
2013-01-22 21:51:24 +00:00
Piotr Esden-Tempski 204eb047b4 Merging pull request #72 Doc
Merge remote-tracking branch 'ksarkies/doc'

Conflicts:
	doc/stm32f1/Doxyfile
	doc/stm32f2/Doxyfile
	doc/stm32f4/Doxyfile
	lib/stm32/f1/Makefile
	lib/stm32/f2/Makefile
	lib/stm32/f4/Makefile
2013-01-09 01:05:37 -08:00
Ken Sarkies efee94901a CRC moved to common area 2013-01-08 19:58:18 +10:30
Ken Sarkies e831f4db51 I2C to common area
F2/4 has now I2C3 included
2013-01-08 19:57:19 +10:30
Ken Sarkies 312d887825 IWDG moved to common area 2013-01-08 19:51:49 +10:30
Ken Sarkies 0878a534cd Move usart files to common area
Again added to L1 which is similar to F1
2013-01-08 19:51:08 +10:30
Ken Sarkies 1029597e70 Move DAC to common area
(Note there are now dummy source files dac.c (and others) that are
not compiled but are needed for documentation).
2013-01-08 19:50:22 +10:30
Ken Sarkies 7ec382c7d5 STM32: Moved SPI code into the common area.
Updated the documentation so that it appears in all families
Also added it to the L1 area, but is untested. An addition to the memorymap
allows commonality and a #ifdef added to the spi_common_all code to
exclude the case of SPI3 for L1 and F0 as SPI3 doesn't exist in those.
An rcc dispatch header was added to remove same code from the spi header.
2013-01-08 19:48:52 +10:30
Ken Sarkies 61f2cb3f99 Move STM32F1 DMA files to respective common directories
This sets the stage for adding DMA to STM32F3xx (when added) and STM32L1xx as the controller appears to be identical in these.
2013-01-08 18:07:28 +10:30
Ken Sarkies a60ae5044c STM32 DMA: replaced F4 header to match that for F2, and move header and source files to common.
In the header:
- Fix DMA_SxCR_CT: change shift from 18 to 19
For use with the convenience functions:
- Added DMA_SxCR_CHSEL generic values
- Added DMA_STREAM - generic values
- Added dma_if_offset - rather than separating out LISR and HISR
- Added masks
- Added dma_disable_double_buffer_mode()
2013-01-08 08:16:25 +10:30
Piotr Esden-Tempski 27ccf45182 Merging pull request #67 L1 support: flash, power basics, timers
Merge remote-tracking branch 'karlp/pr_l1_flash-rcc-pwr-timers'
2013-01-06 17:58:27 -08:00
Piotr Esden-Tempski 44e350ad20 Merging pull request #64 Various changes
Merge remote-tracking branch 'bgamari/master'
2013-01-06 17:56:13 -08:00
Piotr Esden-Tempski c904c3ae57 Merging pull request #63 Improvements to STM32F1 I2C, CAN, RCC, and USB (f107)
Merge remote-tracking branch 'icd/master'
2013-01-06 17:52:43 -08:00
Ben Gamari 08a14a9d9e stm32/f4/adc: DMA can always be used with ADC2
I can't find any evidence in the manual to support this comment's claim.
2012-11-14 20:07:28 -05:00