Peripheral features and how this peripheral works
The Operational Amplifier (OPAMP) module supports flexible amplifier application.
Features
- Up to four sets of rotation configuration.
- OPAMP supports rotation configuration mechanism configured by software depending on the application requirements.
- By the optimized design scheme of time-sharing multiplexing, the rotation configuration sets take effect one by one. After a rotation loop, it restarts from the first configuration set.
- How many configuration sets are involved in rotation is configurable.
- Time window is used to control each configuration set duration. The 4-bit window counter's clock is from XBAR. Window duration for each configuration set could be different.
- Selectable non-inverting input and inverting input. Both the non inverting input and inverting input have 4-to-1 multiplex, the multiplex can select analog input signals from either pins or internal references. Each rotation configuration set has its own multiplex value to support flexible use case.
- Configurable work mode. Each rotation configuration set uses its own work mode, OPAMP supports three work modes:
- Buffer mode: In this mode, OPAMP operates as a buffer and gain is 1X.
- Internal gain mode: Based on internal resistance net, this mode supports non-inverting 2X/4X/8X/16X gain.
- External gain mode: In this mode, amplifier negative input switches to external resistance net. Flexible gain could be achieved by different external resistance net.
- Double buffer scheme. To avoid current working configuration data changing during rotation configuration, OPAMP uses double-buffer scheme. New configurations are written to OPAMP register buffers, when all configurations are written, application can write CTRL[CONFIG_LOAD] to enable load new configuration.
- OPAMP supports two load modes to load new configuration at different time points.
- Delay load mode, also named as loop load mode. The new configuration loading happens on a rotation loop completion.
- Real time load mode, also named as fast load mode. The new configuration loading happens on any configuration set completion.
- There is status flag and interrupt to notify user that the new configuration has been loaded.
- Different power modes. OPAMP supports high speed mode and low power mode.
- High speed mode means higher current consumption with faster slew rate, and wider unity gain bandwidth performance.
- Low power mode means lower current consumption with slower slew rate, and narrower unity gain bandwidth performance.
How this peripheral works
- Configure the module clock to equal or less than 50MHz.
- Configure XBAR for the 4-bit window counter clock. When the counter clock is synchronized with the module clock, the frequency of the counter clock must be less than or equal to module clock frequency. When the counter clock is asynchronous with the module clock, the frequency of the counter clock must be less than half of module clock frequency.
- Configure OPAMP output pin and input pin according to use case.
- Set the rotation configuration sets, the configuration sets to use, power mode, load mode, and so on.
- Enable the configuration load, then OPAMP starts to work.
- After the configuration has been loaded, user could set new configuration and enable the load if necessary.
How this driver is designed to make this peripheral works
With OPAMP_Init, the OPAMP module could be set to a defined state and starts to work.
For runtime change, OPAMP driver provides two methods to configure the OPAMP module:
- Whole module configuration update by OPAMP_UpdateModuleConfig. This function sets all configurations and enables the configuration load, the new configuration is loaded at the time determined by load mode.
- Update specific rotation configuration sets by OPAMP_SetOneConfigSet. Application could call this function multiple times to configure different sets. After all desired sets configured, call OPAMP_EnableConfigLoad to load at proper time.
OPAMP driver also provides APIs to get and clear configuration load completion flags.
How to use this driver
- Configure and enable module clock before calling this driver's API.
- Configure XBAR for the window counter clock.
- Enable OPAMP interrupt in system interrupt controller if necessary.
- Configure the output pin and input pin according to use case.
- Prepare the configuration structure opamp_config_t, and call the function OPAMP_Init. Then the OPAMP starts working. The function OPAMP_GetDefaultConfig helps filling opamp_config_t with default value, user can modify based on the default value.
- Use OPAMP_GetLoadCompletionFlag to get the configuration load completion status.
- When the older configuration loaded, user could set new configuration using function OPAMP_SetConfig.