467 Commits

Author SHA1 Message Date
Oliver Meier
4b8f5e613b [stmf4-ltdc] added 3 spaces 2015-02-05 16:44:38 -08:00
Oliver Meier
3c9b07d776 [ltdc-stm32f4] add helper function to convert rgb565 to rgb888 2015-02-05 16:44:38 -08:00
Oliver Meier
c26831fab0 [stm32f4-stdc] fixed includes 2015-02-05 16:44:38 -08:00
Oliver Meier
eaae7731e9 [stm32f4-ltdc] initial commit 2015-02-05 16:44:38 -08:00
George McCollister
418fdd08dd usb: Prevent RX_CTR and TX_CTR from being cleared
When writing the USB endpoint register, USB_EP_RX_CTR (bit 15) and
USB_EP_TX_CTR (bit 7) should be set to avoid inadvertently clearing
either bit.

Prior to this patch end points could indefinately stall if the hardware
changed these bits between the time they are read and when they were
written.

Signed-off-by: George McCollister <george.mccollister@gmail.com>
2015-01-02 19:01:16 +00:00
George McCollister
9eb551c127 tools: Added *REG_BIT_MSK_AND_SET macros
Added CLR_REG_BIT_MSK_AND_SET and TOG_SET_REG_BIT_MSK_AND_SET because we
need version of CLR_REG_BIT_MSK and TOG_SET_REG_BIT_MSK that allow us to
OR in bits before the register is written.

Signed-off-by: George McCollister <george.mccollister@gmail.com>
2015-01-02 19:01:07 +00: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
Karl Palsson
c09d2583dd stm32: f4: Add FLASH_OPTCR1 definition
This is required for stm32f42xx and stm32f43xx with second bank options.
2014-12-17 17:26:25 +00:00
Chuck McManis
14ad92015e Audit RTCPRE Shift and Mask Values
L0 - RTC Prescaler appears in RCC_CR, bit 20, 2 bits wide (RM0367 Rev 2)
L1 - RTC Prescaler appears in RCC_CR, bit 29, 2 bits wide (RM0038 Rev 10)
F0 - no prescaler setting (RM0091 Rev 7)
F1 - no prescaler setting (RM0041 Rev 4)
F2 - RTC Prescaler appears at RCC_CFGR, bit 16, 4 bits wide (RM0033 Rev 6)
F3 - no prescaler setting (RM0316 Rev 3)
F4 - RTC Prescaler appears at RCC_CFGR, bit 16, 4 bits wide (RM0090 Rev 8)
2014-12-14 16:29:03 -08: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
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
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
Karl Palsson
3a44b1311b stm32: f1: Additional GPIO Remappings for F100
F100 has more remap options than F10x, particularly on the High Density
devices.

Fixes github issue #365

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2014-11-21 10:38:03 +00:00
Karl Palsson
fb95997b3b stm32f1: rcc: timer 15,16,27 rcc bits missing for old style
The bits definitions for direct manipulation were missing, and should be
present for completeness.  However, this only affects the legacy (error prone)
API, replaced some time ago.

old and error prone: (stop using code like this)
    rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_TIM16EN);
    rcc_peripheral_reset(&RCC_APB2RSTR, RCC_APB2RSTR_TIM16RST);

new:
    rcc_periph_clock_enable(RCC_TIM16);
    rcc_periph_reset_{pulse,hold,release}(RCC_TIM16);

Fixes github issue #361
2014-11-14 22:32:49 +00:00
Frantisek Burian
eee5a45019 [stm32l0] Integrate the L0 architecture to the doxygen documentation
Conflicts:
	doc/Makefile
