Commit Graph

1917 Commits

Author SHA1 Message Date
Matthew Lai 4af374f7c4 .gitignore Sublime workspace file 2017-03-27 10:59:43 +00:00
Karl Palsson 04fa5f1cb5 readme: try and clarify m0/m3/m4
Not just m3, and add some newer parts while we're here.
2017-03-16 23:57:29 +01:00
Matthew Lai 4a378a729a devices.data: stm32f7: added all STM32F7 chips (as Feb, 2017) 2017-02-28 16:57:28 +00:00
Matthew Lai 62b58555e2 stm32: rcc: added missing ifdef for STM32F7 in rcc 2017-02-28 16:57:20 +00:00
Matthew Lai b1839265f9 stm32: syscfg: fixed copy and paste error in comment 2017-02-28 16:57:09 +00:00
Seven Watt 8a62618a63 stm32l0: add exti to makefile
Tested with a Lora radio application that used three GPIO lines to send
different interrupts from the radio module to the L052. Tested with a
Jeenode Zero Rev1
2017-02-17 09:43:01 +00:00
Lixing Ding 13fe431919 stm32: timer: fix TIM_CCMR2 definitions
CC3S and CC4S channel names were badly copy/pasted from CCMR1
2017-02-15 09:55:24 +00:00
Karl Palsson ed3cbffc2a cm3/sync.h: Add DECLS to allow use with c++
Reported by vvirag on IRC. Diagnosed and fixed by zyp on IRC
2017-01-27 17:08:37 +00:00
Dave Hylands 755ce402e2 stm32:desig: Add DFU compatible serial generation
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
Modified to provide better doxygen and consistent api names.
2017-01-10 23:07:00 +00:00
Karl Palsson 5bf61c537f trivial: stop referring to STM32F when we mean all 2017-01-10 23:06:59 +00:00
David Sidrane cf80e2bd5e stm32f4: USB support for newer OTG cores
Support for the  conflicting bit definitions for vbus sensing on core id
version 0x2000+

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2017-01-10 22:32:20 +00:00
Karl Palsson 6b5edeb091 docs: note dynamic linker generator requirements
Interim fix.  See https://github.com/libopencm3/libopencm3/issues/732
and https://github.com/libopencm3/libopencm3/pull/731
2016-12-27 21:47:12 +00:00
Karl Palsson 1963f3296f stm32:ethernet: drop outdated broken include file.
Use  #include <libopencm3/ethernet/mac.h> instead of
stm32/ethernet.h

MAC peripherals are not stm32 specific, and are more like USB.

Fixes #729
2016-12-20 11:03:43 +00:00
Karl Palsson cd9ae5e6d7 eeprom: drop support from linker scripts.
While the NOLOAD variant sometimes worked with some toolchains, the
version in the generator scripts could never work, as neither the
startup code, nor gdb know how to load those sections properly.

Originally added in: eb18cc19cb

The original scripts allowed you to place variables in eeprom space for
reading only.  However, the last toolchain that generated working code
with this linker script was the gcc-arm-none-eabi-4_9-2014q4 release.
Subsequent releases treat the directives differently, and can lose track
of where variables are.  One known symptom is constants getting bad
addresses, so for instance, "printf("asdfad")" will end up passing the
wrong address of the string constant into the eventual _write() call.

This commit removes the problematic directives until a more fully
correct system can be found that more properly follows the linker
script rules.
2016-12-19 11:40:39 +00:00
Karl Palsson 950e064885 stm32l1: flash: avoid duplicate calls to unlock_pecr
Attempts to helpfully unlock PECR when required in unlock_progmem and
unlock_option_bytes actually cause a bus error due to repeated unlocks,
as per ref manual and tedious experience.  The better tested eeprom helper
routines unlock/lock in chunks, but that's not applicable for flash
writing.

