Dcdccoulombcounter#

Modules#

sl_dcdc_coulomb_counter_config_t

sl_dcdc_coulomb_counter_calibration_config_t

Enumerations#

enum
SL_DCDC_COULOMB_COUNTER_EM0 = 0
SL_DCDC_COULOMB_COUNTER_EM2 = 1
}

DCDC_COULOMB_COUNTER supported energy mode.

enum
SL_DCDC_COULOMB_COUNTER_CAL_LOAD0 = _DCDC_CCCALCTRL_CCLVL_LOAD0
SL_DCDC_COULOMB_COUNTER_CAL_LOAD1 = _DCDC_CCCALCTRL_CCLVL_LOAD1
SL_DCDC_COULOMB_COUNTER_CAL_LOAD2 = _DCDC_CCCALCTRL_CCLVL_LOAD2
SL_DCDC_COULOMB_COUNTER_CAL_LOAD3 = _DCDC_CCCALCTRL_CCLVL_LOAD3
SL_DCDC_COULOMB_COUNTER_CAL_LOAD4 = _DCDC_CCCALCTRL_CCLVL_LOAD4
SL_DCDC_COULOMB_COUNTER_CAL_LOAD5 = _DCDC_CCCALCTRL_CCLVL_LOAD5
SL_DCDC_COULOMB_COUNTER_CAL_LOAD6 = _DCDC_CCCALCTRL_CCLVL_LOAD6
SL_DCDC_COULOMB_COUNTER_CAL_LOAD7 = _DCDC_CCCALCTRL_CCLVL_LOAD7
}

DCDC_COULOMB_COUNTER Calibration Load Current Level setting.

Functions#

void
sl_dcdc_coulomb_counter_init(const sl_dcdc_coulomb_counter_config_t *p_config)

Initializes DCDC_COULOMB_COUNTER module.

void

Enables DCDC_COULOMB_COUNTER module.

void

Disables DCDC_COULOMB_COUNTER module.

void

Waits for the DCDC_COULOMB_COUNTER to complete START command.

void

Waits for the DCDC_COULOMB_COUNTER to complete STOP command.

void

Waits for the DCDC_COULOMB_COUNTER to complete CLR command.

void

Starts DCDC_COULOMB_COUNTER operation.

void

Stops the DCDC_COULOMB_COUNTER operation.

void

Clears the DCDC_COULOMB_COUNTER counters.

uint32_t
sl_dcdc_coulomb_counter_get_count(sl_dcdc_coulomb_counter_emode_t emode)

Gets the DCDC_COULOMB_COUNTER count for the selected energy mode.

uint32_t

Gets DCDC_COULOMB_COUNTER STATUS register value.

void

Enables one or more DCDC_COULOMB_COUNTER interrupts.

void

Disables one or more DCDC_COULOMB_COUNTER interrupts.

void

Clears one or more pending DCDC_COULOMB_COUNTER interrupts.

uint32_t

Gets pending DCDC_COULOMB_COUNTER interrupt flags.

uint32_t

Gets enabled and pending DCDC_COULOMB_COUNTER interrupt flags.

void

Sets one or more pending DCDC_COULOMB_COUNTER interrupts from Software.

void
sl_dcdc_coulomb_counter_cal_init(sl_dcdc_coulomb_counter_calibration_config_t config)

Initializes the calibration of the DCDC Coulomb Counter.

void

Starts DCDC_COULOMB_COUNTER calibration sequence.

void

Stops DCDC_COULOMB_COUNTER calibration sequence.

void

Enables the Calibration Load.

void

Disables the Calibration Load.

void
sl_dcdc_coulomb_counter_set_cal_load_level(sl_dcdc_coulomb_counter_emode_t emode, sl_dcdc_coulomb_counter_calibration_load_level_t load_level)

Sets the Calibration Load level.

uint16_t
sl_dcdc_coulomb_counter_get_cal_load_current(sl_dcdc_coulomb_counter_calibration_load_level_t load_level)