2014-10-15 19:33:20 +02:00
Frantisek Burian
f9152eb00a [stm32l0] Initial support for STM32L0 architecture, Add GPIO peripheral 2014-10-15 19:31:41 +02:00
Freek van Tienen
ac8ac8c64d [f4] Added a 25mhz clock 2014-10-15 17:27:18 +02:00
Geoffrey Hausheer
4ff07df7b2 stm32: Add timers 9-17. This should support all F0, F1, and F2 products 2014-10-07 11:23:52 +00:00
Karl Palsson
5d4437fe43 stm32/spi: Replace all SPIx_I2S_BASE with SPIx_BASE
Latest versions of all reference manuals refer to the address as SPIx_BASE, and
simply name some of the individual registers as SPI_I2SXXXX.  Likewise, the
interrupts are simply SPIx, not SPIx/I2Sx.  Rather than hacking more duplicates
into the F0 and L0 parts where this was turning up, remove the pointless _I2S_
from SPI2/SPI3 and make it all consistent

Compile tested only, with the examples collection.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>

Fixes #331
Fixes #347
2014-10-07 11:21:40 +00:00
Karl Palsson
2211944233 stm32: exti: Define all irqs in common header.
There's more exti lines on many more devices now. F0 and F3 have extras, as did
L1 and L0.  There's no real reason not to have higher order EXTI definitions
defined at the top level, and it reduces the number of files to merge together
to find all definitions for the bigger devices.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>

Fixes #338
2014-09-30 22:32:52 +00:00
Karl Palsson
cf5fb002f6 [l1-flash/eeprom] Add lock/unlock/eeprom helper routines 2014-07-14 17:54:20 +00:00
Karl Palsson
67b538a540 usb/stm32: Add top level commentary for scope
Remove some unncessary commentary and fixed bit fields introduced earlier via
insufficient review.
2014-05-25 19:54:06 +00:00
Roger Wolff
c07a1291f4 usb/stm32 added NOVBUSSENS bit definitions 2014-05-25 19:45:52 +00:00
Roger Wolff
5c5c77d4dc stm32/f0: DMA base address compatibility tweak 2014-05-25 19:35:20 +00:00
Felix Ruess
67242de60d [f3] add USART_SR_x defines for common status flags
enables the use of usart_get_flag(USARTx, USART_SR_x) on F3 just like on F124

closes #283
2014-04-09 16:41:20 +02:00
Karl Palsson
d839ce41f6 stm32f1: Fix RCC CAN defines
Thanks to Марко Краљевић <krasnaya.zvezda@gmail.com>
2014-04-08 18:51:26 +00:00
Karl Palsson
cb33acc32a stm32f1: Add missing peripheral base address for F100 2014-03-31 13:56:50 +00:00
Ken Sarkies
1f5ce647ff stm32: adc.h regression: Add missing register definitions
The adc unification pull left out some of the shortcut definitions for
ADC1.  See 27bc12de61f8c75425efcf8a61d8ca4a5e4b01b5
2014-03-12 09:27:56 +00:00
Nikolay Merinov
ec29bd7f48 stm32l1: lcd: Basic LCD configure functions. 2014-03-11 21:44:48 +00:00
Nikolay Merinov
553a14f21d stm32l1: lcd: Define all LCD registers
Define minimal susbet of necessary functions for work with LCD screen.
2014-03-11 21:44:48 +00:00
Frantisek Burian
bf01d890f6 [STM32F0] Add support for timers.
This commit has been based on kuldeepdhaka's pioneer work, but it was reformatted to apply libopencm3 inclusion tree correctly.

timer_common_all.c now supports new rcc_periph_reset_pulse function for all families.
2014-03-11 16:49:01 +00:00
Ken Sarkies
7816501dbc Changes to the header includes for all STM32 peripherals
to remove variations, redundancies, add missing, fix errors. All c files
refer only to the dispatch style headers in /include/stm32. Those headers
#include memorymap.h and cm3/common.h. All references to
these are removed from the family specific headers. Ethernet untouched as
it appears incomplete.

