This driver provides API functions to configure the Autonomous Controller (AC) subsystem within the Autonomous Analog.
The AC controls the entire operation of the Autonomous Analog. This includes enabling/disabling analog blocks, configuring them using the dynamic part of the configuration, checking state/status and handling events by taking conditional actions, managing intermediate data and notifying the host MCU/peripheral using interrupts/triggers.
The diagram below shows the AC simplified internals.
For more information on the AC, refer to the device Architecture Technical Reference Manual (TRM).
For the exact location of the digital outputs pins, see the device datasheet.
State Transition Table
The AC FSM is based on a sequencer that can operate in all power modes except Hibernate. The set of operating states for this sequencer is named the State Transition Table (STT). The total number of the states in the STT is 64. The STT of Autonomous Analog is defined by cy_stc_autanalog_stt_t and illustrated on the diagram below.
The AC part of the STT (STT AC) is configured with cy_stc_autanalog_stt_ac_t and described below. The STTs for other subsystems are described in the relevant chapter for each subsystem.
In each state of the STT, the AC interacts with other subsystems of the Autonomous Analog via a standard interface (see AC Interface chapter). This interaction includes receiving the subsystem status and issuing the appropriate action (if any), see AC Conditions and Actions chapter.
The AC can change the STT state sequentially or take branch conditionally, depending on events from the subsystems of the Autonomous Analog.
AC Interface
The AC has a standard interface for each sub-system of the Autonomous Analog:
The subsystems provide their interfaces for the AC in the cy_stc_autanalog_stt_t configuration structure. The complete STT configuration contains the total number of states used in the STT (cy_stc_autanalog_t::numSttEntries) and a pointer to the array of configured interfaces of that size (cy_stc_autanalog_t::stateTransitionTable).
AC Conditions and Actions
The CONDITION events (cy_en_autanalog_stt_ac_condition_t) are statuses from the sub-systems of the Autonomous Analog for the AC that can be used to branch (cy_en_autanalog_stt_ac_action_t) the program execution (i.e. change the STT state) and/or triggering an appropriate action for the subsystem (e.g. cy_stc_autanalog_stt_dac_t::trigger).
AC Loop/Interval Counters
The AC contains four Loop/Interval counters that are programmatically assigned to the STT states. These down counters are used by the AC to implement delays in a given STT state (interval) or loop constructions that may contain several STT states. The AC can support up to 4 loop counters, or up to 3 loop counters and 1 interval counter. The counters periods are programmed with cy_stc_autanalog_stt_ac_t::count. Every AC clock cycle (see AC Clock chapter), the counter value decrements. When the counter value reaches zero (terminal count), the counter asserts a CNT_DONE trigger that is read by the AC.
The current state of the Loop/Interval Counter represents cy_stc_autanalog_state_tc_t configuration structure.
Loop Counters
The loop counters are used for repeating certain STT states for a finite number of times. The user requests a Loop Counter by programming a particular STT state with the BRANCH_IF_* action and CNT_DONE condition.
- Note
- When programming the AC to jump back to a particular state,
it is recommended to use ACTION = BRANCH_IF_TRUE/BRANCH_IF_TRUE_CLR, CONDITION = TRUE.
Avoid using ACTION = BRANCH_IF_FALSE/BRANCH_IF_FALSE_CLR, CONDITION = FALSE,
as it could may cause unexpected issues.
Interval Counter
The interval counters are used for waiting in a particular STT state for a finite amount of time. The user requests an Interval Counter by programming a particular STT state with the WAIT_FOR action and CNT_DONE condition.
AC State
The current AC state represents the cy_stc_autanalog_state_ac_t configuration structure.
Autonomous Analog State
The current Autonomous Analog state represents the cy_stc_autanalog_state_t configuration structure.
High Speed and Low Power operation
The AC is available in both High Speed (HS) and Low Power (LP) modes. The operational mode of the AC determines the actual operation mode for the entire Autonomous Analog block (see cy_stc_autanalog_stt_ac_t::lpMode).
AC Clock
In HS mode, the AC is clocked from CLK_HF9 directly (80MHz max) and functions only in chip Active mode.
In LP mode, the AC is clocked from CLK_LPOSC (4.096MHz nominal) and functions in chip Active and Deep Sleep modes.
Power Management
In LP mode, the AC uses a dedicated logic for the Autonomous Analog digital logic duty cycling and minimizing both switching and leakage currents.
Duty Cycling
The AC requests a duty cycling event based on the programming of the ACTION and CONDITION (cy_en_autanalog_stt_ac_action_t and cy_en_autanalog_stt_ac_condition_t). Whenever the AC state is programmed with WAIT_FOR action and *_WAKEUP condition, a sleep request is sent to the duty cycle FSM.
For configuration settings, see the cy_stc_autanalog_stt_t configuration structure and refer to State Transition Table chapter for more information.
Wake-up Events and Wake-up Timer
The duty cycling FSM supports several different wake-up sources:
The wake-up Timer can be clocked from the 32kHz low frequency clock (CLK_LF) or (at the expense of additional switching current) the 4.096MHz low power oscillator (CLK_LPOSC).
For configuration settings, see the cy_stc_autanalog_timer_t configuration structure.
AC Configuration
The AC configuration includes:
For configuration settings, see the cy_stc_autanalog_ac_t configuration structure.
AC Digital Outputs
Four GPIOs can be directly controlled by the AC (cy_stc_autanalog_stt_ac_t::gpioOut) in runtime. Before using this option, they must be enabled in the AC configuration (cy_stc_autanalog_ac_t::gpioOutEn) and unlocked for a given state in the State Transition Table (cy_stc_autanalog_stt_ac_t::unlockGpioOut). The digital waveforms are constructed based on the duration of a current state in the State Transition Table (State Transition Table) and the order of state execution.
For more details, refer to the AC Configuration and State Transition Table chapters.
External Triggers
The trigger is the method to start the activity in a given chip block without MCU intervention. The AC supports four (hardware/firmware) input triggers and eight (cy_en_autanalog_ac_out_trigger_idx_t) output triggers.
Input Triggers
The input trigger can be initiated by an event on external block (HW trigger) or from the API (FW trigger, cy_en_autanalog_fw_trigger_t).
Firmware Triggers
The AC can use the FW triggers as the CONDITIONS (*_TR_AUTANALOG_IN*, cy_en_autanalog_stt_ac_condition_t) for the available ACTIONS (cy_en_autanalog_stt_ac_action_t).
For more details about the AC CONDITIONS and ACTIONS, refer to the AC Conditions and Actions chapter.
The FW trigger can be issued by means of the provided API, Cy_AutAnalog_FwTrigger.
Output Triggers
The output trigger can be initiated in response to an event within the Autonomous Analog. The set of such events is defined in cy_en_autanalog_ac_out_trigger_mask_t. The required output triggers must be enabled in the AC configuration structure (cy_stc_autanalog_ac_t::mask). Also, you can modify them at runtime using the provided API. Cy_AutAnalog_GetOutputTriggerMask, Cy_AutAnalog_SetOutputTriggerMask.
Sample use case: Interrupt and FW Trigger
The blinky LED example is based on the AC and State Transition Table.
The AC operates within the four states of the State Transition Table:
- State #0 is used to initialize the enabled subsystems of the Autonomous Analog;
- In state #1, the AC generates an interrupt;
- In State #2, the AC is used to wait for the FW trigger;
- State #3 is used for an unconditional return to State #1.
The following Autonomous Analog configuration structures are automatically generated by the Device Configurator.
{
.mask =
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
},
.timer =
{
.enable = false,
.period = 0U,
},
};
{
.ac = &CYBSP_AUTONOMOUS_CONTROLLER_cfg_,
.ctb =
{
NULL,
NULL,
},
.ptcomp =
{
NULL,
},
.dac =
{
NULL,
NULL,
},
.sar =
{
NULL,
},
};
{
{
.lpMode = true,
.branchState = 1U,
.trigInt = false,
.count = 0U,
.unlockGpioOut = false,
},
{
.unlock = false,
.lpMode = false,
.branchState = 0U,
.trigInt = true,
.count = 0U,
.unlockGpioOut = false,
},
{
.unlock = false,
.lpMode = false,
.branchState = 0U,
.trigInt = false,
.count = 0U,
.unlockGpioOut = false,
},
{
.unlock = false,
.lpMode = false,
.branchState = 1U,
.trigInt = false,
.count = 0U,
.unlockGpioOut = false,
},
};
{
{
.
ac = &CYBSP_AUTONOMOUS_CONTROLLER_stt_[0U],
.prb = NULL,
.ctb =
{
NULL,
NULL,
},
.ptcomp =
{
NULL,
},
.dac =
{
NULL,
NULL,
},
.sar =
{
NULL,
},
},
{
.ac = &CYBSP_AUTONOMOUS_CONTROLLER_stt_[1U],
.prb = NULL,
.ctb =
{
NULL,
NULL,
},
.ptcomp =
{
NULL,
},
.dac =
{
NULL,
NULL,
},
.sar =
{
NULL,
},
},
{
.ac = &CYBSP_AUTONOMOUS_CONTROLLER_stt_[2U],
.prb = NULL,
.ctb =
{
NULL,
NULL,
},
.ptcomp =
{
NULL,
},
.dac =
{
NULL,
NULL,
},
.sar =
{
NULL,
},
},
{
.ac = &CYBSP_AUTONOMOUS_CONTROLLER_stt_[3U],
.prb = NULL,
.ctb =
{
NULL,
NULL,
},
.ptcomp =
{
NULL,
},
.dac =
{
NULL,
NULL,
},
.sar =
{
NULL,
},
},
};
{
.numSttEntries = sizeof(autonomous_analog_stt_)/sizeof(autonomous_analog_stt_[0U]),
.stateTransitionTable = &autonomous_analog_stt_[0U],
};
cy_en_autanalog_stt_ac_gpio_out_t gpioOutEn
Control four GPIO outputs with the AC, see also cy_stc_autanalog_stt_ac_t::unlockGpioOut.
Definition: cy_autanalog_ac.h:989
bool unlock
AC mode unlock:
Definition: cy_autanalog_ac.h:1077
The AC configuration structure.
Definition: cy_autanalog_ac.h:988
The AC section in the State Transition Table state.
Definition: cy_autanalog_ac.h:1076
@ CY_AUTANALOG_STT_AC_CONDITION_TRUE
Unconditionally TRUE.
Definition: cy_autanalog_ac.h:356
@ CY_AUTANALOG_STT_AC_CONDITION_TR_AUTANALOG_IN0
External trigger 0 (or the FW trigger 0).
Definition: cy_autanalog_ac.h:605
@ CY_AUTANALOG_STT_AC_CONDITION_FALSE
Unconditionally FALSE.
Definition: cy_autanalog_ac.h:355
@ CY_AUTANALOG_STT_AC_CONDITION_BLOCK_READY
Enabled subsystems of the Autonomous Analog are initialized and ready for use.
Definition: cy_autanalog_ac.h:357
@ CY_AUTANALOG_STT_AC_GPIO_OUT_DISABLED
Control of the GPIO outs is disabled.
Definition: cy_autanalog_ac.h:291
@ CY_AUTANALOG_STT_AC_ACTION_WAIT_FOR
Wait (indefinitely) for the associated CONDITION to be TRUE before moving to the next state,...
Definition: cy_autanalog_ac.h:309
@ CY_AUTANALOG_STT_AC_ACTION_NEXT
Proceed to the next state in the STT.
Definition: cy_autanalog_ac.h:308
@ CY_AUTANALOG_STT_AC_ACTION_BRANCH_IF_TRUE
Check if CONDITION has occurred If it occurred, take the indicated branch cy_stc_autanalog_stt_ac_t::...
Definition: cy_autanalog_ac.h:312
@ CY_AUTANALOG_TIMER_CLK_LP
The Timer clocked from CLK_LPOSC (nominally 4.096MHz)
Definition: cy_autanalog_ac.h:943
cy_stc_autanalog_prb_t * prb
The pointer to the PRB configuration.
Definition: cy_autanalog.h:394
cy_stc_autanalog_stt_ac_t * ac
The pointer to the AC subsystem STT.
Definition: cy_autanalog.h:426
cy_stc_autanalog_cfg_t * configuration
The pointer to the whole configuration structure.
Definition: cy_autanalog.h:454
The configuration structure to set up the entire Autonomous Analog used with cy_stc_autanalog_t and C...
Definition: cy_autanalog.h:393
The configuration structure for one row of the State Transition Table, the array of these structures ...
Definition: cy_autanalog.h:425
The configuration and STT data to set up the entire Autonomous Analog, used in Cy_AutAnalog_Init.
Definition: cy_autanalog.h:453
The content of the application is presented below:
#include "cybsp.h"
#define LED_BLINK_DELAY (100000U)
volatile bool autonomous_analog_ac_int_flag = false;
void autonomous_analog_ac_int_hook(void)
{
{
autonomous_analog_ac_int_flag = true;
}
}
__STATIC_INLINE void Cy_AutAnalog_ClearInterrupt(uint32_t interrupt)
Clears the interrupts for the Autonomous Analog.
Definition: cy_autanalog.h:736
__STATIC_INLINE uint32_t Cy_AutAnalog_GetInterruptStatus(void)
Returns the status of combined Autonomous Analog interrupt requests.
Definition: cy_autanalog.h:718
#define CY_AUTANALOG_INT_AC
AC interrupt.
Definition: cy_autanalog.h:211
The content of main.c is shown below:
result = cybsp_init();
{
CY_ASSERT(0);
}
__enable_irq();
{
.
intrSrc = pass_interrupt_lppass_IRQn,
.intrPriority = 3u
};
{
CY_ASSERT(0);
}
NVIC_ClearPendingIRQ(pass_interrupt_lppass_IRQn);
NVIC_EnableIRQ(pass_interrupt_lppass_IRQn);
uint32_t autonomous_analog_init_status =
Cy_AutAnalog_Init(&autonomous_analog_init_);
{
}
else
{
CY_ASSERT(0);
}
uint32_t led_blink_delay = 0u;
for(;;)
{
if (autonomous_analog_ac_int_flag)
{
autonomous_analog_ac_int_flag = false;
if (++led_blink_delay == LED_BLINK_DELAY)
{
led_blink_delay = 0u;
}
}
}
@ CY_AUTANALOG_FW_TRIGGER0
FW trigger 0.
Definition: cy_autanalog_ac.h:786
void Cy_AutAnalog_StartAutonomousControl(void)
Enables the AC for operation.
Definition: cy_autanalog_ac.c:115
void Cy_AutAnalog_FwTrigger(cy_en_autanalog_fw_trigger_t triggNum)
Sends a firmware trigger to the AC.
Definition: cy_autanalog_ac.c:217
@ CY_AUTANALOG_SUCCESS
Initialization completed successfully.
Definition: cy_autanalog_common.h:106
uint32_t Cy_AutAnalog_Init(const cy_stc_autanalog_t *cfgAndStates)
Initializes the entire Autonomous Analog with the configuration and states provided.
Definition: cy_autanalog.c:157
__STATIC_INLINE void Cy_AutAnalog_SetInterruptMask(uint32_t mask)
Configures which bits of the interrupt request register will trigger an interrupt event in the Autono...
Definition: cy_autanalog.h:782
__STATIC_FORCEINLINE void Cy_GPIO_Inv(GPIO_PRT_Type *base, uint32_t pinNum)
Set a pin output logic state to the inverse of the current output logic state.
Definition: cy_gpio.h:1249
uint32_t cy_rslt_t
Provides the result of an operation as a structured bitfield.
Definition: cy_result.h:459
#define CY_RSLT_SUCCESS
cy_rslt_t return value indicating success
Definition: cy_result.h:486
IRQn_Type intrSrc
Interrupt source.
Definition: cy_sysint.h:227
Initialization configuration structure for a single interrupt channel.
Definition: cy_sysint.h:225
cy_en_sysint_status_t
SysInt Driver error codes.
Definition: cy_sysint.h:196
@ CY_SYSINT_SUCCESS
Returned successful.
Definition: cy_sysint.h:197
cy_en_sysint_status_t Cy_SysInt_Init(const cy_stc_sysint_t *config, cy_israddress userIsr)
Initializes the referenced interrupt by setting the priority and the interrupt vector.
Definition: cy_sysint_v2.c:80