Gets the calibration load current from the stored value in DEVINFO as measured during production testing.

uint32_t

Gets the frequency (in Hz) of the CMU Calibration Up-Counter source.

void

Sets the calibration Halt Flag.

bool

Gets the calibration Halt Flag.

Macros#

#define

Suggested default values for DCDC_COULOMB_COUNTER configuration structure.

#define

Suggested default values for DCDC_COULOMB_COUNTER calibration configuration structure.

Enumeration Documentation#

sl_dcdc_coulomb_counter_emode_t#

sl_dcdc_coulomb_counter_emode_t

DCDC_COULOMB_COUNTER supported energy mode.

Enumerator
SL_DCDC_COULOMB_COUNTER_EM0

EM0/1 energy mode.

SL_DCDC_COULOMB_COUNTER_EM2

EM2/3 energy mode.


Definition at line 56 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_calibration_load_level_t#

sl_dcdc_coulomb_counter_calibration_load_level_t

DCDC_COULOMB_COUNTER Calibration Load Current Level setting.

Enumerator
SL_DCDC_COULOMB_COUNTER_CAL_LOAD0

Nominal Load 0.25mA.

SL_DCDC_COULOMB_COUNTER_CAL_LOAD1

Nominal Load 0.50mA.

SL_DCDC_COULOMB_COUNTER_CAL_LOAD2

Nominal Load 1.00mA.

SL_DCDC_COULOMB_COUNTER_CAL_LOAD3

Nominal Load 1.50mA.

SL_DCDC_COULOMB_COUNTER_CAL_LOAD4

Nominal Load 2.00mA.

SL_DCDC_COULOMB_COUNTER_CAL_LOAD5

Nominal Load 4.00mA.

SL_DCDC_COULOMB_COUNTER_CAL_LOAD6

Nominal Load 6.00mA.

SL_DCDC_COULOMB_COUNTER_CAL_LOAD7

Nominal Load 8.00mA.


Definition at line 62 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

Function Documentation#

sl_dcdc_coulomb_counter_init#

void sl_dcdc_coulomb_counter_init (const sl_dcdc_coulomb_counter_config_t * p_config)

Initializes DCDC_COULOMB_COUNTER module.

Parameters
[in]p_config

A pointer to the DCDC_COULOMB_COUNTER initialization structure variable.


Definition at line 117 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_enable#

void sl_dcdc_coulomb_counter_enable (void )

Enables DCDC_COULOMB_COUNTER module.

Parameters
N/A

Definition at line 122 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_disable#

void sl_dcdc_coulomb_counter_disable (void )

Disables DCDC_COULOMB_COUNTER module.

Parameters
N/A

Definition at line 131 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_wait_start#

void sl_dcdc_coulomb_counter_wait_start (void )

Waits for the DCDC_COULOMB_COUNTER to complete START command.

Parameters
N/A

Definition at line 136 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_wait_stop#

void sl_dcdc_coulomb_counter_wait_stop (void )

Waits for the DCDC_COULOMB_COUNTER to complete STOP command.

Parameters
N/A

Definition at line 147 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_wait_clear_counters#

void sl_dcdc_coulomb_counter_wait_clear_counters (void )

Waits for the DCDC_COULOMB_COUNTER to complete CLR command.

Parameters
N/A

Definition at line 158 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_start#

void sl_dcdc_coulomb_counter_start (void )

Starts DCDC_COULOMB_COUNTER operation.

Parameters
N/A

Note

  • This function will send a start command to the DCDC_COULOMB_COUNTER peripheral. The sl_dcdc_coulomb_counter_wait_start() function can be used to wait for the start command to be executed.

  • This function requires the DCDC_COULOMB_COUNTER to be enabled.


Definition at line 175 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_stop#

void sl_dcdc_coulomb_counter_stop (void )

Stops the DCDC_COULOMB_COUNTER operation.

Parameters
N/A

Note

  • This function will send a stop command to the DCDC_COULOMB_COUNTER peripheral. The sl_dcdc_coulomb_counter_wait_stop() function can be used to wait for the stop command to be executed.

  • This function requires the DCDC_COULOMB_COUNTER to be enabled.


