From 17a5101b4078be0e7350500ff406f9e86f61aaa2 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke <marian.buschsieweke@ovgu.de> Date: Sat, 19 May 2018 18:12:25 +0200 Subject: [PATCH] cpu/lpc2387: Fixed broken SPI driver In commit 513b20ffd328934c58af169e2bce0c0a01eddee2 the SPI API was changed to power up an configure the SPI bus on spi_acquire(). Sadly, the lpc2387 SPI apparently needs to be reconfigured after each power up. This commit moves the initialization code required after each power up from spi_init() to spi_acquire(). --- cpu/lpc2387/periph/spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu/lpc2387/periph/spi.c b/cpu/lpc2387/periph/spi.c index 4ef7c4a111..3fe63bd95d 100644 --- a/cpu/lpc2387/periph/spi.c +++ b/cpu/lpc2387/periph/spi.c @@ -47,8 +47,6 @@ void spi_init(spi_t bus) { assert(bus == SPI_DEV(0)); - /* interface setup */ - SSP0CR0 = 7; /* configure pins */ spi_init_pins(bus); /* power off the bus (default is on) */ @@ -81,6 +79,8 @@ int spi_acquire(spi_t bus, spi_cs_t cs, spi_mode_t mode, spi_clk_t clk) mutex_lock(&lock); /* power on */ PCONP |= (PCSSP0); + /* interface setup */ + SSP0CR0 = 7; /* configure bus clock */ lpc2387_pclk_scale(CLOCK_CORECLOCK / 1000, (uint32_t)clk, &pclksel, &cpsr); -- GitLab