EPC9143 300 W 16th Brick DC/DC Module Reference Design

Public functions of the HSPWM PRAL driver. More...

+ Collaboration diagram for Public Functions:

Functions

volatile uint16_t p33c_PwmGenerator_GetInstance (volatile struct P33C_PWM_GENERATOR_s *pg)
 Get the PWM generator index. More...
 
volatile uint16_t p33c_PwmGenerator_GetGroup (volatile struct P33C_PWM_GENERATOR_s *pg)
 Get the PWM generator group. More...
 
volatile uint16_t p33c_PwmModule_Initialize (void)
 Initializes the PWM base module by resetting all its registers to default. More...
 
volatile struct P33C_PWM_MODULE_sp33c_PwmModule_GetHandle (void)
 Gets pointer to PWM module SFR set. More...
 
volatile uint16_t p33c_PwmModule_Dispose (void)
 Resets all PWM base module registers to their RESET default values. More...
 
volatile struct P33C_PWM_MODULE_s p33c_PwmModule_ConfigRead (void)
 Read the current configuration from the PWM base module registers. More...
 
volatile uint16_t p33c_PwmModule_ConfigWrite (volatile struct P33C_PWM_MODULE_s pwmConfig)
 Writes a user-defined configuration to the PWM base module registers. More...
 
volatile struct P33C_PWM_GENERATOR_s p33c_PwmGenerator_ConfigRead (volatile uint16_t pgInstance)
 Disposes a given PWM generator by resetting all its registers to default. More...
 
volatile uint16_t p33c_PwmGenerator_ConfigWrite (volatile uint16_t pgInstance, volatile struct P33C_PWM_GENERATOR_s pgConfig)
 Disposes a given PWM generator by resetting all its registers to default. More...
 
volatile uint16_t p33c_PwmGenerator_Initialize (volatile uint16_t pgInstance)
 Initializes a given PWM generator by resetting all its registers to default. More...
 
volatile uint16_t p33c_PwmGenerator_Dispose (volatile uint16_t pgInstance)
 Disposes a given PWM generator by resetting all its registers to default. More...
 
volatile uint16_t p33c_PwmGenerator_Enable (volatile struct P33C_PWM_GENERATOR_s *pg)
 Enables a given PWM generator with output pins disabled. More...
 
volatile uint16_t p33c_PwmGenerator_Disable (volatile struct P33C_PWM_GENERATOR_s *pg)
 Disables a given PWM generator. More...
 
volatile uint16_t p33c_PwmGenerator_Resume (volatile struct P33C_PWM_GENERATOR_s *pg)
 Disables a PWM generator IOs. More...
 
volatile uint16_t p33c_PwmGenerator_Suspend (volatile struct P33C_PWM_GENERATOR_s *pg)
 Disables the PWM generator outputs but keeps the module running. More...
 
volatile uint16_t p33c_PwmGenerator_SetPeriod (volatile struct P33C_PWM_GENERATOR_s *pg, volatile uint16_t period)
 Sets the period of a given PWM generator. More...
 
volatile uint16_t p33c_PwmGenerator_SetDutyCycle (volatile struct P33C_PWM_GENERATOR_s *pg, volatile uint16_t duty)
 Sets the on-time of a given PWM generator. More...
 
volatile uint16_t p33c_PwmGenerator_SetDeadTimes (volatile struct P33C_PWM_GENERATOR_s *pg, volatile uint16_t dead_time_rising, volatile uint16_t dead_time_falling)
 Sets the dead-times of a given PWM generator. More...
 
volatile struct P33C_PWM_GENERATOR_sp33c_PwmGenerator_GetHandle (volatile uint16_t pgInstance)
 Returns the PWM generator index. More...
 
volatile uint16_t p33c_PwmGenerator_SyncGenerators (volatile struct P33C_PWM_GENERATOR_s *pgHandleMother, volatile uint16_t pgMotherTriggerOutput, volatile struct P33C_PWM_GENERATOR_s *pgHandleChild, volatile bool ChildImmediateUpdate)
 Sets the synchronization triggers of two PWM generators, of which the Mother PWM generator is the trigger provider and the Child PWM generator is the synchronization trigger receiver. More...
 

Detailed Description

Public functions of the HSPWM PRAL driver.

This is the detailed description of public functions of the HSPWM PRAL driver

Function Documentation

◆ p33c_PwmGenerator_ConfigRead()

struct P33C_PWM_GENERATOR_s p33c_PwmGenerator_ConfigRead ( volatile uint16_t  pgInstance)

Disposes a given PWM generator by resetting all its registers to default.

Parameters
uint16_tpgInstance: Instance of the PWM generator (e.g. 1 = PG1, 2=PG2, etc.)
Returns
struct P33C_PWM_GENERATOR_s: generic PWM generator Special Function Register set

