Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silicon Labs] Fix support for the RC oscillator #1516

Merged
merged 2 commits into from
Jan 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down