diff --git a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG_STK3700/device_peripherals.h b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG_STK3700/device_peripherals.h index 1e86d70c1cb..e3880a3e91e 100644 --- a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG_STK3700/device_peripherals.h +++ b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG_STK3700/device_peripherals.h @@ -71,14 +71,14 @@ /** HFRCO frequency band * Options: - * * CMU_HFRCOCTRL_BAND_28MHZ - * * CMU_HFRCOCTRL_BAND_21MHZ - * * CMU_HFRCOCTRL_BAND_14MHZ - * * CMU_HFRCOCTRL_BAND_11MHZ - * * CMU_HFRCOCTRL_BAND_7MHZ - * * CMU_HFRCOCTRL_BAND_1MHZ + * * _CMU_HFRCOCTRL_BAND_28MHZ + * * _CMU_HFRCOCTRL_BAND_21MHZ + * * _CMU_HFRCOCTRL_BAND_14MHZ + * * _CMU_HFRCOCTRL_BAND_11MHZ + * * _CMU_HFRCOCTRL_BAND_7MHZ + * * _CMU_HFRCOCTRL_BAND_1MHZ */ -#define HFRCO_FREQUENCY CMU_HFRCOCTRL_BAND_14MHZ +#define HFRCO_FREQUENCY _CMU_HFRCOCTRL_BAND_21MHZ #define LFXO_FREQUENCY 32768 #define HFXO_FREQUENCY 48000000 diff --git a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG_STK3400/device_peripherals.h b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG_STK3400/device_peripherals.h index ab49fea4280..6adbd884cac 100644 --- a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG_STK3400/device_peripherals.h +++ b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG_STK3400/device_peripherals.h @@ -71,14 +71,13 @@ /** HFRCO frequency band * Options: - * * CMU_HFRCOCTRL_BAND_28MHZ - * * CMU_HFRCOCTRL_BAND_21MHZ - * * CMU_HFRCOCTRL_BAND_14MHZ - * * CMU_HFRCOCTRL_BAND_11MHZ - * * CMU_HFRCOCTRL_BAND_7MHZ - * * CMU_HFRCOCTRL_BAND_1MHZ + * * _CMU_HFRCOCTRL_BAND_21MHZ + * * _CMU_HFRCOCTRL_BAND_14MHZ + * * _CMU_HFRCOCTRL_BAND_11MHZ + * * _CMU_HFRCOCTRL_BAND_7MHZ + * * _CMU_HFRCOCTRL_BAND_1MHZ */ -#define HFRCO_FREQUENCY CMU_HFRCOCTRL_BAND_14MHZ +#define HFRCO_FREQUENCY _CMU_HFRCOCTRL_BAND_21MHZ #define LFXO_FREQUENCY 32768 #define HFXO_FREQUENCY 24000000 diff --git a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG_STK3600/device_peripherals.h b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG_STK3600/device_peripherals.h index 1e86d70c1cb..e3880a3e91e 100644 --- a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG_STK3600/device_peripherals.h +++ b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG_STK3600/device_peripherals.h @@ -71,14 +71,14 @@ /** HFRCO frequency band * Options: - * * CMU_HFRCOCTRL_BAND_28MHZ - * * CMU_HFRCOCTRL_BAND_21MHZ - * * CMU_HFRCOCTRL_BAND_14MHZ - * * CMU_HFRCOCTRL_BAND_11MHZ - * * CMU_HFRCOCTRL_BAND_7MHZ - * * CMU_HFRCOCTRL_BAND_1MHZ + * * _CMU_HFRCOCTRL_BAND_28MHZ + * * _CMU_HFRCOCTRL_BAND_21MHZ + * * _CMU_HFRCOCTRL_BAND_14MHZ + * * _CMU_HFRCOCTRL_BAND_11MHZ + * * _CMU_HFRCOCTRL_BAND_7MHZ + * * _CMU_HFRCOCTRL_BAND_1MHZ */ -#define HFRCO_FREQUENCY CMU_HFRCOCTRL_BAND_14MHZ +#define HFRCO_FREQUENCY _CMU_HFRCOCTRL_BAND_21MHZ #define LFXO_FREQUENCY 32768 #define HFXO_FREQUENCY 48000000 diff --git a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG_STK3401/device_peripherals.h b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG_STK3401/device_peripherals.h index e9fcdccb766..bcc54c37740 100644 --- a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG_STK3401/device_peripherals.h +++ b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG_STK3401/device_peripherals.h @@ -32,7 +32,7 @@ /* us ticker */ #define US_TICKER_TIMER TIMER0 -#define US_TICKER_TIMER_CLOCK cmuClock_TIMER0 +#define US_TICKER_TIMER_CLOCK cmuClock_TIMER0 #define US_TICKER_TIMER_IRQ TIMER0_IRQn /* PWM */ @@ -52,31 +52,48 @@ /* Low Energy peripheral clock source. * Options: - * * LFXO: external crystal, please define frequency. - * * LFRCO: internal RC oscillator (32.768kHz) - * * ULFRCO: internal ultra-low power RC oscillator (available down to EM3) (1kHz) + * * LFXO: external crystal, please define frequency. + * * LFRCO: internal RC oscillator (32.768kHz) + * * ULFRCO: internal ultra-low power RC oscillator (available down to EM3) (1kHz) */ -#define LOW_ENERGY_CLOCK_SOURCE LFXO +#define LOW_ENERGY_CLOCK_SOURCE LFXO /** Core clock source. * Options: - * * HFXO: external crystal, please define frequency. - * * HFRCO: High-frequency internal RC oscillator. Please select frequency as well. + * * HFXO: external crystal, please define frequency. + * * HFRCO: High-frequency internal RC oscillator. Please select frequency as well. */ -#define CORE_CLOCK_SOURCE HFXO +#define CORE_CLOCK_SOURCE HFXO -#define HFRCO_FREQUENCY_ENUM cmuHFRCOFreq_19M0Hz -#define HFRCO_FREQUENCY 19000000 +/** HFRCO frequency selection + * Options: + * ** HFRCO_FREQUENCY_ENUM ** HFRCO_FREQUENCY ** + * * cmuHFRCOFreq_1M0Hz == 1000000 * + * * cmuHFRCOFreq_2M0Hz == 2000000 * + * * cmuHFRCOFreq_4M0Hz == 4000000 * + * * cmuHFRCOFreq_7M0Hz == 7000000 * + * * cmuHFRCOFreq_13M0Hz == 13000000 * + * * cmuHFRCOFreq_16M0Hz == 16000000 * + * * cmuHFRCOFreq_19M0Hz == 19000000 * + * * cmuHFRCOFreq_26M0Hz == 26000000 * + * * cmuHFRCOFreq_32M0Hz == 32000000 * + * * cmuHFRCOFreq_38M0Hz == 38000000 * + * ********************************************* + */ + +/* Make sure the settings of HFRCO_FREQUENCY and HFRCO_FREQUENCY_ENUM match, or timings will be faulty! */ +#define HFRCO_FREQUENCY_ENUM cmuHFRCOFreq_19M0Hz +#define HFRCO_FREQUENCY 19000000 -#define LFXO_FREQUENCY 32768 -#define HFXO_FREQUENCY 40000000 +#define LFXO_FREQUENCY 32768 +#define HFXO_FREQUENCY 40000000 #if (LOW_ENERGY_CLOCK_SOURCE == LFXO) -#define LOW_ENERGY_CLOCK_FREQUENCY LFXO_FREQUENCY +#define LOW_ENERGY_CLOCK_FREQUENCY LFXO_FREQUENCY #elif (LOW_ENERGY_CLOCK_SOURCE == LFRCO) -#define LOW_ENERGY_CLOCK_FREQUENCY 32768 +#define LOW_ENERGY_CLOCK_FREQUENCY 32768 #elif (LOW_ENERGY_CLOCK_SOURCE == ULFRCO) -#define LOW_ENERGY_CLOCK_FREQUENCY 1000 +#define LOW_ENERGY_CLOCK_FREQUENCY 1000 #else #error "Unknown Low Energy Clock selection" #endif diff --git a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG_STK3800/device_peripherals.h b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG_STK3800/device_peripherals.h index 1e86d70c1cb..e3880a3e91e 100644 --- a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG_STK3800/device_peripherals.h +++ b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG_STK3800/device_peripherals.h @@ -71,14 +71,14 @@ /** HFRCO frequency band * Options: - * * CMU_HFRCOCTRL_BAND_28MHZ - * * CMU_HFRCOCTRL_BAND_21MHZ - * * CMU_HFRCOCTRL_BAND_14MHZ - * * CMU_HFRCOCTRL_BAND_11MHZ - * * CMU_HFRCOCTRL_BAND_7MHZ - * * CMU_HFRCOCTRL_BAND_1MHZ + * * _CMU_HFRCOCTRL_BAND_28MHZ + * * _CMU_HFRCOCTRL_BAND_21MHZ + * * _CMU_HFRCOCTRL_BAND_14MHZ + * * _CMU_HFRCOCTRL_BAND_11MHZ + * * _CMU_HFRCOCTRL_BAND_7MHZ + * * _CMU_HFRCOCTRL_BAND_1MHZ */ -#define HFRCO_FREQUENCY CMU_HFRCOCTRL_BAND_14MHZ +#define HFRCO_FREQUENCY _CMU_HFRCOCTRL_BAND_21MHZ #define LFXO_FREQUENCY 32768 #define HFXO_FREQUENCY 48000000 diff --git a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/device_peripherals.h b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/device_peripherals.h index 629b4bf9706..fab34df4c83 100644 --- a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/device_peripherals.h +++ b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/device_peripherals.h @@ -68,14 +68,13 @@ /** HFRCO frequency band * Options: - * * CMU_HFRCOCTRL_BAND_28MHZ - * * CMU_HFRCOCTRL_BAND_21MHZ - * * CMU_HFRCOCTRL_BAND_14MHZ - * * CMU_HFRCOCTRL_BAND_11MHZ - * * CMU_HFRCOCTRL_BAND_7MHZ - * * CMU_HFRCOCTRL_BAND_1MHZ + * * _CMU_HFRCOCTRL_BAND_21MHZ + * * _CMU_HFRCOCTRL_BAND_14MHZ + * * _CMU_HFRCOCTRL_BAND_11MHZ + * * _CMU_HFRCOCTRL_BAND_7MHZ + * * _CMU_HFRCOCTRL_BAND_1MHZ */ -#define HFRCO_FREQUENCY CMU_HFRCOCTRL_BAND_14MHZ +#define HFRCO_FREQUENCY _CMU_HFRCOCTRL_BAND_21MHZ #define LFXO_FREQUENCY 32768 #define HFXO_FREQUENCY 24000000 diff --git a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/clocking.h b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/clocking.h index b99ed8d1ea1..47c88869479 100644 --- a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/clocking.h +++ b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/clocking.h @@ -36,17 +36,17 @@ #elif( CORE_CLOCK_SOURCE == HFRCO) # if defined _CMU_HFRCOCTRL_BAND_MASK -# if( HFRCO_FREQUENCY == CMU_HFRCOCTRL_BAND_1MHZ) +# if( HFRCO_FREQUENCY == _CMU_HFRCOCTRL_BAND_1MHZ) # define REFERENCE_FREQUENCY 1000000 -# elif(HFRCO_FREQUENCY == CMU_HFRCOCTRL_BAND_7MHZ) +# elif(HFRCO_FREQUENCY == _CMU_HFRCOCTRL_BAND_7MHZ) # define REFERENCE_FREQUENCY 7000000 -# elif(HFRCO_FREQUENCY == CMU_HFRCOCTRL_BAND_11MHZ) +# elif(HFRCO_FREQUENCY == _CMU_HFRCOCTRL_BAND_11MHZ) # define REFERENCE_FREQUENCY 7000000 -# elif(HFRCO_FREQUENCY == CMU_HFRCOCTRL_BAND_14MHZ) +# elif(HFRCO_FREQUENCY == _CMU_HFRCOCTRL_BAND_14MHZ) # define REFERENCE_FREQUENCY 14000000 -# elif(HFRCO_FREQUENCY == CMU_HFRCOCTRL_BAND_21MHZ) +# elif(HFRCO_FREQUENCY == _CMU_HFRCOCTRL_BAND_21MHZ) # define REFERENCE_FREQUENCY 21000000 -# elif(HFRCO_FREQUENCY == CMU_HFRCOCTRL_BAND_28MHZ) +# elif(HFRCO_FREQUENCY == _CMU_HFRCOCTRL_BAND_28MHZ) # define REFERENCE_FREQUENCY 28000000 # else # define REFERENCE_FREQUENCY 14000000 diff --git a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c index 97b36a67f1c..bc61ae73e2c 100644 --- a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c +++ b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c @@ -213,12 +213,12 @@ void spi_enable_pins(spi_t *obj, uint8_t enable, PinName mosi, PinName miso, Pin if (miso != NC) { route |= USART_ROUTEPEN_RXPEN; obj->spi.spi->ROUTELOC0 &= ~_USART_ROUTELOC0_RXLOC_MASK; - obj->spi.spi->ROUTELOC0 |= pin_location(mosi, PinMap_SPI_MOSI)<<_USART_ROUTELOC0_RXLOC_SHIFT; + obj->spi.spi->ROUTELOC0 |= pin_location(miso, PinMap_SPI_MOSI)<<_USART_ROUTELOC0_RXLOC_SHIFT; } if (!obj->spi.master) { route |= USART_ROUTEPEN_CSPEN; obj->spi.spi->ROUTELOC0 &= ~_USART_ROUTELOC0_CSLOC_MASK; - obj->spi.spi->ROUTELOC0 |= pin_location(mosi, PinMap_SPI_MOSI)<<_USART_ROUTELOC0_CSLOC_SHIFT; + obj->spi.spi->ROUTELOC0 |= pin_location(cs, PinMap_SPI_MOSI)<<_USART_ROUTELOC0_CSLOC_SHIFT; } obj->spi.spi->ROUTEPEN = route; }