MTB CAT1 Peripheral driver library

General Description

This driver provides API functions to configure, manage and interact with the Autonomous Controller (AC) subsystem within High Performance Programmable Analog Sub-System (HPPASS).

The autonomous controller is a programmable finite-state machine (FSM) sequencer that works from a 16-entry state transition table, to transition appropriately through various pre-defined states, based on timer, counter, and/or events. The AC provides hardware control without the need for CPU or external intervention.
The internal structure and external HW interface of the AC is shown at the picture below.

hppass_ac_structure.png

Autonomous controller can perform the following functions:

The AC has a standard interface to each sub-block of HPPASS, the interface consists of: Enable, Trigger, and Conditions signals groups.

Refer to the Technical Reference Manual for detailed information.

To configure the AC, the driver uses a configuration structure of type cy_stc_hppass_ac_t that must be predefined. In turn, this structure holds the non-NULL pointer to the State Transition Table (STT) array of type cy_stc_hppass_ac_stt_t. The configuration structure also holds a specialized startup configuration array of type cy_stc_hppass_startup_t.
This array defines the parameters of the AC HW startup.

State Transition Table

The AC can implement a single threaded programming sequence using a simple format. The AC program is stored in a RAM table called a STT, which consists of 16 States (or programming instructions) of type cy_stc_hppass_ac_stt_t. These programming instructions can form one or more programs, called by FW, like subroutines.

Note
At least one state (e.g. 'Stop') of the state transition table must be predefined in the STT.
The CSG and/or SAR should be enabled in the first state of the STT to ensure proper working of the AC.

Here is an example of a simple program coded by STT instructions.

#define CY_HPPASS_STT_NUM_ENTRIES (4U) /* Define number of states */
const cy_stc_hppass_ac_stt_t stt_cfg[CY_HPPASS_STT_NUM_ENTRIES] =
{
/* STATE #0: Set P7_0, P7_1 HIGH for ((.count + 1) * clock period) value */
{
.condition = CY_HPPASS_CONDITION_CNT_DONE, /* Set the condition for moving to the next state */
.action = CY_HPPASS_ACTION_WAIT_FOR, /* Wait in this state until .count = 199 cycles */
.branchStateIdx = 0U, /* Ignored in this state */
.interrupt = false,
.count = 199U, /* Set the counter value in cycles */
.gpioOutUnlock = true, /* Unlock the GPIO Out for AC */
.gpioOutMsk = CY_HPPASS_GPIO_OUT_0 | CY_HPPASS_GPIO_OUT_1, /* Enable GPIO_OUT0 and GPIO_OUT1 in this state */
.csgUnlock = {false, false, false, false, false},
.csgEnable = {false, false, false, false, false},
.csgDacTrig = {false, false, false, false, false},
.sarUnlock = false,
.sarEnable = false,
.sarGrpMsk = 0U,
.sarMux = {{0}, {0}, {0}, {0}}
},
/* STATE #1: Set P7_0 LOW for ((.count + 1) * clock period) value */
{
.condition = CY_HPPASS_CONDITION_CNT_DONE, /* Set the condition for moving to the next state */
.action = CY_HPPASS_ACTION_WAIT_FOR, /* Wait in this state until .count = 199 cycles */
.branchStateIdx = 0U, /* Ignored in this state */
.interrupt = false,
.count = 199U, /* Set the counter value in cycles */
.gpioOutUnlock = true, /* Keep unlock the GPIO Out for AC */
.gpioOutMsk = CY_HPPASS_GPIO_OUT_0, /* GPIO_OUT0 is still Enabled and GPIO_OUT1 becomes disabled */
.csgUnlock = {false, false, false, false, false},
.csgEnable = {false, false, false, false, false},
.csgDacTrig = {false, false, false, false, false},
.sarUnlock = false,
.sarEnable = false,
.sarGrpMsk = 0U,
.sarMux = {{0}, {0}, {0}, {0}}
},
/* STATE #2: Set P7_0, P7_1 LOW for ((.count + 1) * clock period) value */
{
.condition = CY_HPPASS_CONDITION_CNT_DONE, /* Set the condition for moving to the next state */
.action = CY_HPPASS_ACTION_WAIT_FOR, /* Go to branch state 3 if the condition TRUE */
.branchStateIdx = 0U, /* Ignored in this state */
.interrupt = false,
.count = 199U,
.gpioOutUnlock = true, /* Keep unlock the GPIO Out for AC */
.gpioOutMsk = MY_HPPASS_GPIO_OUT_DISABLE_ALL, /* Disable All HPPASS AC GPIOs in this state*/
.csgUnlock = {false, false, false, false, false},
.csgEnable = {false, false, false, false, false},
.csgDacTrig = {false, false, false, false, false},
.sarUnlock = false,
.sarEnable = false,
.sarGrpMsk = 0U,
.sarMux = {{0}, {0}, {0}, {0}}
},
/* STATE #3: Go to the stage 0 */
{
.condition = CY_HPPASS_CONDITION_TRUE, /* Set condition TRUE */
.action = CY_HPPASS_ACTION_BRANCH_IF_TRUE, /* Go to branch state 0 if condition TRUE */
.branchStateIdx = 0U, /* Set branch state 0 */
.interrupt = false,
.count = 0U,
.gpioOutUnlock = false, /* Don't change the GPIO in this state */
.gpioOutMsk = MY_HPPASS_GPIO_OUT_DISABLE_ALL, /* This value is ignored here because gpioOutUnlock = false */
.csgUnlock = {false, false, false, false, false},
.csgEnable = {false, false, false, false, false},
.csgDacTrig = {false, false, false, false, false},
.sarUnlock = false,
.sarEnable = false,
.sarGrpMsk = 0U,
.sarMux = {{0}, {0}, {0}, {0}}
}
};

Startup

Startup is initiated by enabling the AC with loaded AC startup sequence instructions (cy_stc_hppass_ac_t::startup). The startup block have dedicated logic to time the HPPASS startup and will generate BLOCK_READY condition once HPPASS startup is done. The application should wait for the BLOCK_READY condition before using any HPPASS features. The BLOCK_READY condition can be checked by Cy_HPPASS_AC_IsBlockReady function.

Note
Only usage of the startup parameters recommended by the vendor guarantees the reliable work of the autonomous controller.
Please use the Device Configurator tool to make configurations or refer to the Technical Reference Manual chapter 27.2.1.1 for detailed information.

Code Snippets

Snippet 1: GPIO Toggling by Autonomous Controller

An example is shown below, describes a simple case of usage Autonomous Controller for toggling GPIO Out:

Snippet 2: The AC state triggering by FW and HW input triggers

The below example is a simple case of using HPPASS input trigger events to trigger the Autonomous Controller state. The code snippet shows two approaches: FW trigger and HW trigger configurations.

API Reference

 Macros
 
 Functions
 
 Data Structures
 
 Enumerated Types