This function copies the contents of all PWM generator registers of the specified generator instance (e.g. PG2) to a user variable of type P33C_PWM_GENERATOR_t. This 'virtual' PWM configuration can then , for
example, be analyzed and/or modified in user code and applied to another PWM generator using the function p33c_PwmGenerator_ConfigWrite(...).

Definition at line 158 of file p33c_pwm.c.

◆ p33c_PwmGenerator_ConfigWrite()

uint16_t p33c_PwmGenerator_ConfigWrite ( volatile uint16_t  pgInstance,
volatile struct P33C_PWM_GENERATOR_s  pgConfig 
)

Disposes a given PWM generator by resetting all its registers to default.

Parameters
pgInstanceInstance of the PWM generator (e.g. 1 = PG1, 2=PG2, etc.)
structP33C_PWM_GENERATOR_s: generic PWM generator Special Function Register set
Returns
0 = failure, disposing PWM generator was not successful
1 = success, disposing PWM generator was successful

This function writes a user-defined PWM generator configuration of type P33C_PWM_GENERATOR_t to the given PWM generator peripheral instance (e.g. PG2).

Definition at line 217 of file p33c_pwm.c.

+ Here is the caller graph for this function:

◆ p33c_PwmGenerator_Disable()

uint16_t p33c_PwmGenerator_Disable ( volatile struct P33C_PWM_GENERATOR_s pg)

Disables a given PWM generator.

Parameters
structP33C_PWM_GENERATOR_s* pg
Returns
0 = failure, disabling PWM generator was not successful
1 = success, disabling PWM generator was successful

This function disables the PWM Generator and locks its PWM output pins in a safe state.

Definition at line 366 of file p33c_pwm.c.

+ Here is the caller graph for this function:

◆ p33c_PwmGenerator_Dispose()

uint16_t p33c_PwmGenerator_Dispose ( volatile uint16_t  pgInstance)

Disposes a given PWM generator by resetting all its registers to default.

Parameters
uint16_tpgInstance: Instance of the PWM generator (e.g. 1 = PG1, 2=PG2, etc.)
Returns
0 = failure, disposing PWM generator was not successful
1 = success, disposing PWM generator was successful

This function disables the specified PWM Generator and clears all its Special Function Registers (SFR) to their RESET default values.

Definition at line 290 of file p33c_pwm.c.

+ Here is the call graph for this function:

◆ p33c_PwmGenerator_Enable()

uint16_t p33c_PwmGenerator_Enable ( volatile struct P33C_PWM_GENERATOR_s pg)

Enables a given PWM generator with output pins disabled.

Parameters
structP33C_PWM_GENERATOR_s* pg
Returns
0 = failure, enabling PWM generator was not successful
1 = success, enabling PWM generator was successful

This function enables the PWM Generator and adds delay before enabling
PWM output pins. After having successfully enabled the generator, users need to call function PWM_Generator_Resume to allow the PWM generator

Definition at line 316 of file p33c_pwm.c.

◆ p33c_PwmGenerator_GetGroup()

volatile uint16_t p33c_PwmGenerator_GetGroup ( volatile struct P33C_PWM_GENERATOR_s pg)

Get the PWM generator group.

volatile uint16_t p33c_PwmGenerator_GetGroup(volatile struct P33C_PWM_GENERATOR_s* pg)

Parameters
structP33C_PWM_GENERATOR_s* pg: Pointer to PWM generator instance SFRs
Returns
0 = error, PWM generator group not found
1 = PWM generator is in group #1
2 = PWM generator is in group #2

This function identify the group toi which PWM generator belongs (1 = [PG1-PG4], 2 = [PG5-PG8]) and verify if the PWMgenerator group is valid and available. If no group is found, the function returns '0'

Definition at line 614 of file p33c_pwm.c.

◆ p33c_PwmGenerator_GetHandle()

struct P33C_PWM_GENERATOR_s * p33c_PwmGenerator_GetHandle ( volatile uint16_t  pgInstance)

Returns the PWM generator index.

Parameters
uint16_tpgInstance: Index of the selected PWM generator (1=PG1, 2=PG2, etc.)
Returns
struct P33C_PWM_GENERATOR_s*: Pointer to PWM generator object of the selected PWM generator instance

This function returns the PWM generator index, the PWM generator group (1 = [PG1-PG4], 2 = [PG5-PG8]) and the address pointer (pgHandle) of the PWM generator Special Function Register set. pgHandle can be used to directly read from/write to PWM registers of the selected PWM generator with zero API overhead.

Definition at line 555 of file p33c_pwm.c.

+ Here is the caller graph for this function:

◆ p33c_PwmGenerator_GetInstance()

volatile uint16_t p33c_PwmGenerator_GetInstance ( volatile struct P33C_PWM_GENERATOR_s pg)

Get the PWM generator index.