Definition at line 190 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_clear_counters#

void sl_dcdc_coulomb_counter_clear_counters (void )

Clears the DCDC_COULOMB_COUNTER counters.

Parameters
N/A

Note

  • This function will send a clear command to the DCDC_COULOMB_COUNTER peripheral. The sl_dcdc_coulomb_counter_wait_clear_counters() function can be used to wait for the clear command to be executed.

  • This function requires the DCDC_COULOMB_COUNTER to be enabled.


Definition at line 205 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_get_count#

uint32_t sl_dcdc_coulomb_counter_get_count (sl_dcdc_coulomb_counter_emode_t emode)

Gets the DCDC_COULOMB_COUNTER count for the selected energy mode.

Parameters
[in]emode

The energy mode requested will select the appropriate counter.

Returns

  • Coulomb Counter Count Value.


Definition at line 218 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_get_status#

uint32_t sl_dcdc_coulomb_counter_get_status (void )

Gets DCDC_COULOMB_COUNTER STATUS register value.

Parameters
N/A

Returns

  • Current STATUS register value.


Definition at line 225 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_enable_interrupts#

void sl_dcdc_coulomb_counter_enable_interrupts (uint32_t flags)

Enables one or more DCDC_COULOMB_COUNTER interrupts.

Parameters
[in]flags

DCDC_COULOMB_COUNTER interrupt sources to enable. Use a set of interrupt flags OR-ed together to set multiple interrupt sources.

Note

  • Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. To ignore a pending interrupt, consider using sl_dcdc_coulomb_counter_clear_interrupts() prior to enabling the interrupt.


Definition at line 241 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_disable_interrupts#

void sl_dcdc_coulomb_counter_disable_interrupts (uint32_t flags)

Disables one or more DCDC_COULOMB_COUNTER interrupts.

Parameters
[in]flags

DCDC_COULOMB_COUNTER interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt sources.


Definition at line 253 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_clear_interrupts#

void sl_dcdc_coulomb_counter_clear_interrupts (uint32_t flags)

Clears one or more pending DCDC_COULOMB_COUNTER interrupts.

Parameters
[in]flags

DCDC_COULOMB_COUNTER interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources.


Definition at line 265 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_get_interrupts#

uint32_t sl_dcdc_coulomb_counter_get_interrupts (void )

Gets pending DCDC_COULOMB_COUNTER interrupt flags.

Parameters
N/A

Note

  • Event bits are not cleared by using this function.

Returns

  • Pending DCDC_COULOMB_COUNTER interrupt sources. Returns a set of interrupt flags OR-ed together for multiple interrupt sources.


Definition at line 279 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_get_enabled_interrupts#

uint32_t sl_dcdc_coulomb_counter_get_enabled_interrupts (void )

Gets enabled and pending DCDC_COULOMB_COUNTER interrupt flags.

Parameters
N/A

Useful for handling more interrupt sources in the same interrupt handler.

Note

  • Interrupt flags are not cleared by using this function.

Returns

  • Pending and enabled DCDC_COULOMB_COUNTER interrupt sources. The return value is the bitwise AND of

    • the enabled interrupt sources in DCDC_COULOMB_COUNTER_IEN and

    • the pending interrupt flags DCDC_COULOMB_COUNTER_IF.


Definition at line 295 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_set_interrupts#

void sl_dcdc_coulomb_counter_set_interrupts (uint32_t flags)

Sets one or more pending DCDC_COULOMB_COUNTER interrupts from Software.

Parameters
[in]flags

DCDC_COULOMB_COUNTER interrupt sources to set to pending. Use a set of interrupt flags OR-ed together to set multiple interrupt sources.


Definition at line 310 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_cal_init#

void sl_dcdc_coulomb_counter_cal_init (sl_dcdc_coulomb_counter_calibration_config_t config)

Initializes the calibration of the DCDC Coulomb Counter.

Parameters
[in]config