Fixes: cf5fb002f6
2016-12-19 11:36:20 +00:00
Henning W f974861cba cm3: SCB on M0/M0+ has SHCSR and DFSR regs too
SHCSR and DFSR are only implement on ARMv6 if the "Debug extension" is
implemented, but that's pretty much everywhere, so allow access to the
defines.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2016-12-17 01:01:40 +00:00
Karl Palsson 7c3d39fda4 stm32l0: rcc: fix definition of RCC_CSR_RTCEN bit
Fixes https://github.com/libopencm3/libopencm3/issues/720
2016-12-08 10:44:32 +00:00
Karl Palsson 31eac1b787 makefile: make it easier to disable targets.
Sometimes you're working on a subset of targets, and want to do full
clean/builds, but don't need to clean and rebuild families you're not
working with.  This is a pure syntactic change that makes it easier to
simply comment out lines for targets, instead of having to mangle line
continuations.
2016-12-01 15:56:51 +00:00
Karl Palsson da91794f52 stm32: rcc: Rationalize MCO definitions
Some parts used HSICLK, some used HSI.  Most used NOCLK, f3 used
DISABLED.  Try and move all to the shorter, simpler forms, instead of
having mixed defines for different targets for the same thing.  Just
because the bits themselves are different doesn't mean we should make it
more difficult for users to port code.
2016-11-29 15:06:19 +00:00
Karl Palsson 29602c94c1 stm32l4: rcc: Fix MCO Prescaler shift
Transcription error from ref manual I presume.
2016-11-29 14:56:57 +00:00
Karl Palsson 4130064318 stm32l1: rcc: use mask/shift consistently for MCO
MCOPRE prescaler definitions used a _SHIFT and a preshiftd definition.
The rest of the file uses separate _MASK and _SHIFT definitions.

