Update emlib to 4.2.1 to get a critical fix for DCDC on Pearl

pull/1501/head
Steven Cooreman 2016-01-12 13:10:08 +01:00
parent 2ba71ea761
commit 91ad34addb
79 changed files with 240 additions and 176 deletions

View File

@ -1,24 +1,31 @@
================ Revision history ============================================
4.2.1:
- Added errata fix for an issue that may cause BOD resets in EM2 when using
DCDC-to-DVDD mode. The fix is implemented in EMU_DCDCInit().
- Added function EMU_DCDCPowerOff() for boards with physically disconnected DCDC.
- Current consumption is optimized for DCDC bypass mode. This update is
implemented in EMU_DCDCInit().
4.2.0:
- Updated I2C clock divider equation for platform 2 parts. Added constraints
to HFPER clock frequency in I2C_BusFreqSet().
- EMU EMU_EM23VregMode_TypeDef replaced with a bool.
- Added support for GPIO alternate drive strength and alternate control modes.
- DCDC setup is simplified. More tuning and optimization settings added to
- DCDC setup is simplified. More tuning and optimization settings added to
EMU_DCDCInit().
- Added member pinRetentionMode to EMU_EM4Init_TypeDef.
- Added function EMU_UnlatchPinRetention() to support unlatching of pin
- Added function EMU_UnlatchPinRetention() to support unlatching of pin
retention in EM4H/S.
- Fixed bug in ADC_InitScan() which caused a overwrite of single conversion
- Fixed bug in ADC_InitScan() which caused a overwrite of single conversion
mode calibration values.
- Added support for CRYPTO module on Pearl and Jade Geckos (em_crypto.c/h)
4.1.1:
- EMU_DCDCInit() updated with new parameters for EM2 and 3. Current consumption
with DCDC at expected levels for EFR32 and EFM32PG revA1, A2 and B0.
- EMU_DCDCInit_TypeDef updated with more parameters. EMU_DcdcLpcmpBiasMode_TypeDef
- EMU_DCDCInit_TypeDef updated with more parameters. EMU_DcdcLpcmpBiasMode_TypeDef
is removed.
- More assertions added to EMU_DCDCInit().
- More assertions added to EMU_DCDCInit().
- HFXO default parameters updated.
- ADC defaults updated.
- RMU pin mode set fixed.
@ -29,6 +36,7 @@
4.1.0:
- The typedef EMU_EM23Init_TypeDef which is a parameter to EMU_EM23Init()
has got a new definition.
- Initial support _SILICON_LABS_32B_PLATFORM_2 devices added
4.0.0:
- Use ARM CMSIS version 4.2.0.

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_acmp.h
* @brief Analog Comparator (ACMP) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_adc.h
* @brief Analog to Digital Converter (ADC) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_aes.h
* @brief Advanced encryption standard (AES) accelerator peripheral API.
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_assert.h
* @brief Emlib peripheral API "assert" implementation.
* @version 4.2.0
* @version 4.2.1
*
* @details
* By default, emlib library assert usage is not included in order to reduce

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_bitband.h
* @brief Bitband Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_burtc.h
* @brief Backup Real Time Counter (BURTC) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_bus.h
* @brief RAM and peripheral bit-field set and clear API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_chip.h
* @brief Chip Initialization API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_cmu.h
* @brief Clock management unit (CMU) API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_common.h
* @brief Emlib general purpose utilities.
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file
* @brief Cyclic Redundancy Check (CRC) API.
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_cryotimer.h
* @brief Ultra Low Energy Timer/Counter (CRYOTIMER) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_crypto.h
* @brief Cryptography accelerator peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_dac.h
* @brief Digital to Analog Converter (DAC) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_dbg.h
* @brief Debug (DBG) API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_dma.h
* @brief Direct memory access (DMA) API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_ebi.h
* @brief External Bus Iterface (EBI) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_emu.h
* @brief Energy management unit (EMU) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
@ -156,8 +156,6 @@ typedef enum
/** Power configurations */
typedef enum
{
/** Disable DCDC */
emuPowerConfig_NoDcdc = EMU_PWRCFG_PWRCFG_NODCDC,
/** DCDC is connected to DVDD */
emuPowerConfig_DcdcToDvdd = EMU_PWRCFG_PWRCFG_DCDCTODVDD,
} EMU_PowerConfig_TypeDef;
@ -171,8 +169,6 @@ typedef enum
emuDcdcMode_Bypass = EMU_DCDCCTRL_DCDCMODE_BYPASS,
/** DCDC low-noise mode */
emuDcdcMode_LowNoise = EMU_DCDCCTRL_DCDCMODE_LOWNOISE,
/** DCDC regulator is off */
emuDcdcMode_Off = EMU_DCDCCTRL_DCDCMODE_OFF,
} EMU_DcdcMode_TypeDef;
#endif
@ -476,6 +472,7 @@ void EMU_DCDCModeSet(EMU_DcdcMode_TypeDef dcdcMode);
bool EMU_DCDCOutputVoltageSet(uint32_t mV, bool setLpVoltage, bool setLnVoltage);
void EMU_DCDCOptimizeSlice(uint32_t mALoadCurrent);
void EMU_DCDCLnRcoBandSet(EMU_DcdcLnRcoBand_TypeDef band);
bool EMU_DCDCPowerOff(void);
#endif
#if defined( EMU_STATUS_VMONRDY )
void EMU_VmonInit(EMU_VmonInit_TypeDef *vmonInit);

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_gpio.h
* @brief General Purpose IO (GPIO) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_i2c.h
* @brief Inter-intergrated circuit (I2C) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_idac.h
* @brief Current Digital to Analog Converter (IDAC) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_int.h
* @brief Interrupt enable/disable unit API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_lcd.h
* @brief Liquid Crystal Display (LCD) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_ldma.h
* @brief Direct memory access (LDMA) API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_lesense.h
* @brief Low Energy Sensor (LESENSE) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_letimer.h
* @brief Low Energy Timer (LETIMER) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -2,7 +2,7 @@
* @file em_leuart.h
* @brief Low Energy Universal Asynchronous Receiver/Transmitter (LEUART)
* peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_mpu.h
* @brief Memory protection unit (MPU) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_msc.h
* @brief Flash controller module (MSC) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/**************************************************************************//**
* @file em_opamp.h
* @brief Operational Amplifier (OPAMP) peripheral API
* @version 4.2.0
* @version 4.2.1
******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_part.h
* @brief Verify that part specific main header files are supported and included
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_pcnt.h
* @brief Pulse Counter (PCNT) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_prs.h
* @brief Peripheral Reflex System (PRS) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_rmu.h
* @brief Reset Management Unit (RMU) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_rtc.h
* @brief Real Time Counter (RTC) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file
* @brief Real Time Counter (RTCC) peripheral API.
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_system.h
* @brief System API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_timer.h
* @brief Timer/counter (TIMER) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -2,7 +2,7 @@
* @file em_usart.h
* @brief Universal synchronous/asynchronous receiver/transmitter (USART/UART)
* peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_vcmp.h
* @brief Voltage Comparator (VCMP) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_version.h
* @brief Assign correct part number for include file
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
@ -50,7 +50,7 @@ extern "C" {
******************************************************************************/
/** Version number of emlib peripheral API. */
#define _EMLIB_VERSION 4.2.0
#define _EMLIB_VERSION 4.2.1
/** Major version of emlib. Bumped when incompatible API changes introduced. */
#define _EMLIB_VERSION_MAJOR 4
@ -61,7 +61,7 @@ extern "C" {
/** Patch revision of emlib. Bumped when adding backwards-compatible bug
fixes.*/
#define _EMLIB_VERSION_PATCH 0
#define _EMLIB_VERSION_PATCH 1
/** Version number of targeted CMSIS package. */

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_wdog.h
* @brief Watchdog (WDOG) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_acmp.c
* @brief Analog Comparator (ACMP) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_adc.c
* @brief Analog to Digital Converter (ADC) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_aes.c
* @brief Advanced Encryption Standard (AES) accelerator peripheral API.
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_assert.c
* @brief Assert API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_burtc.c
* @brief Backup Real Time Counter (BURTC) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_cmu.c
* @brief Clock management unit (CMU) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file
* @brief Cyclic Redundancy Check (CRC) API.
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_cryotimer.c
* @brief Ultra Low Energy Timer/Counter (CRYOTIMER) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_crypto.c
* @brief Cryptography accelerator peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_dac.c
* @brief Digital to Analog Coversion (DAC) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_dbg.c
* @brief Debug (DBG) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_dma.c
* @brief Direct memory access (DMA) module peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_ebi.c
* @brief External Bus Interface (EBI) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_emu.c
* @brief Energy Management Unit (EMU) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
@ -103,6 +103,13 @@
/* DCDCTODVDD output range min/max */
#define PWRCFG_DCDCTODVDD_VMIN 1200
#define PWRCFG_DCDCTODVDD_VMAX 3000
typedef enum
{
errataFixDcdcHsInit,
errataFixDcdcHsTrimSet,
errataFixDcdcHsLnWaitDone
} errataFixDcdcHs_TypeDef;
errataFixDcdcHs_TypeDef errataFixDcdcHsState = errataFixDcdcHsInit;
#endif
/*******************************************************************************
@ -333,6 +340,20 @@ void dcdcFetCntSet(bool lpModeSet)
maxCurrentUpdate();
}
}
void dcdcHsFixLnBlock(void)
{
#define EMU_DCDCSTATUS (* (volatile uint32_t *)(EMU_BASE + 0x7C))
if (errataFixDcdcHsState == errataFixDcdcHsTrimSet)
{
/* Wait for LNRUNNING */
if ((EMU->DCDCCTRL & ~_EMU_DCDCCTRL_DCDCMODE_MASK) == EMU_DCDCCTRL_DCDCMODE_LOWNOISE)
{
while (!(EMU_DCDCSTATUS & (0x1 << 16)));
}
errataFixDcdcHsState = errataFixDcdcHsLnWaitDone;
}
}
#endif
@ -423,6 +444,7 @@ void EMU_EnterEM2(bool restore)
#if defined( _EMU_DCDCCTRL_MASK )
dcdcFetCntSet(true);
dcdcHsFixLnBlock();
#endif
__WFI();
@ -554,6 +576,7 @@ void EMU_EnterEM3(bool restore)
#if defined( _EMU_DCDCCTRL_MASK )
dcdcFetCntSet(true);
dcdcHsFixLnBlock();
#endif
__WFI();
@ -627,6 +650,7 @@ void EMU_EnterEM4(void)
#if defined( _EMU_DCDCCTRL_MASK )
dcdcFetCntSet(true);
dcdcHsFixLnBlock();
#endif
for (i = 0; i < 4; i++)
@ -972,6 +996,12 @@ static bool ConstCalibrationLoad(void)
******************************************************************************/
void ValidatedConfigSet(void)
{
#define EMU_DCDCSMCTRL (* (volatile uint32_t *)(EMU_BASE + 0x44))
uint32_t dcdcTiming;
SYSTEM_PartFamily_TypeDef family;
SYSTEM_ChipRevision_TypeDef rev;
/* Enable duty cycling of the bias */
EMU->DCDCLPCTRL |= EMU_DCDCLPCTRL_LPVREFDUTYEN;
@ -987,6 +1017,31 @@ void ValidatedConfigSet(void)
#endif
EMU->DCDCTIMING &= ~_EMU_DCDCTIMING_DUTYSCALE_MASK;
family = SYSTEM_GetFamily();
SYSTEM_ChipRevisionGet(&rev);
if ((((family >= systemPartFamilyMighty1P)
&& (family <= systemPartFamilyFlex1V))
|| (family == systemPartFamilyEfm32Pearl1B)
|| (family == systemPartFamilyEfm32Jade1B))
&& ((rev.major == 1) && (rev.minor < 3))
&& (errataFixDcdcHsState == errataFixDcdcHsInit))
{
/* LPCMPWAITDIS = 1 */
EMU_DCDCSMCTRL |= 1;
dcdcTiming = EMU->DCDCTIMING;
dcdcTiming &= ~(_EMU_DCDCTIMING_LPINITWAIT_MASK
|_EMU_DCDCTIMING_LNWAIT_MASK
|_EMU_DCDCTIMING_BYPWAIT_MASK);
dcdcTiming |= ((180 << _EMU_DCDCTIMING_LPINITWAIT_SHIFT)
| (12 << _EMU_DCDCTIMING_LNWAIT_SHIFT)
| (180 << _EMU_DCDCTIMING_BYPWAIT_SHIFT));
EMU->DCDCTIMING = dcdcTiming;
errataFixDcdcHsState = errataFixDcdcHsTrimSet;
}
}
@ -1127,7 +1182,7 @@ static bool LpCmpHystCalibrationLoad(bool lpAttenuation, uint32_t lpCmpBias)
void EMU_DCDCModeSet(EMU_DcdcMode_TypeDef dcdcMode)
{
while(EMU->DCDCSYNC & EMU_DCDCSYNC_DCDCCTRLBUSY);
BUS_RegBitWrite(&EMU->DCDCCLIMCTRL, _EMU_DCDCCLIMCTRL_BYPLIMEN_SHIFT, dcdcMode == emuDcdcMode_Bypass ? 0 : 1);
EMU->DCDCCTRL = (EMU->DCDCCTRL & ~_EMU_DCDCCTRL_DCDCMODE_MASK) | dcdcMode;
}
@ -1136,6 +1191,10 @@ void EMU_DCDCModeSet(EMU_DcdcMode_TypeDef dcdcMode)
* @brief
* Configure DCDC regulator
*
* @note
* Use the function EMU_DCDCPowerDown() to if the power circuit is configured
* for NODCDC as decribed in Section 11.3.4.3 in the Reference Manual.
*
* @param[in] dcdcInit
* DCDC initialization structure
*
@ -1144,95 +1203,76 @@ void EMU_DCDCModeSet(EMU_DcdcMode_TypeDef dcdcMode)
******************************************************************************/
bool EMU_DCDCInit(EMU_DCDCInit_TypeDef *dcdcInit)
{
#if defined( EMU_DCDCMISCCTRL_LPCMPBIASEM01 )
uint32_t em01lpCmpBiasSel;
#endif
uint32_t lpCmpBiasSel;
/* Set external power configuration. This enables writing to the other
DCDC registers. */
EMU->PWRCFG = (EMU->PWRCFG & ~_EMU_PWRCFG_PWRCFG_MASK) | dcdcInit->powerConfig;
EMU->PWRCFG = dcdcInit->powerConfig;
/* EMU->PWRCFG is write-once and POR/pin reset only. Check that
/* EMU->PWRCFG is write-once and POR reset only. Check that
we could set the desired power configuration. */
if ((EMU->PWRCFG & _EMU_PWRCFG_PWRCFG_MASK) != dcdcInit->powerConfig)
{
/* If this assert triggers unexpectedly, please power cycle the
kit to reset the power configuration. */
EFM_ASSERT(false);
/* Return when assertions are disabled */
return false;
}
/* Load DCDC calibration data from the DI page */
ConstCalibrationLoad();
/* Check current parameters */
EFM_ASSERT(dcdcInit->maxCurrent_mA <= 200);
EFM_ASSERT(dcdcInit->em01LoadCurrent_mA <= dcdcInit->maxCurrent_mA);
/* DCDC low-noise supports max 200mA */
if (dcdcInit->dcdcMode == emuDcdcMode_LowNoise)
{
EFM_ASSERT(dcdcInit->em01LoadCurrent_mA <= 200);
}
/* EM2, 3 and 4 current above 100uA is not supported */
EFM_ASSERT(dcdcInit->em234LoadCurrent_uA <= 100);
/* Decode LP comparator bias for EM0/1 and EM2/3 */
lpCmpBiasSel = EMU_DCDCMISCCTRL_LPCMPBIAS_BIAS1;
if (dcdcInit->em234LoadCurrent_uA <= 10)
{
lpCmpBiasSel = EMU_DCDCMISCCTRL_LPCMPBIAS_BIAS0;
}
/* Set DCDC low-power mode comparator bias selection */
EMU->DCDCMISCCTRL = (EMU->DCDCMISCCTRL & ~(_EMU_DCDCMISCCTRL_LPCMPBIAS_MASK
| _EMU_DCDCMISCCTRL_LNFORCECCM_MASK))
| ((uint32_t)lpCmpBiasSel
| (uint32_t)dcdcInit->lnTransientMode);
/* Set recommended and validated current optimization settings */
ValidatedConfigSet();
/* Set the maximum current that the DCDC can draw from the power source */
maxCurrentSet(dcdcInit->maxCurrent_mA);
/* Optimize LN slice based on given load current estimate */
EMU_DCDCOptimizeSlice(dcdcInit->em01LoadCurrent_mA);
/* Set DCDC output voltage */
dcdcOutput_mVout = dcdcInit->mVout;
if (!EMU_DCDCOutputVoltageSet(dcdcOutput_mVout, true, true))
{
EFM_ASSERT(false);
/* Return when assertions are disabled */
return false;
}
if (dcdcInit->powerConfig == emuPowerConfig_NoDcdc)
{
/* Force bypass mode for NoDcdc power config */
EMU_DCDCModeSet(emuDcdcMode_Bypass);
}
else
{
/* Load DCDC calibration data from the DI page */
ConstCalibrationLoad();
/* Set EM0 DCDC operating mode. Output voltage set in EMU_DCDCOutputVoltageSet()
above takes effect if mode is changed from bypass here. */
EMU_DCDCModeSet(dcdcInit->dcdcMode);
/* Check current parameters */
EFM_ASSERT(dcdcInit->maxCurrent_mA <= 200);
EFM_ASSERT(dcdcInit->em01LoadCurrent_mA <= dcdcInit->maxCurrent_mA);
/* DCDC low-noise supports max 200mA */
if (dcdcInit->dcdcMode == emuDcdcMode_LowNoise)
{
EFM_ASSERT(dcdcInit->em01LoadCurrent_mA <= 200);
}
else
{
/* Unsupported DCDC mode */
EFM_ASSERT(false);
}
/* EM2, 3 and 4 current above 100uA is not supported */
EFM_ASSERT(dcdcInit->em234LoadCurrent_uA <= 100);
/* Decode LP comparator bias for EM0/1 and EM2/3 */
#if defined( EMU_DCDCMISCCTRL_LPCMPBIASEM01 ) || !defined( _EMU_DCDCMISCCTRL_LPCMPBIAS_MASK )
#warning "Update LPCMPBIAS handling"
#endif
lpCmpBiasSel = EMU_DCDCMISCCTRL_LPCMPBIAS_BIAS1;
if (dcdcInit->em234LoadCurrent_uA <= 10)
{
lpCmpBiasSel = EMU_DCDCMISCCTRL_LPCMPBIAS_BIAS0;
}
/* Set DCDC low-power mode comparator bias selection */
EMU->DCDCMISCCTRL = (EMU->DCDCMISCCTRL & ~(_EMU_DCDCMISCCTRL_LPCMPBIAS_MASK
| _EMU_DCDCMISCCTRL_LNFORCECCM_MASK))
| ((uint32_t)lpCmpBiasSel
| (uint32_t)dcdcInit->lnTransientMode);
/* Set recommended and validated current optimization settings */
ValidatedConfigSet();
/* Set the maximum current that the DCDC can draw from the power source */
maxCurrentSet(dcdcInit->maxCurrent_mA);
/* Optimize LN slice based on given load current estimate */
EMU_DCDCOptimizeSlice(dcdcInit->em01LoadCurrent_mA);
/* Set DCDC output voltage */
dcdcOutput_mVout = dcdcInit->mVout;
if (!EMU_DCDCOutputVoltageSet(dcdcOutput_mVout, true, true))
{
EFM_ASSERT(false);
/* Return when assertions are disabled */
return false;
}
/* Set EM0 DCDC operating mode. Output voltage set in EMU_DCDCOutputVoltageSet()
above takes effect when mode is changed from bypass here. */
EMU_DCDCModeSet(dcdcInit->dcdcMode);
/* Select analog peripheral power supply */
BUS_RegBitWrite(&EMU->PWRCTRL, _EMU_PWRCTRL_ANASW_SHIFT, dcdcInit->anaPeripheralPower ? 1 : 0);
}
/* Select analog peripheral power supply */
BUS_RegBitWrite(&EMU->PWRCTRL, _EMU_PWRCTRL_ANASW_SHIFT, dcdcInit->anaPeripheralPower ? 1 : 0);
return true;
}
@ -1255,7 +1295,6 @@ bool EMU_DCDCOutputVoltageSet(uint32_t mV,
#if defined( _DEVINFO_DCDCLNVCTRL0_3V0LNATT1_MASK )
bool validOutVoltage;
uint32_t pwrCfg;
uint8_t lnMode;
bool attSet;
uint32_t attMask;
@ -1268,19 +1307,10 @@ bool EMU_DCDCOutputVoltageSet(uint32_t mV,
uint32_t lpcmpBias;
volatile uint32_t* ctrlReg;
/* Get current power configuration and assert on invalid use-cases. */
pwrCfg = (EMU->PWRCFG & _EMU_PWRCFG_PWRCFG_MASK);
if (pwrCfg != EMU_PWRCFG_PWRCFG_DCDCTODVDD)
{
EFM_ASSERT(false);
/* Return when assertions are disabled */
return false;
}
/* Check that the set voltage is within valid range.
Voltages are obtained from the datasheet. */
validOutVoltage = false;
if (pwrCfg == EMU_PWRCFG_PWRCFG_DCDCTODVDD)
if ((EMU->PWRCFG & _EMU_PWRCFG_PWRCFG_MASK) == EMU_PWRCFG_PWRCFG_DCDCTODVDD)
{
validOutVoltage = ((mV >= PWRCFG_DCDCTODVDD_VMIN)
&& (mV <= PWRCFG_DCDCTODVDD_VMAX));
@ -1547,6 +1577,35 @@ void EMU_DCDCLnRcoBandSet(EMU_DcdcLnRcoBand_TypeDef band)
EMU->DCDCLNFREQCTRL = (EMU->DCDCLNFREQCTRL & ~_EMU_DCDCLNFREQCTRL_RCOBAND_MASK)
| (band << _EMU_DCDCLNFREQCTRL_RCOBAND_SHIFT);
}
/***************************************************************************//**
* @brief
* Power off the DCDC regulator.
*
* @details
* This function powers off the DCDC controller. This function should only be
* used if the external power circuit is wired for no DCDC. If the external power
* circuit is wired for DCDC usage, then use EMU_DCDCInit() and set the
* DCDC in bypass mode to disable DCDC.
*
* @return
* Return false if the DCDC could not be disabled.
******************************************************************************/
bool EMU_DCDCPowerOff(void)
{
/* Set power configuration to hard bypass */
EMU->PWRCFG = 0xF;
if ((EMU->PWRCFG & _EMU_PWRCFG_PWRCFG_MASK) != 0xF)
{
EFM_ASSERT(false);
/* Return when assertions are disabled */
return false;
}
/* Set DCDC to OFF and disable LP in EM2/3/4 */
EMU->DCDCCTRL = EMU_DCDCCTRL_DCDCMODE_OFF;
return true;
}
#endif

View File

@ -2,7 +2,7 @@
* @file em_gpio.c
* @brief General Purpose IO (GPIO) peripheral API
* devices.
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_i2c.c
* @brief Inter-integrated Circuit (I2C) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_idac.c
* @brief Current Digital to Analog Converter (IDAC) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/**************************************************************************//**
* @file em_int.c
* @brief Interrupt enable/disable unit API
* @version 4.2.0
* @version 4.2.1
******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_lcd.c
* @brief Liquid Crystal Display (LCD) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_ldma.c
* @brief Direct memory access (LDMA) module peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_lesense.c
* @brief Low Energy Sensor (LESENSE) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_letimer.c
* @brief Low Energy Timer (LETIMER) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -2,7 +2,7 @@
* @file em_leuart.c
* @brief Low Energy Universal Asynchronous Receiver/Transmitter (LEUART)
* Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_mpu.c
* @brief Memory Protection Unit (MPU) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_msc.c
* @brief Flash controller (MSC) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/**************************************************************************//**
* @file em_opamp.c
* @brief Operational Amplifier (OPAMP) peripheral API
* @version 4.2.0
* @version 4.2.1
******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_pcnt.c
* @brief Pulse Counter (PCNT) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_prs.c
* @brief Peripheral Reflex System (PRS) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -2,7 +2,7 @@
* @file em_rmu.c
* @brief Reset Management Unit (RMU) peripheral module peripheral API
*
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_rtc.c
* @brief Real Time Counter (RTC) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file
* @brief Real Time Counter with Calendar (RTCC) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_system.c
* @brief System Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_timer.c
* @brief Timer/counter (TIMER) Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -2,7 +2,7 @@
* @file em_usart.c
* @brief Universal synchronous/asynchronous receiver/transmitter (USART/UART)
* Peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -1,7 +1,7 @@
/***************************************************************************//**
* @file em_vcmp.c
* @brief Voltage Comparator (VCMP) peripheral API
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>

View File

@ -2,7 +2,7 @@
* @file em_wdog.c
* @brief Watchdog (WDOG) peripheral API
* devices.
* @version 4.2.0
* @version 4.2.1
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>