AURIX™ MCU: Using the AURIX™ Special Function Register Group definitions - KBA235505
Use the AURIX™ Special Function Register (SFR) Group when the hardware (HW) function block or sub block instances repeat multiple times. This helps in error-free and resource-efficient software development resulting in:
- Single image of driver software that is developed to access such blocks
- Possibility to iterate (in loop) to configure such blocks
To further detail the proposal: AURIX™ SFR C Header Files organize the registers as register groups, in the same hierarchy as they appear in HW function block. This enables encapsulation of the peripheral HW modules (C Structure representation of HW kernel register map) as shown in Figure 1.
Figure 1 Peripheral HW modules
Figure 2 shows the usage of grouped structures with Controller Area Network (CAN) as an example to show single software image scenario using AURIX™ TC3xx MCMCAN represented in C structure. Here, each CAN node (sub block) is instantiated as sub structure.
Figure 2 CAN structures
To control a CAN node, it is enough to develop single API, which takes the pointer to SFR as argument as shown in the following example:
void IfxCan_Node_setFrameMode(Ifx_CAN_N *node, IfxCan_FrameMode frameMode)
As shown in the code above, the first parameter in the IfxCan_Node_setFrameMode function is pointer to Ifx_CAN_N. This API with the same signature and the same image stored once in the code memory, could be used across all available CAN nodes.
Following code snippet shows how the above API could be called for node 0
Note: This KBA applies to the following series of AURIX™ MCUs:
- AURIX™ TC2xx series
- AURIX™ TC3xx series