volatile uint16_t p33c_PwmGenerator_GetInstance(volatile struct P33C_PWM_GENERATOR_s* pg)

Parameters
structP33C_PWM_GENERATOR_s* pg: Pointer to PWM generator instance SFRs
Returns
0 = failure, disabling PWM generator was not successful
1 = success, disabling PWM generator was successful

This function gets the PWM generator index, the PWM generator group (1 = [PG1-PG4], 2 = [PG5-PG8]) and the address pointer (pgInstance) of the PWM generator Special Function Register set. pgInstance can be used to directly read from/write to PWM registers of the selected PWM generator with zero API overhead.

Definition at line 582 of file p33c_pwm.c.

◆ p33c_PwmGenerator_Initialize()

uint16_t p33c_PwmGenerator_Initialize ( volatile uint16_t  pgInstance)

Initializes a given PWM generator by resetting all its registers to default.

Parameters
uint16_tpgInstance: Instance of the PWM generator (e.g. 1 = PG1, 2=PG2, etc.)
Returns
0 = failure, disposing PWM generator was not successful
1 = success, disposing PWM generator was successful

This function initializes the specified PWM Generator with default input clock settings and high resolution mode enabled. All other Special Function Registers (SFR) are reset to their RESET default values.

Definition at line 250 of file p33c_pwm.c.

+ Here is the call graph for this function:

◆ p33c_PwmGenerator_Resume()

uint16_t p33c_PwmGenerator_Resume ( volatile struct P33C_PWM_GENERATOR_s pg)

Disables a PWM generator IOs.

Parameters
structP33C_PWM_GENERATOR_s* pg
Returns
0 = failure, enabling PWM generator IOs was not successful
1 = success, enabling PWM generator IOs was successful

This function enables the PWM Generator IO instance allowing signals to be routed to the output pins. This on/off transition occurs synchronously to the PWM period.

Definition at line 400 of file p33c_pwm.c.

◆ p33c_PwmGenerator_SetDeadTimes()

uint16_t p33c_PwmGenerator_SetDeadTimes ( volatile struct P33C_PWM_GENERATOR_s pg,
volatile uint16_t  dead_time_rising,
volatile uint16_t  dead_time_falling 
)

Sets the dead-times of a given PWM generator.

Parameters
structP33C_PWM_GENERATOR_s* pg
uint16_tdead_time_rising /
uint16_tdead_time_falling
Returns
0 = failure, disabling PWM generator was not successful
1 = success, disabling PWM generator was successful

This function writes the value specified by 'duty' to the DUTY CYCLE register of the specified PWM generator.

Definition at line 524 of file p33c_pwm.c.

◆ p33c_PwmGenerator_SetDutyCycle()

uint16_t p33c_PwmGenerator_SetDutyCycle ( volatile struct P33C_PWM_GENERATOR_s pg,
volatile uint16_t  duty 
)

Sets the on-time of a given PWM generator.

Parameters
structP33C_PWM_GENERATOR_s* pg
uint16_tduty
Returns
0 = failure, disabling PWM generator was not successful
1 = success, disabling PWM generator was successful

This function writes the value specified by 'duty' to the DUTY CYCLE register of the specified PWM generator.

Definition at line 490 of file p33c_pwm.c.

◆ p33c_PwmGenerator_SetPeriod()

uint16_t p33c_PwmGenerator_SetPeriod ( volatile struct P33C_PWM_GENERATOR_s pg,
volatile uint16_t  period 
)

Sets the period of a given PWM generator.

Parameters
structP33C_PWM_GENERATOR_s* pg
uint16_tperiod: Counter compare value of the generator time base
Returns
0 = failure, disabling PWM generator was not successful
1 = success, disabling PWM generator was successful

This function writes the value specified by 'period' to the PERIOD register of the specified PWM generator.

Definition at line 457 of file p33c_pwm.c.

◆ p33c_PwmGenerator_Suspend()

uint16_t p33c_PwmGenerator_Suspend ( volatile struct P33C_PWM_GENERATOR_s pg)

Disables the PWM generator outputs but keeps the module running.

Parameters
structP33C_PWM_GENERATOR_s* pg
Returns
0 = failure, enabling PWM generator IOs was not successful
1 = success, enabling PWM generator IOs was successful

This function disables the PWM Generator IO instance preventing signals to be routed to the output pins. This on/off transition occurs synchronously to the PWM period.

Definition at line 428 of file p33c_pwm.c.

◆ p33c_PwmGenerator_SyncGenerators()

uint16_t p33c_PwmGenerator_SyncGenerators ( volatile struct P33C_PWM_GENERATOR_s pgHandleMother,
volatile uint16_t  pgMotherTriggerOutput,
volatile struct P33C_PWM_GENERATOR_s pgHandleChild,
volatile bool  ChildImmediateUpdate 
)