Added dummy spi.c for F0/F3. Fix some doxygen anomalies.
2014-03-11 16:40:31 +00:00
Frantisek Burian
0d08891c8d [stm32f1] Fix bad RCC_ definitions for issue #77 2014-02-24 18:44:12 +00:00
Frantisek Burian
09fcb14f74 [F0] Add new irq's
Be warned that this commit changes names of some old definitions. This may broke old code !
2014-02-07 07:46:54 +01:00
Frantisek Burian
9c0ca88c2e [F0] Update CRCto be compatible wih RM0091 Rev. 5 2014-02-07 07:46:54 +01:00
Frantisek Burian
fc9a7260c2 [F0] Add new peripheral Clock Recovery Subsystem as defined in RM0091 Rev. 5 2014-02-07 07:46:54 +01:00
Frantisek Burian
f244bc87dd [F0] Adapted USB to be compatible wih RM0091 Rev. 5 2014-02-07 07:46:53 +01:00
Frantisek Burian
55750d5dc6 [F0] Updated RCC module to be compatible wih RM0091 Rev. 5 2014-02-07 07:46:53 +01:00
Frantisek Burian
c2f73b9524 [F0] Updated Uart module to be compatible wih RM0091 Rev. 5 2014-02-07 07:46:53 +01:00
Frantisek Burian
8b0a591ca5 [F0] Updated memorymap.h to meet RM0091 Rev. 5 2014-02-07 07:46:53 +01:00
Frantisek Burian
8d5ad52e0f Fix the stm32f0 evident bugs 2014-02-06 11:23:01 +01:00
Stefan Agner
7681597e42 Use type suffix to avoid warnings
When compiling with all warnings enabled, some defines can lead to
warning due to missing unsigned type suffix:

warning: integer overflow in expression [-Woverflow]

This fix should not affected behavior at all, since calculation with
such overflows lead to the same actual address when writing to that
location. However, it makes the warning disappear and also defines
the right data type for a memory location.
2014-02-06 00:59:39 +01:00
Ken Sarkies
0af6d06eda Deduplication of flash code for STM32F0 and F1.
Extension of code for STM32F1 to allow for dual bank series XL.
Small changes to documentation for F2, F4 and L1 to add a parameter reference.

Tested with STM32F103RBT6
(note: tests show that the PG bit must be cleared after programming, otherwise
a subsequent erase attempt fails. This has been added to flash_program_half_word
for F0 and F1 only. A fix for the other families is not included in this PR.)
2014-02-06 00:52:42 +01:00
Frantisek Burian
a4d9a41093 [Style] Don't use editor droppings in files, please. 2014-02-06 00:46:05 +01:00
cmcmanis
07d0076934 Updates for STM32F429 chip
After a few rounds of review, changes are added to support
additional peripherals of the STM32F427/429
2014-02-06 00:41:52 +01:00
Karl Palsson
27bc12de61 stm32: unify bulk of adc convenience functions
This unifies stm32f1, l1, and f4 convenience functions for adc.  The code
should be useable for f2 and f37x as well, but that needs hardware for testing,
and there was no existing implementation. This is the reason for the
"adc_common_v1.c" name, as trying to put all the different families into the
common file name has become too cumbersome.

All of the deprecated routines have been dropped, they've been marked
deprecated for a very long time now, and porting them seemed unnecessary.

This has been tested on f1, l1 and f4 discovery boards, and is based on some
existing l1/f1 unification code from
https://github.com/karlp/libopencm3/tree/rme_l1_master
2014-02-05 10:39:00 +00:00
Karl Palsson
3eaeaf693c stm32: ADC peripheral style 1 header unification
This pulls out all the common header definitions for the F1, L1, F4 and F37x
parts.  It's verified against the datasheet for F2 as well, but we don't have
any good F2 test boards or any support for that yet.  (The F2 header would be
_exactly_ the same as the F4 header, so it's a target for a future round of
unification, not this one)

Tested with f1, f4 and l1 examples from the examples repository.
2014-02-05 10:38:45 +00:00