DCDC_COULOMB_COUNTER calibration configuration structure.

Note

  • The charge per pulse is measured using known on-chip calibration loads, a PRS channel, and the CMU RC oscillator calibration circuitry.


Definition at line 323 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_cal_start#

void sl_dcdc_coulomb_counter_cal_start (void )

Starts DCDC_COULOMB_COUNTER calibration sequence.

Parameters
N/A

Definition at line 328 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_cal_stop#

void sl_dcdc_coulomb_counter_cal_stop (void )

Stops DCDC_COULOMB_COUNTER calibration sequence.

Parameters
N/A

Note

  • The Calibration Load will be disabled.


Definition at line 335 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_enable_cal_load#

void sl_dcdc_coulomb_counter_enable_cal_load (void )

Enables the Calibration Load.

Parameters
N/A

Definition at line 340 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_disable_cal_load#

void sl_dcdc_coulomb_counter_disable_cal_load (void )

Disables the Calibration Load.

Parameters
N/A

Definition at line 345 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_set_cal_load_level#

void sl_dcdc_coulomb_counter_set_cal_load_level (sl_dcdc_coulomb_counter_emode_t emode, sl_dcdc_coulomb_counter_calibration_load_level_t load_level)

Sets the Calibration Load level.

Parameters
[in]emode

The energy mode requested will adjust the compensation circuit.

[in]load_level

The load level to adjust the load current.


Definition at line 353 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_get_cal_load_current#

uint16_t sl_dcdc_coulomb_counter_get_cal_load_current (sl_dcdc_coulomb_counter_calibration_load_level_t load_level)

Gets the calibration load current from the stored value in DEVINFO as measured during production testing.

Parameters
[in]load_level

The load level requested.

Returns

  • The calibration load current.

Note

  • The returned value can be converted into uA by dividing by 5.

  • Each calibration load setting is a 16-bit value with each LSB representing 200 nA.


Definition at line 369 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_get_cal_reference_freq#

uint32_t sl_dcdc_coulomb_counter_get_cal_reference_freq (void )

Gets the frequency (in Hz) of the CMU Calibration Up-Counter source.

Parameters
N/A

Returns

  • The frequency (in Hz) of the currently selected CMU Up-Counter clock source.


Definition at line 377 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_set_calhalt#

void sl_dcdc_coulomb_counter_set_calhalt (void )

Sets the calibration Halt Flag.

Parameters
N/A

Definition at line 382 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

sl_dcdc_coulomb_counter_calhalt_is_set#

bool sl_dcdc_coulomb_counter_calhalt_is_set (void )

Gets the calibration Halt Flag.

Parameters
N/A

Returns

  • true if Halt Flag is set.


Definition at line 392 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

Macro Definition Documentation#

DCDC_COULOMB_COUNTER_CONFIG_DEFAULT#

#define DCDC_COULOMB_COUNTER_CONFIG_DEFAULT
Value:
{ \
0x8000, /* Coulomb Counter EM0 Threshold. */ \
0x8000, /* Coulomb Counter EM2 Threshold. */ \
}

Suggested default values for DCDC_COULOMB_COUNTER configuration structure.


Definition at line 92 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h

DCDC_COULOMB_COUNTER_CALIBRATION_CONFIG_DEFAULT#

#define DCDC_COULOMB_COUNTER_CALIBRATION_CONFIG_DEFAULT
Value:
{ \
cmuSelect_HFXO, /* Coulomb Counter Calibration Reference Clock. */ \
8, /* Coulomb Counter Calibration Reference Count. */ \
SL_DCDC_COULOMB_COUNTER_EM0, /* Coulomb Counter Calibration DC-DC energy mode. */ \
SL_DCDC_COULOMB_COUNTER_CAL_LOAD3, /* Coulomb Counter Calibration Load. */ \
}

Suggested default values for DCDC_COULOMB_COUNTER calibration configuration structure.


Definition at line 99 of file platform/peripheral/inc/peripheral_dcdc_coulomb_counter.h