Sets the synchronization triggers of two PWM generators, of which the Mother PWM generator is the trigger provider and the Child PWM generator is the synchronization trigger receiver.

Parameters
structP33C_PWM_GENERATOR_s* pgHandleMother: PWM generator object of triggering PWM generator (sync trigger provider)
uint16_tpgMotherTriggerOutput: Trigger output selection of sync trigger provider PWM generator 0 = EOC/SOC 1 = PGxTRIGA 2 = PGxTRIGB 3 = PGxTRIGC
structP33C_PWM_GENERATOR_s* pgHandleChild: PWM generator object of triggered PWM generator (sync trigger receiver)
boolChildImmediateUpdate: true = synchronization trigger synchronizes Child PWM generator at trigger edge false = synchronization trigger synchronizes Child PWM generator at EOC/SOC
Returns
0 = failure, PWM generator synchronization was not successful
1 = success, PWM generator synchronization was successful

This function sets the synchronization triggers of two PWM generators, of which the Mother PWM generator is the trigger provider and the Child PWM generator is the synchronization trigger receiver.

The Mother PWM generator is configured to broadcast its UPDATE bit and provides one of four, selectable synchronization trigger outputs (EOC/SOC, PGxTRIGA, PGxTRIGB or PGxTRIGC). The Mother PWM generator can be independent or being triggered by another PWM generator.

The Child PWM generator is configured to trigger on the event generated by the Mother PWM generator as configured above. The optional selection of immediate synchronization or synchronization of the SOC event is set by parameter ChildImmediateUpdate.

Definition at line 672 of file p33c_pwm.c.

◆ p33c_PwmModule_ConfigRead()

struct P33C_PWM_MODULE_s p33c_PwmModule_ConfigRead ( void  )

Read the current configuration from the PWM base module registers.

Returns
struct P33C_PWM_MODULE_s

This function reads all registers with their current configuration into a data structure of type P33C_PWM_MODULE_s. Users can read and verify of modify the configuration to write it back to the PWM module
base registers.

Definition at line 104 of file p33c_pwm.c.

◆ p33c_PwmModule_ConfigWrite()

uint16_t p33c_PwmModule_ConfigWrite ( volatile struct P33C_PWM_MODULE_s  pwmConfig)

Writes a user-defined configuration to the PWM base module registers.

Parameters
structP33C_PWM_MODULE_s pwmConfig
Returns
0 = failure, disposing PWM generator was not successful
1 = success, disposing PWM generator was successful

This function writes a user-defined PWM module configuration of type P33C_PWM_MODULE_s to the PWM module base registers. The individual register configurations have to be set in user-code before calling this function. To simplify the configuration process of standard functions, this driver provides templates, which can be loaded and written directly (see function p33c_PwmInitialize(void) for details)

Definition at line 158 of file p33c_pwm.c.

+ Here is the caller graph for this function:

◆ p33c_PwmModule_Dispose()

uint16_t p33c_PwmModule_Dispose ( void  )

Resets all PWM base module registers to their RESET default values.

Returns
0 = failure, disposing PWM generator was not successful
1 = success, disposing PWM generator was successful

This function clears all PWM module base registers to their default values set when the device comes out of RESET.

Default configuration:

  • no main input clock source and scalers are selected
  • all output logic functions are disabled
  • all output logic events are disabled
  • all master timing registers are cleared
  • all PWM register locks are removed, allowing unrestricted SFR writes

Definition at line 104 of file p33c_pwm.c.

+ Here is the call graph for this function:

◆ p33c_PwmModule_GetHandle()

struct P33C_PWM_MODULE_s * p33c_PwmModule_GetHandle ( void  )

Gets pointer to PWM module SFR set.

Returns
struct P33C_PWM_GENERATOR_s: PWM generator object of the selected PWM generator instance

This function returns the PWM generator index, the PWM generator group (1 = [PG1-PG4], 2 = [PG5-PG8]) and the address pointer (handle) of the PWM generator Special Function Register set. handle can be used to directly read from/write to PWM registers of the selected PWM generator with zero API overhead.

Definition at line 74 of file p33c_pwm.c.

+ Here is the caller graph for this function:

◆ p33c_PwmModule_Initialize()

uint16_t p33c_PwmModule_Initialize ( void  )

Initializes the PWM base module by resetting all its registers to default.

Returns
0 = failure, disposing PWM generator was not successful
1 = success, disposing PWM generator was successful

This function initializes the PWM module base registers with default values for maximum performance.

Default configuration:

  • auxiliary clock is selected as main input clock source
  • all output logic functions are disabled
  • all output logic events are disabled
  • all master timing registers are cleared
  • all PWM register locks are removed, allowing unrestricted SFR writes

Definition at line 50 of file p33c_pwm.c.

+ Here is the call graph for this function: