Commit Graph

550 Commits

Author SHA1 Message Date
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 3d3ddc7014 Fixed all warnings for examples. 2013-02-26 19:33:42 -08:00
Piotr Esden-Tempski 9c552e7585 Fix all remaining lib warnings. 2013-02-26 17:32:07 -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 80fd23580a Fix all warnings for stm32f1 lib. 2013-02-26 17:14:31 -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
Felix Ruess 3ef44bff54 [cm3] fix doxygen for systick_get_value, add systick_get_reload
Fix the reload value in the examples:
to get a SysTick interrupt every N clock pulses: set reload to N-1
see http://infocenter.arm.com/help/topic/com.arm.doc.dui0552a/BGBEEJHC.html#BABGACGG
2013-02-19 19:22:49 +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
Piotr Esden-Tempski b903ae75d8 Merging pull request #78 "Remove assembly forcing stack."
Merge remote-tracking branch 'karlp/destroy-all-the-asm'
2013-02-18 14:03:19 -08:00
Piotr Esden-Tempski daf4cc0feb Merging pull request #76 "LM4F clock api"
Merge remote-tracking branch 'mrnuke/lm4f_clock_api'
2013-02-18 13:53:57 -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
Karl Palsson 22d8891fee Remove assembly forcing stack.
Fixes #51

There should be no reason for manually trying to load the stack.  Cortex
devices can be programmed with only C, and any code that needed this
would indicate broken vectors.
2013-01-16 20:41:26 +00:00
chrysn 20bfcaeb1c efm32gg990f1024: added linker script 2013-01-10 11:42:32 +01:00
chrysn c243724676 platform-independent makefile: fix old "stm32" reference
the "make clean" target showed a constant "stm32/f1" debug message
instead of the current relative directory. this is fixed by showing the
relevant portion of the current directory instead, relevant being
determined by evaluating the current makefile's relative position and
stripping that part off.
2013-01-10 11:37:51 +01: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
Alexandru Gagniuc 7957cffaa3 lm4f: Add API for controlling the system run clock sources
Add an abstraction layer to handle the clock control for the run time clock on
LM4F (RCC). Sleep and deep-sleep clock configuration is not handled.

Complete documentation for the clock control API is included in doxygen-style
comments, and is included in [doc].

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

Conflicts:
	lib/lm4f/Makefile
2013-01-09 00:39:20 -06:00
Alexandru Gagniuc 03d04ad10a lm4f: Add API for enabling/disabling peripherals clock source
The enum definitions are specified in the form
 31:5 register offset from SYSCTL_BASE for the clock register
 4:0  bit offset for the given peripheral

The names have the form [clock_type]_[periph_type]_[periph_number]
Where clock_type is
     RCC for run clock
     SCC for sleep clock
     DCC for deep-sleep clock

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-01-09 00:37:50 -06: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 f83f8d55d7 Merging pull request #74 LM4F initial support
Merge remote-tracking branch 'mrnuke/lm4f_initial'
2013-01-06 18:09:21 -08:00
Piotr Esden-Tempski 1f9911e35b Merging pull request #69 Add __attribute__ ((naked)) to reset_handler()
Merge remote-tracking branch 'nfbraun/master'
2013-01-06 18:00:15 -08:00
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
Alexandru Gagniuc 60ceec0266 lm4f: Compile in the interrupt vector table
Add an "#ifdef(LM4F)" clause to include/libopencm3/dispatch/nvic.h
and lib/dispatch/vector_nvic.c. This compiles in the vector table
and allows interrupts to be used.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-31 01:35:27 -06:00
Alexandru Gagniuc c1381bf54a lm4f: Compile with FPU support
Specify the -mfloat-abi=hard and -mfpu=fpv4-sp-d16 flags so that FPU
is enabled by default.
While this compiles with FPU support, in order to use the floating point types,
the FPU must be explicitly enabled at runtime.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-31 01:35:27 -06:00
Alexandru Gagniuc b2ac2ffc4b lm4f: Remove erroneous references to lm3s
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-31 01:35:27 -06:00
Alexandru Gagniuc 326c945b55 lm4f: Add lm4f support files copied from lm3s
Create lm4f code infrastructure from the lm3s infrastructure.

As far as the interrupt table is concerned, don't create an irq.yaml. Just
include the LM3S nvic.h. The LM3S vector table seems to be compatible with the
LM4F

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-31 01:35:25 -06:00
Norbert Braun 569ebfdffb Add __attribute__ ((naked)) to reset_handler() 2012-11-28 15:28:42 +01: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
Karl Palsson 523943a3d2 [l1] Add common timer code support.
This has only been tested functionally with basic timers, and basic operations.
Advanced timer support has been #ifdefed to compile, but this probably needs more testing.
2012-11-14 00:27:13 +00:00
Karl Palsson df1808e2dc [l1] Add rcc clock setup helper routines
Despite the L1 being a low power device, my initial focus is on making
it basically compatible with existing devices.

To that end, provide clock setup helper routines that configure it for maximum performance,
allowing some similar clock speeds to F1 devices to help with testing. This requires adding
the power chipset routines to set the voltage range.

Clock setup style is similar to the F4 code, which seems nicer than the overflow of different
routines used on the F1 code.

NOTE: Both the F4 existing pwr code, and this code don't actually include the f1 core power
code, even though it should be compatible
2012-11-14 00:16:56 +00:00
Karl Palsson 72666a5b93 [l1] Add Flash Memory Controller Register defns for L1.
Also, some of the most basic essential helper functions.
2012-11-14 00:16:46 +00:00
Jeff Ciesielski db35fbb7ba Merge branch 'master' of git://github.com/libopencm3/libopencm3 into upstream-merge 2012-11-13 13:13:40 -08:00
Ken Sarkies 70746ccd67 Change to make L1 series fit with common files 2012-11-13 18:43:06 +10:30
Ken Sarkies 7d55ebbe0c Adjustments to fix documentation 2012-11-13 18:41:31 +10:30
Ken Sarkies e34ad9b3d2 rebase and fix 2012-11-13 18:41:31 +10:30
Ken Sarkies 4ab5c94b90 Proposed deduplication of peripherals, GPIO example
See rambling post on dev list for justification
2012-11-13 18:41:31 +10:30
Piotr Esden-Tempski d08d366e75 [doc] Added preliminary STM32 CAN documentation. 2012-11-12 15:43:45 -08:00
Piotr Esden-Tempski b2af3ca540 [doc] Cosmetic. 2012-11-12 15:14:06 -08:00
Piotr Esden-Tempski d64ec3cf58 Merge pull request #62 "Documentation updates for new devices"
Merge remote-tracking branch 'ksarkies/doc'
2012-11-12 14:11:46 -08:00
Ken Sarkies 35c0863a75 Documentation updates 2012-11-12 21:44:52 +10:30
Piotr Esden-Tempski f714ee42c0 Merging pull request #60 Miscellaneous DMA fixes for F4
Merge remote-tracking branch 'bgamari/master'
2012-11-08 12:04:28 -08:00
Ben Gamari 9fea26e455 stm32/usart: Add enable_/disable_error_interrupt 2012-11-08 14:54:41 -05:00
Ben Gamari 095e6cdb5d stm32f4/dma: Fix cut-and-paste error 2012-11-08 12:20:36 -05:00
Ben Gamari 2fe567e25d stm32f4: Add dma.o 2012-11-08 12:12:59 -05:00
Karl Palsson d417666095 Eliminate redundant gpio code from f2/f4/l1
Implemented as per exti2
2012-11-07 21:58:16 +00:00
Karl Palsson ce8f47e7df Enable nvic and exti support for L1
And include an example that uses it.
2012-11-07 21:54:18 +00:00
Karl Palsson 25acaa5878 Add usart support for L1.
Only tested with basic tx blocking, ie, the same example code as on
F2/F4, but the description of the block is almost identical.
2012-11-07 21:50:27 +00:00
Karl Palsson 4941286454 STM32L1 support, rebased onto upstream generalizations branch.
Working example again.
2012-11-07 21:50:27 +00:00
Karl Palsson e4f84278f2 Add most of the rcc functions.
(Add the forgotten gpio.c file from before)
2012-11-07 21:50:27 +00:00
Karl Palsson 8318384cf1 More progress towards L1 support.
Believe gpio is complete, but untested without finishing at least the
RCC defines.

RCC defines are a work in progress
2012-11-07 21:50:27 +00:00
Karl Palsson 2011941b55 Vectors and Memory Map for STM32L1 series 2012-11-07 21:50:27 +00:00
Andrey Smirnov 720e85f850 Further re-factor USB string handling code
This commit refactors USB string code, making it, hopefully, less
buggy and more easier to understand. It also removes "magic" bit
manipulation and "magic" numbers;
2012-11-07 11:30:44 -08:00
Andrey Smirnov c5c4db0196 Extend control hook framework
This commits adds a new error code that can be return from a
registered control callback: USBD_REQ_NEXT_CALLBACK. This return code
signifies that the callback is done processing the data successfully,
but user would like to have all matching callbacks down the callback
chain to be executed too.

This change allows for example to intercept standard requests like
GET_DESCRIPTOR, do some small action upon receiving of one, but still
have the standard callback executed and do it's job. This way user
doesn't have to re-implement standard GET_DESCRIPTOR functionality if
they want to intercept that request to do some small thing.
2012-11-07 10:33:51 -08:00
Andrey Smirnov 12e1786863 Add a desig_get_unique_id_as_string
This commit adds desig_get_unique_id_as_string which is useful if one
wants to use device ID as USB serial number(iSerialNumber), for example.
2012-11-06 16:48:40 -08:00
Andrey Smirnov 7a5da60e26 Change USB strings handling code
This commit add an extra field to the _usbd_device, that allows to
keep track of the number of USB strings  which allows simplify
boundaries checking code in usb_standard_get_descriptor.

This commit also changes the index base for strings in
usb_standard_get_descriptor which allows to get rid of necessity to
have a dummy one-character string in a strings array.
2012-11-06 16:46:55 -08:00
Jeff Ciesielski 6c41c808c3 stm32/f1/can: Add clearing of can timing bits on init
This corrects a bug introduced with the addition of allowing loopback
and silent parameters in the init function.
2012-11-01 18:02:11 -07:00
Jeff Ciesielski fa1d5f8e43 stm32/f1/can: clean up can_available_mailbox ->fewer 'if' statements 2012-10-31 17:03:26 -07:00
Piotr Esden-Tempski 507a1742dc Merge pull request #57 F2/F4 timer merging action
Merge remote-tracking branch 'tdaede/f4-timer'
2012-10-31 13:47:54 -07:00
Piotr Esden-Tempski def9b9f381 Added new f4 adc module to the library makefile. 2012-10-31 13:39:24 -07:00
Piotr Esden-Tempski f5df25d6de Merge pull request #55 STM32F4: New adc module
Merge remote-tracking branch 'ksarkies/adc-f4'
2012-10-31 13:38:51 -07:00
Piotr Esden-Tempski 60aa32e2b9 Merge pull request #53 CAN fixes
Merge remote-tracking branch 'tdaede/master'
2012-10-31 13:37:19 -07:00