Microcontroller functions#
Microcontroller functions.
See also hal/micro/cortexm3/micro.h for source code.
Many of the supplied example applications use these microcontroller functions. See hal/micro/micro.h for source code.
Note
The term SFD refers to the Start Frame Delimiter.
Vector Table Index Definitions#
These are numerical definitions for vector table.Only Cortex-M standard exception vectors (indices 0 through 15) are represented since device specific vectors can be (and often are) different across dies.
A numerical definition for a vector.
reset vector index
nmi vector index
hard fault vector index
memory fault vector index
bus fault vector index
usage fault vector index
reserved07 vector index
reserved08 vector index
reserved09 vector index
reserved10 vector index
svcall vector index
debug monitor vector index
reserved13 vector index
pendsv vector index
systick vector index
Utility macro to convert from IRQ numbers to exception numbers/ vector indices.
Number of vectors.
Functions#
Gets information about what caused the microcontroller to reset.
Calls halGetResetInfo() and supplies a string describing it.
Initializes microcontroller-specific peripherals.
Restarts the microcontroller and therefore everything else.
Change the CTUNE value.
Get the CTUNE value.
Records the specified reset cause then forces a reboot.
Returns the Extended Reset Cause information.
Calls halGetExtendedResetInfo() and translates the EM35x reset code to the corresponding value used by the EM2XX HAL.
Calls halGetExtendedResetInfo() and supplies a string describing the extended cause of the reset.
Macros#
The value that must be passed as the single parameter to halInternalDisableWatchDog() in order to successfully disable the watchdog timer.
EM2xx-compatible reset code returned by halGetEm2xxResetInfo()
EM2XX reports POWERON instead.
EM2XX reset poweron.
EM2XX reset watchdog.
EM2XX reset assert.
EM2XX reset bootloader.
EM2XX reset software.
Vector Table Index Definitions Documentation#
STACK_VECTOR_INDEX#
#define STACK_VECTOR_INDEXValue:
0U
A numerical definition for a vector.
special case: stack pointer at reset
95
of file platform/service/legacy_hal/inc/efm32_micro.h
RESET_VECTOR_INDEX#
#define RESET_VECTOR_INDEXValue:
1U
reset vector index
96
of file platform/service/legacy_hal/inc/efm32_micro.h
NMI_VECTOR_INDEX#
#define NMI_VECTOR_INDEXValue:
2U
nmi vector index
97
of file platform/service/legacy_hal/inc/efm32_micro.h
HARD_FAULT_VECTOR_INDEX#
#define HARD_FAULT_VECTOR_INDEXValue:
3U
hard fault vector index
98
of file platform/service/legacy_hal/inc/efm32_micro.h
MEMORY_FAULT_VECTOR_INDEX#
#define MEMORY_FAULT_VECTOR_INDEXValue:
4U
memory fault vector index
99
of file platform/service/legacy_hal/inc/efm32_micro.h
BUS_FAULT_VECTOR_INDEX#
#define BUS_FAULT_VECTOR_INDEXValue:
5U
bus fault vector index
100
of file platform/service/legacy_hal/inc/efm32_micro.h
USAGE_FAULT_VECTOR_INDEX#
#define USAGE_FAULT_VECTOR_INDEXValue:
6U
usage fault vector index
101
of file platform/service/legacy_hal/inc/efm32_micro.h
RESERVED07_VECTOR_INDEX#
#define RESERVED07_VECTOR_INDEXValue:
7U
reserved07 vector index
102
of file platform/service/legacy_hal/inc/efm32_micro.h
RESERVED08_VECTOR_INDEX#
#define RESERVED08_VECTOR_INDEXValue:
8U
reserved08 vector index
103
of file platform/service/legacy_hal/inc/efm32_micro.h
RESERVED09_VECTOR_INDEX#
#define RESERVED09_VECTOR_INDEXValue:
9U
reserved09 vector index
104
of file platform/service/legacy_hal/inc/efm32_micro.h
RESERVED10_VECTOR_INDEX#
#define RESERVED10_VECTOR_INDEXValue:
10U
reserved10 vector index
105
of file platform/service/legacy_hal/inc/efm32_micro.h
SVCALL_VECTOR_INDEX#
#define SVCALL_VECTOR_INDEXValue:
11U
svcall vector index
106
of file platform/service/legacy_hal/inc/efm32_micro.h
DEBUG_MONITOR_VECTOR_INDEX#
#define DEBUG_MONITOR_VECTOR_INDEXValue:
12U
debug monitor vector index
107
of file platform/service/legacy_hal/inc/efm32_micro.h
RESERVED13_VECTOR_INDEX#
#define RESERVED13_VECTOR_INDEXValue:
13U
reserved13 vector index
108
of file platform/service/legacy_hal/inc/efm32_micro.h
PENDSV_VECTOR_INDEX#
#define PENDSV_VECTOR_INDEXValue:
14U
pendsv vector index
109
of file platform/service/legacy_hal/inc/efm32_micro.h
SYSTICK_VECTOR_INDEX#
#define SYSTICK_VECTOR_INDEXValue:
15U
systick vector index
110
of file platform/service/legacy_hal/inc/efm32_micro.h
IRQ_TO_VECTOR_NUMBER#
#define IRQ_TO_VECTOR_NUMBERValue:
(x)
Utility macro to convert from IRQ numbers to exception numbers/ vector indices.
These are different because the latter include the Cortex-M standard exceptions while the former do not.
119
of file platform/service/legacy_hal/inc/efm32_micro.h
VECTOR_TABLE_LENGTH#
#define VECTOR_TABLE_LENGTHValue:
(IRQ_TO_VECTOR_NUMBER(EXT_IRQ_COUNT))
Number of vectors.
EXT_IRQ_COUNT is defined in the device header but does not include the Cortex-M standard exceptions.
127
of file platform/service/legacy_hal/inc/efm32_micro.h
Function Documentation#
halGetResetInfo#
uint8_t halGetResetInfo (void )
Gets information about what caused the microcontroller to reset.
N/A |
Returns
A code identifying the cause of the reset.
66
of file platform/service/legacy_hal/inc/micro.h
halGetResetString#
const char * halGetResetString (void )
Calls halGetResetInfo() and supplies a string describing it.
N/A |
Useful for diagnostic printing of text just after program initialization.
Returns
A pointer to a program space string.
75
of file platform/service/legacy_hal/inc/micro.h
halInit#
void halInit (void )
Initializes microcontroller-specific peripherals.
N/A |
37
of file platform/service/legacy_hal/inc/micro-common.h
halReboot#
void halReboot (void )
Restarts the microcontroller and therefore everything else.
N/A |
41
of file platform/service/legacy_hal/inc/micro-common.h
halInternalSetCtune#
void halInternalSetCtune (uint16_t tune)
Change the CTUNE value.
N/A | tune | Value to set CTUNE to. |
Involves switching to HFRCO and turning off the HFXO temporarily.
85
of file platform/service/legacy_hal/inc/micro-common.h
halInternalGetCtune#
uint16_t halInternalGetCtune (void )
Get the CTUNE value.
N/A |
Returns
Current CTUNE value.
93
of file platform/service/legacy_hal/inc/micro-common.h
halInternalSysReset#
void halInternalSysReset (uint16_t extendedCause)
Records the specified reset cause then forces a reboot.
N/A | extendedCause |
147
of file platform/service/legacy_hal/inc/efm32_micro.h
halGetExtendedResetInfo#
uint16_t halGetExtendedResetInfo (void )
Returns the Extended Reset Cause information.
N/A |
Returns
A 16-bit code identifying the base and extended cause of the reset
154
of file platform/service/legacy_hal/inc/efm32_micro.h
halGetEm2xxResetInfo#
uint8_t halGetEm2xxResetInfo (void )
Calls halGetExtendedResetInfo() and translates the EM35x reset code to the corresponding value used by the EM2XX HAL.
N/A |
Any reset codes not present in the EM2XX are returned after being OR'ed with 0x80.
Used by the EZSP host as a platform-independent NCP reset code.
Returns
The EM2XX-compatible reset code. If not supported by the EM2XX, return the platform-specific code with B7 set.
165
of file platform/service/legacy_hal/inc/efm32_micro.h
halGetExtendedResetString#
const char * halGetExtendedResetString (void )
Calls halGetExtendedResetInfo() and supplies a string describing the extended cause of the reset.
N/A |
halGetResetString() should also be called to get the string for the base reset cause
Useful for diagnostic printing of text just after program initialization.
Returns
A pointer to a program space string.
176
of file platform/service/legacy_hal/inc/efm32_micro.h
Macro Definition Documentation#
MICRO_DISABLE_WATCH_DOG_KEY#
#define MICRO_DISABLE_WATCH_DOG_KEYValue:
0xA5U
The value that must be passed as the single parameter to halInternalDisableWatchDog() in order to successfully disable the watchdog timer.
47
of file platform/service/legacy_hal/inc/micro-common.h
halInternalEnableWatchDog#
#define halInternalEnableWatchDog
73
of file platform/service/legacy_hal/inc/micro-common.h
halInternalDisableWatchDog#
#define halInternalDisableWatchDog
74
of file platform/service/legacy_hal/inc/micro-common.h
halInternalWatchDogEnabled#
#define halInternalWatchDogEnabledValue:
(...)
75
of file platform/service/legacy_hal/inc/micro-common.h
halResetWatchdog#
#define halResetWatchdog
76
of file platform/service/legacy_hal/inc/micro-common.h
EM2XX_RESET_UNKNOWN#
#define EM2XX_RESET_UNKNOWNValue:
0
EM2xx-compatible reset code returned by halGetEm2xxResetInfo()
EN2XX reset unknow
134
of file platform/service/legacy_hal/inc/efm32_micro.h
EM2XX_RESET_EXTERNAL#
#define EM2XX_RESET_EXTERNALValue:
1
EM2XX reports POWERON instead.
135
of file platform/service/legacy_hal/inc/efm32_micro.h
EM2XX_RESET_POWERON#
#define EM2XX_RESET_POWERONValue:
2
EM2XX reset poweron.
136
of file platform/service/legacy_hal/inc/efm32_micro.h
EM2XX_RESET_WATCHDOG#
#define EM2XX_RESET_WATCHDOGValue:
3
EM2XX reset watchdog.
137
of file platform/service/legacy_hal/inc/efm32_micro.h
EM2XX_RESET_ASSERT#
#define EM2XX_RESET_ASSERTValue:
6
EM2XX reset assert.
138
of file platform/service/legacy_hal/inc/efm32_micro.h
EM2XX_RESET_BOOTLOADER#
#define EM2XX_RESET_BOOTLOADERValue:
9
EM2XX reset bootloader.
139
of file platform/service/legacy_hal/inc/efm32_micro.h
EM2XX_RESET_SOFTWARE#
#define EM2XX_RESET_SOFTWAREValue:
11
EM2XX reset software.
140
of file platform/service/legacy_hal/inc/efm32_micro.h