Fix whitespace on the definitions while we're here.
2016-11-29 14:25:12 +00:00
Karl Palsson 825b51a6a8 usb: dwc_otg: fix missing includes
Went awol merging something :(
(Yes, dwc_otg is theoretically shared with efm and co, but at present
it's still pretty much the stm32 version)

Fixes: 422d708384
2016-11-21 17:27:43 +00:00
Karl Palsson 422d708384 usb: dwc_otg: enable clocks automatically.
ST usbfs-v1, v2, EFM32 USB, lm4f usb all automatically enable the clock
in their _init routine.  Do the same for the dwc_otg drivers to be
consistent.
2016-11-21 17:17:32 +00:00
Devan Lai 011b5c615a cm3/fpb: Fix overly strict ARMv7 check 2016-11-05 13:54:09 -07:00
fenugrec 8c74128ff6 usb: st_usbfs_v2: allow unaligned buffers for st_usbfs_copy_from_pm()
The previous implementation of copy_from_pm assumed the destination buffer
was aligned on a 16-bit boundary. On M0/M0+ cores (stm32F0*, stm32L0*)
this causes a hard fault.
This implementation is from Kuldeep Dhaka's tree; it does a 16-bit copy
only if the destination buffer is aligned, otherwise a bytewise copy.

Fixes GH issues #401, #461
2016-10-01 15:46:38 +00:00
fenugrec c3512f4de5 tests: gadget0: test for unaligned buffer read/writes.
This currently fails on stm32F072, which is expected but not normal.
See GH issues #401 , #461
2016-10-01 15:46:33 +00:00
Karl Palsson c585336766 tests: gadget0: pull up endpoint size constant 2016-10-01 15:15:36 +00:00
Karl Palsson 9a856960cf usb: st_usbfs_v2: fix documentation on copy_from_pm 2016-10-01 15:15:05 +00:00
Urja Rannikko 62b02c515f usb: Simplify TOG_SET_REG_BIT_MSK_AND_SET
A xor B with B=0 is A, thus this should be correct and faster.
2016-10-01 00:15:22 +00:00
Karl Palsson 599dd43190 stm32: adc-v2: fix typo in doxygen link
Missed in rename post review.
2016-09-13 16:34:00 +00:00
Karl Palsson 3add0d2054 stm32f1: drop leftover ethernet files
The f107 ethernet peripheral is the same as in f4, and was pulled out
into lib/ethernet/mac_stm32fxx7.c in 52758bb8fd

This drops the duplicate code.
Fixes Github issue #694
2016-09-12 23:30:53 +00:00
Karl Palsson 9a0b07d4de stm32f1: adc: standardize temperature sensor API
The TSVREFE bit is defined to only be present on ADC1, so drop the
pointless adc argument.  This has the added benefit of making the
API consistent with all other STM32 adc parts.
2016-09-12 23:29:32 +00:00
Karl Palsson cda59c3855 stm32f1: adc: remove confusing "adc_on" function
This is _similar_ to adc_power_on, the common name, but has been marked
deprecated since 2012.
2016-09-12 23:29:28 +00:00
Karl Palsson d035a9cd39 stm32f1: adc: use common api for calibration routines
Use same names as adv-v2 peripheral uses. F1 is the only v1 peripheral
adc that has calibration modes at all.

Old:
	adc_calibration(ADC1);  // blocking call

New (blocking):
	adc_calibrate(ADC1);

New (asynch):
	adc_calibrate_async(ADC1);
	// do stuff
	adc_is_calibrating(ADC1);  // false when calibration finished

Old routines are preserved but marked deprecated for now.
2016-09-12 23:29:21 +00:00
Karl Palsson 23cf491501 stm32: adc-v2: extract common calibration code
Extract the calibration code from the f0, and share it with the other
adc-v2 peripheral users (f0,l0,f3,l4)

Uses the same naming set of is/async naming conventions requested by the
RTOS guys instead of having blocking only calls.

Old code:
	adc_calibrate_start(ADC);
	adc_calibrate_wait_finish(ADC);

New code (blocking):
	adc_calibrate(ADC);

New code (asynch):
	adc_calibrate_async(ADC);
	// do stuff
	adc_is_calibrating(ADC);  // will be false when it's finished.

Old code for f0 is still available, but marked deprecated.
2016-09-12 23:29:12 +00:00
Karl Palsson c2e0afdb05 stm32: adc-v2: don't try and disable adc powered off
As per ref manual, you're not allowed to attempt to disable the ADC if
it's not presently enabled.

Fixes github issue #654
2016-09-09 21:35:18 +00:00
Karl Palsson 571a4cff17 devices.data: stm32l0: add new devices 2016-09-09 21:22:02 +00:00
Karl Palsson ec22543ce8 .gitignore .pyc files 2016-09-02 21:10:30 +00:00
Marcus Hultmark Varejao 6e87892a7e stm32f4: rcc: fix setup of main system clock with pllp
Fixes: 57c2b00a69

There was an issue with the pllp value calculation where the masking was done
in the wrong place. The pllp value was always equivalent to 2 (the bits were
always set to 0b00) which could result in an undesired system clock frequency.
2016-09-02 10:33:27 +02:00
Karl Palsson 6c034c8981 stm32f4: rcc: fix compilation error missed in testing
Fixes: 57c2b00a69

Running make for final sanity failed to catch this due to jobserver
issues.  *fumes*
2016-08-23 22:13:33 +00:00
Chuck McManis 57c2b00a69 stm32f4: rcc: support new plls for new f4 parts
Revise the PLL inits to support new and old PLL configurations,
particularly to support F4x9 devices.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2016-08-23 22:02:12 +00:00
Karl Palsson 095ed8511a stm32l1: rcc: reliably clock up/down
When changing the system clock, you must take care to not exceed the
legal ranges based on voltage and flash wait states.

Existing code made it possible to provide a valid clock structure, that
would run out of bounds temporarily.  Some boards would crash with
various Usage faults / Bus errors due to this.
2016-08-19 11:34:46 +00:00
Karl Palsson 0869e15718 stm32f3: adc: drop unimplemented dead code.
These functions have existed since the initial commit, fallout from
copying an existing file and then trying to implement functions as
needed.  F3 ADC doesn't have corresponding functions for some of these,
and this dead code should never have landed.  Dropping it for clarity,
and also to stop confusing doxygen.
2016-08-18 23:55:11 +00:00
Karl Palsson 74b228f3a8 doc: stm32f3: drop duplicate group opening
Just a bad syntax error that slid in somewhere.
2016-08-18 23:54:48 +00:00
Karl Palsson 41fa001620 doc: adc: fix syntax and missing groupings 2016-08-18 23:51:49 +00:00
Karl Palsson c09ebbc956 doc: stm32f3: exclude unused common files 2016-08-18 23:51:49 +00:00
Karl Palsson 75011168f7 doc: stm32: fix doxygen syntax
Missing endgroups, some accidental syntax errors/unknown commands.
2016-08-18 23:51:49 +00:00
Karl Palsson 34c3a64177 doc: stm32l power: properly include and document
Was missing group markers.
2016-08-18 23:51:48 +00:00
Karl Palsson 3cc6ecd203 doc: stm32l1: exclude unshared common code
Fixes Github issue #458
Fixes Github issue #300
2016-08-18 23:51:32 +00:00
Karl Palsson 08aac020ad stm32: rcc: provide async routines for osc checks
Start providing async routines for all blocking routines, to make it
easier to use libopencm3 in some RTOS environments.  This is not in
anyway intended to be complete, this just covers a single blocking
routine, rcc_wait_for_osc_ready.  Documentation added to the top level,
and provided for all stm32 families.
2016-08-18 23:41:04 +00:00