Joakim Nohlgård
c2ccc1bfa0
kinetis: Fix ADC clock computation
...
The ADC prescaler computation was broken and gave too high ADC clock for
module clocks slower than 32 MHz (the >32 MHz case is already handled
separately)
2016-12-27 17:10:25 +01:00
f44763f346
make: adapt Makefiles to AD -> Q rename
2016-12-22 12:12:38 +01:00
Hauke Petersen
3a00fe8e49
cpus: make use of cortexm_isr_end()
2016-12-21 11:28:46 +01:00
Hauke Petersen
2eebf36eb2
cpu/uart: make use of named return values
2016-10-28 10:32:00 +02:00
560a509036
make: remove trailing slash from BINDIR variable
2016-10-18 23:27:59 +02:00
Kees Bakker
bac5cda1e3
periph/i2c: convert char to uint8_t where applicapable
...
In general, data transferred through I2C are bytes and thus should have
type uint8_t, not char.
Also convert uint8_t ptrs to void ptrs
2016-10-04 20:26:39 +02:00
Joakim Nohlgård
1a2b2575fb
kinetis: Add stddef, stdint missing includes for gpio.c
2016-09-29 15:47:53 +02:00
Joakim Nohlgård
8947a3c49c
cpu/kinetis_common: Add debugging messages to i2c driver
2016-08-10 19:40:39 +02:00
Joakim Nohlgård
5633af4300
cpu/kinetis_common: Update periph_timer to support both LPTMR and PIT
2016-07-07 13:38:27 +02:00
Ian Martin
49ae438dd5
doc: eliminate clutter in adc and gpio periph docs
2016-06-29 15:08:32 -04:00
zhuoshuguo
1cbe79a373
CPU: fix include header guards
...
Fix cpu/lpc2387/include/lpc2387.h
2016-06-08 16:38:20 +02:00
Joakim Nohlgård
8c154d47ad
cpu/kinetis_common: Implement DAC periph driver
2016-03-22 06:06:56 +01:00
Hauke Petersen
4938142b42
cpu/kinetis: adapted GPIO driver
2016-03-17 14:55:30 +01:00
Johann Fischer
0b2ffc212d
Merge pull request #5075 from jfischer-phytec-iot/pr@kinetis-i2c
...
cpu/kinetis_common/periph/i2c.c: fix generating the STOP signal
2016-03-17 12:53:24 +01:00
Joakim Nohlgård
65bb26f0b4
cpu/kinetis_common: Use gpio_init_port for PWM pin handling
2016-03-14 17:52:51 +01:00
Johann Fischer
db2506822f
cpu/kinetis_common/periph/i2c.c: fix generating the STOP signal
...
This patch fix the bug in _i2c_receive. The STOP signal should be
generated before the reading from the data register because the
receiving of the next byte will be initiated by reading
the data register (dev->D).
2016-03-14 14:53:59 +01:00
Hauke Petersen
3990bd84e7
cpu/kinetis_common: reworked ADC driver
2016-03-14 13:06:23 +01:00
Peter Kietzmann
c8829a49b8
Merge pull request #4838 from haukepetersen/fix_periph_timerarg
...
drivers/timer: added callback argument
2016-03-01 08:55:54 +01:00
Hauke Petersen
b11a3ad74b
cpus: adapted timer implementations to API changes
2016-02-29 14:45:00 +01:00
Hauke Petersen
34f9deecb7
cpu/kinetis_common: reworked GPIO driver
2016-02-29 11:08:45 +01:00
Joakim Nohlgård
e2f7ac78f0
Merge pull request #4040 from gebart/pr/periph-timer-init-freq
...
periph/timer: Change timer_init API to support arbitrary (integer) frequencies
2016-02-15 23:36:44 +01:00
Hauke Petersen
6f0179ce69
cpu/kinetis_common: adapted HWRNG implementation
2016-02-14 12:59:46 +01:00
Joakim Nohlgård
d2b06d1923
cpu/kinetis_common: Update timer_init to match API change
2016-02-13 21:29:36 +01:00
Hauke Petersen
fecf74970e
cpu/kinetis_common: adapted to PWM interface changes
2016-02-12 16:10:01 +01:00
Joakim Nohlgård
3db00667b7
cpu/kinetis_common: Use a different module name to prevent linker races in Travis
2016-02-12 08:45:56 +01:00
Hauke Petersen
cfcf951b9d
cpu/kinetis_common: fixed null ptr ref in gpio.c
2016-02-09 16:22:25 +01:00
Hauke Petersen
5cac36d5b3
cpu/kinetis_common: moved drivers to periph subdir
2016-02-09 16:20:03 +01:00
Hauke Petersen
975e027360
cpu: use Hauke's correct email address
2016-02-09 16:09:40 +01:00
Hauke Petersen
d80a661486
Merge pull request #4761 from haukepetersen/opt_cpuid
...
drivers/cpuid: fixed and unified CPUID driver implementations
2016-02-08 18:18:53 +01:00
Hauke Petersen
940097336a
cpu: cleanup and unification of CPUID implementations
...
- moved definition of CPUID_LEN to periph_cpu.h
- fixed some doxygen
- simplyfied some implementations
2016-02-08 14:36:03 +01:00
Joakim Nohlgård
309cd5ef58
cpu/kinetis_common: Add __attribute__((used)) to flash configuration field
2016-02-08 13:07:52 +01:00
Hauke Petersen
476167a86c
cpu: fixed any doxygen warning realated to 'periph'
2015-11-19 16:08:38 +01:00
Cenk Gündoğan
0792450dd7
cpu: kinetis_common: remove vtimer include from spi.c
2015-11-11 09:03:12 +01:00
Joakim Nohlgård
142c28094e
kinetis_common: Refactor GPIO implementation
...
This is a rewrite of the Kinetis GPIO driver which follows the
refactored API in [1]. Pins are specified using the GPIO_PIN(PORT_x, y)
macro, e.g. GPIO_PIN(PORT_E, 25) for the PTE25 pin.
The interrupt pin handling is now implemented as a linked list, this
is more memory efficient, but with a minor variation in interrupt
latency depending on in what order the pins were initialized at
runtime.
Because the linked list entries are taken from a shared pool, there is
also the possibility of running out of available configuration slots,
define the preprocessor macro GPIO_INT_POOL_SIZE in periph_conf.h if
you need more than 16 pins configured for interrupts in the same
application.
[1]: https://github.com/RIOT-OS/RIOT/pull/3095
2015-10-28 14:12:19 +01:00
Hauke Petersen
c7d256d83e
cpu/kinetis_common: adapted UART driver
2015-10-27 14:59:38 +01:00
Peter Kietzmann
e539db10ee
Merge pull request #4104 from gebart/pr/drop-timer-reset
...
periph/timer: Drop timer_reset
2015-10-26 08:36:01 +01:00
Johann Fischer
f31db0431f
Merge pull request #4132 from jfischer-phytec-iot/pr@kinetis-ldscript
...
kinetis_common: use cortexm_common ldscript
2015-10-24 09:59:38 +02:00
Johann Fischer
e95afc80fb
kinetis_common: use cortexm_common ldscript
...
kinetis.ld includes cortexm_common ldscript, the fields for the
isr vectors and fcfield remain in kinetis.ld.
2015-10-23 12:01:22 +02:00
Johann Fischer
f0e7d2fc03
cpu/kinetis_common/timer.c: cleanup and fix the pit timer
...
It simplifies the virtual "count up timer" and improves
the accuracy a little. The LDVAL for the prescaler should
be set as a number of prescaler cycles-1. The virtual
up-counter should be corrected in the isr by +1
(See PIT reference manual). This also fixes a bug where
the timer is not used by xtimer and up-counter does not overflow.
2015-10-23 11:58:10 +02:00
Hauke Petersen
05ef9fee99
cpu/kinetis_common: removed i2c_init_slave()
2015-10-20 16:58:06 +02:00
Joakim Nohlgård
cbaeccdb90
periph/timer: Drop timer_reset
2015-10-17 20:11:03 +02:00
Joakim Nohlgård
015098d2c2
kinetis: timer: return error if timer channel is not zero.
2015-09-24 06:46:34 +02:00
Joakim Nohlgård
808b1abdd0
Merge pull request #3623 from gebart/pr/kinetis-timer-stop-fix
...
cpu/kinetis_common: periph/timer, read PIT value before stopping
2015-09-21 08:21:34 +02:00
Joakim Nohlgård
98c465008b
all: Update @gebart family name, email
2015-09-20 13:47:39 +02:00
Hauke Petersen
35aaa62c38
cpu/kinetis_common: s/TIMER_DEV/TIMER_BASE/
2015-09-17 13:57:58 +02:00
c0d3524132
cpu: kinetis_common: remove obsolete hwtimer support
2015-09-16 10:58:52 +02:00
daniel-k
7a86344c4d
cpu/cortexm_common: gather addition information on hardfault
2015-08-19 14:24:54 +02:00
Joakim Gebart
cf5db434e6
cpu/kinetis_common: periph/timer, read PIT value before stopping
...
Reading CVAL after stopping timer seem to return zero.
Ref. manual states: "The counter period can be restarted, by first
disabling, and then enabling the timer with TCTRLn[TEN]", but does not
state whether the reset of CVAL happens on TEN 0->1 transition, or 1->0
transtion. Empirical evidence suggests the latter is the implemented behaviour.
2015-08-13 21:06:50 +02:00
Joakim Gebart
601c3002c3
cpu/kinetis_common: Cast device index enums to unsigned int before comparing for out of range values
...
Suppresses false warning in Clang:
warning: comparison of constant 42 with expression of type 'xxx_t'
is always false [-Wtautological-constant-out-of-range-compare]
See:
- https://llvm.org/bugs/show_bug.cgi?id=16154
- https://llvm.org/bugs/show_bug.cgi?id=22062
2015-07-21 07:21:51 +02:00
Joakim Gebart
624c241ec6
cpu/kinetis_common/spi: Fix byte_in unused.
...
Bug reported by the clang static analyzer.
Description: Value stored to 'byte_in' is never read
File: .../riot/cpu/kinetis_common/spi.c
Line: 1261
2015-07-13 17:24:00 +02:00
Johann Fischer
cb8ff544d5
cpu/kinetis_common/i2c.c: add _i2c_reset function, minor fixes
2015-07-09 23:19:56 +02:00
Joakim Gebart
eef8f25a44
kinetis: i2c: Handle ARBL flag in master mode.
...
The ARBL flag signals that bus master arbitration has been lost.
This may occur if devices on the bus misbehave, or in a multi-master
situation, or if devices are not powered and pull the SDA line down, or
if the communication wires are disconnected while communicating.
2015-07-09 23:19:55 +02:00
Joakim Gebart
cba6a81a73
kinetis: i2c: only send STOP in _i2c_stop()
2015-07-09 23:19:55 +02:00
Joakim Gebart
ed81e35e4c
cpu/kinetis_common: refactor ldscripts
...
- Merged the two kinetis_common ldscripts into a single script.
- Updated cpus to use the new script
- Updated K60 to merge sram_l and sram_u into one segment
2015-07-08 19:20:00 +02:00
Hauke Petersen
253e7ce715
cpu/kinetis_common: optimization of startup code
2015-06-15 16:00:51 +02:00
Hauke Petersen
d7f659db71
cpu/kinetis_common: adjusted to changed GPIO if
2015-06-12 19:10:49 +02:00
Joakim Gebart
65f088a246
kinetis: hwtimer refactor/rewrite
...
- Use hwtimer_set for hwtimer_set_absolute()
- Collect hwtimer statistics with #if ENABLE_STATS
- Assembler optimized functions for CNR handling
- Correct off-by-1 after counter reset
- Defer CMR update from hwtimer_unset until ISR fires
2015-06-04 14:25:29 +02:00
Joakim Gebart
7a9f6f9796
Merge pull request #3140 from gebart/pr/kinetis-hwtimer-isr-off-by-1
...
kinetis: hwtimer fix off-by-1 in LPTMR ISR
2015-06-02 19:23:10 +02:00
Joakim Gebart
06c41108c7
kinetis: hwtimer fix off-by-1 in LPTMR ISR
2015-06-02 11:21:49 +02:00
Johann Fischer
072d0a80c7
cpu/kinetis_common/ldscripts: adapt for newlib module
2015-05-31 18:24:05 +02:00
Peter Kietzmann
6dc0e789e1
Merge pull request #3101 from gebart/pr/warning-fixes
...
Various warning fixes
2015-05-31 17:03:49 +02:00
Hauke Petersen
de31e1f9e8
cpu/kinetis_common: fixes to fault_handlers
2015-05-29 16:42:05 +02:00
Joakim Gebart
697b85c182
kinetis: fix SPI double initialization warnings
2015-05-29 14:23:01 +02:00
Joakim Gebart
ec3679fd13
kinetis: spi_init_slave add missing callback assignment
2015-05-29 14:23:01 +02:00
Joakim Gebart
d4c1436de9
kinetis: fix warnings
...
- find_closest_x: sign-compare
- hwtimer_arch: unused-parameter
- i2c_init_slave: unused-parameter
- rnga: sign-compare
- rngb: sign-compare
- spi_transfer_bytes: sign-compare
- spi_transfer_regs: sign-compare
- timer: unused-parameter
2015-05-29 14:21:52 +02:00
Hauke Petersen
9943f51080
global: renamed cpu-conf.h into cpu_conf.h
2015-05-28 15:45:05 +02:00
Johann Fischer
c56afd9575
kinetis: Add check-fcfield-elf.sh
...
Checks an ELF file for a correctly set flash configuration field.
2015-05-27 10:30:33 +02:00
Joakim Gebart
5afd93f29e
kinetis: Add check-fcfield-hex.sh
...
Checks a .hex file for a correctly set flash configuration field.
2015-05-27 10:30:33 +02:00
Joakim Gebart
a745de3ef5
kinetis: Add watchdog disable code snippet
2015-05-27 10:30:21 +02:00
Johann Fischer
31c0ea7358
Merge pull request #2994 from gebart/pr/kinetis-pwm-refactor
...
kinetis: Refactor PWM periph
2015-05-22 09:51:47 +02:00
Joakim Gebart
e82ba82dc3
kinetis: Use BITBAND_REG32 instead of BITBAND_REG in random_rngb.c
2015-05-21 11:00:49 +02:00
Joakim Gebart
c85cc83a5a
kinetis: Refactor PWM periph implementation
...
- Set the proper prescaler value depending on requested frequency
- Return the actual achieved frequency in pwm_init
- Handle 1-8 channels depending on periph_conf.h instead of 4 fixed
- Perform function argument verification before touching the hardware
- Turn on PORT clock gate before touching PORT registers
- Eliminate some magic numbers
2015-05-20 06:16:42 +02:00
Johann F
1d60d9870d
add support for Freescale MKW2x family devices
2015-05-15 08:05:43 +02:00
Oleg Hahm
5079446beb
Merge pull request #2937 from gebart/pr/kinetis-unsuppress-cppcheck
...
kinetis: unsuppress variable scope warnings in rnga.c
2015-05-12 23:24:09 +02:00
Oleg Hahm
828839316b
core: renamed crash.h to panic.h
2015-05-09 18:44:10 +02:00
Joakim Gebart
64d7a5f55a
kinetis: unsuppress variable scope warnings in rnga.c
2015-05-08 21:25:55 +02:00
Joakim Gebart
fd46cb2364
kinetis: Add SPI_[2-7] to spi_transmission_begin
...
Fix compiler warning about unhandled switch cases.
2015-04-28 22:21:57 +02:00
Johann Fischer
36e89175b8
cpu/kinetis_common/spi.c: add a option to use hardware cs (PCS0 only)
...
minor fixes:
- get rid of compiler warning "value 'SPI_1' not handled in switch"
- add a giant macro to avoid redundant code in spi_init_master
2015-04-17 09:05:37 +02:00
Joakim Gebart
7f64920cd7
kinetis: Refactor GPIO to use a look-up-table
...
Saves a bunch of ROM space
mulle, gcc-4.9.2:
text data bss dec hex filename
20800 216 65320 86336 15140 /data/riotbuild/riotproject/tests/periph_gpio/bin/mulle/periph_gpio.elf
18992 216 65320 84528 14a30 /data/riotbuild/riotproject/tests/periph_gpio/bin/mulle/periph_gpio.elf
diff = 1808
36080 272 65264 101616 18cf0 /data/riotbuild/riotproject/examples/default/bin/mulle/default.elf
34296 272 65264 99832 185f8 /data/riotbuild/riotproject/examples/default/bin/mulle/default.elf
diff = 1784
2015-04-09 13:53:21 +02:00
Joakim Gebart
f8eb76caec
kinetis: Enable UART hardware FIFO buffers.
2015-03-10 17:52:07 +01:00
Joakim Gebart
f317cf42a8
kinetis: Add configuration macros for I2C bus speed parameters.
2015-03-04 08:55:06 +01:00
Ludwig Ortmann
51a4f8a43c
cpu/kinetis_common/i2c: fix indent, trailing space
2015-02-18 13:52:48 +01:00
Ludwig Ortmann
cec87139a5
core, cpu, drivers, tests: remove trailing space
2015-02-18 13:52:48 +01:00
Johann Fischer
8afc8dfdc3
cpu/kinetis_common: add common startup.c
...
cpu/kinetis_common/wdog.c: move wdog disable code to initial wdog driver
cpu/kinetis_common/wdog.c: add COP WDOG
cpu/kinetis_common/include/wdog.h: add configuration example
cpu/kinetis_common: add fault handlers
cpu/kinetis_common: add .ramcode and ISR vector relocation to startup.c
2015-02-15 10:28:13 +01:00
Joakim Gebart
a745c018da
kinetis: Refactor RTC into RTT, add RTC wrapper.
2015-02-14 14:20:26 +01:00
Joakim Gebart
29d3959b10
kinetis: Add shared Kinetis linker script.
2015-02-09 17:52:04 +01:00
Johann F
c0628a3058
cpu/kinetis_common: initial import for kinetis_common
...
add peripheral drivers for Freescale Kinetis MCUs:
adc driver
cpuid driver
gpio driver
hwtimer_arch driver (hwtimer used Low Power Timer)
i2c driver (master mode only)
mcg driver
pwm driver
random_rnga driver
random_rngb driver
rtc driver
spi driver
timer driver (timer used Periodic Interrupt Timer)
uart driver
add doc.txt (configuration examples)
random_rnga: Update RNGA driver in preparation for RNGB driver.
random_rngb: Add RNGB driver.
spi: refactor SPI to work for multiple CTARS, add spi_acquire, spi_release
gpio: Add gpio_irq_enable, gpio_irq_disable. Refactor GPIO.
gpio: Add gpio_irq_enable, gpio_irq_disable.
gpio: Refactor ISR functions to work with all GPIOs (0-31) and all ports (PORTA-PORTH)
adc: Refactor ADC, add calibration and scaling.
Added integer scaling of results in adc_map.
Handle precision setting in adc_init.
Set ADC clock divider depending on module clock.
Add ADC_1 as a possible device.
Add ADC calibration procedure according to K60 ref manual.
Handle ADC pins which are not part of the pin function mux.
Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
2015-02-04 14:50:54 +01:00