I have a project in mind that requires operational amplifiers. Recently Texas Instruments has released several microcontrollers that have low power precision op amps built in. I have two in hand now that I will be testing - the MSP430FR2311 that is in this post and the larger MSP430FR2355 that I may end up using in my project. I won't describe the parts in detail today but instead will fire the FR2311 up in a kind of hello world for op amps.
The FR2311 microcontroller has 3.75 k of FRAM persistent memory and 1 k of SRAM. The Smart Analog Combo consists of a trans-impedance amplifier and operational amplifiers that can be configured as peripherals. There is also serial, 10-bit ADC, comparator, and GPIO.
The FR2311 is available on a LaunchPad development board but I will be using one of my own little prototyping boards with the 16 pin TSSOP variant and another LaunchPad to program and power it. In the photo below, the two resistors on the left are a voltage divider to pin 14 which is the non-inverting input to the op amp.
The schematic below shows how the circuit is arranged to make a non-inverting amplifier. The corresponding pin numbers on the FR2311 are in parenthesis.
I should note here that the FR2355 has additional capability including the ability to internally set the mode and gain from 1 to 33. On the smaller FR2311 used here the gain and mode are controlled by an external circuit.
To start I set the op amp up as a buffer, i.e. to give unity gain. The FR2311 has enough memory that DriverLib can be used which I prefer since it makes the code more readable. Below is the code I used taken from the examples provided by TI with trivial changes. Pretty short and sweet if you take out the TI boiler plate.
//****************************************************************************** // MSP430FR231x Demo - SAC-L4, GP Mode with SAC OA // // Description: Configure SAC-L4 for general purpose mode. The "+" terminal is // connected to external pad (IN+) and the "-" terminal is connected to external // pad (IN-). SAC OA is selected to low speed and low power mode. // ACLK = n/a, MCLK = SMCLK = default DCODIV ~1MHz. // // MSP430FR231x // ------------------- // /|\| | // | | P1.4/OA0+|--> External pad // --|RST | // | P1.2/OA0-|--> External pad // | | // | | // | | // | | // // Yang Lu // Texas Instruments Inc. // July 2015 // Built with Code Composer Studio v6.1 //***************************************************************************** #include "driverlib.h" int main(void) { //Stop WDT WDT_A_hold(WDT_A_BASE); //Configure P1.2/P1.4 as OA0 functionality GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4, GPIO_TERNARY_MODULE_FUNCTION); // Disable the GPIO power-on default high-impedance mode to activate // previously configured port settings PMM_unlockLPM5(); //Select external source for both positive and negative inputs SAC_OA_init(SAC0_BASE, SAC_OA_POSITIVE_INPUT_SOURCE_EXTERNAL, SAC_OA_NEGATIVE_INPUT_SOURCE_EXTERNAL); //Select low speed and high power mode SAC_OA_selectPowerMode(SAC0_BASE, SAC_OA_POWER_MODE_LOW_SPEED_HIGH_POWER); SAC_OA_enable(SAC0_BASE); // Enable OA SAC_enable(SAC0_BASE); // Enable SAC } /* --COPYRIGHT--,BSD * Copyright (c) 2016, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * --/COPYRIGHT-- */
In the setup below the oscilloscope is providing a 3V internally generated square wave at 1000 Hz as input to the op amp on the FR2311. The blue trace on the bottom is the input and the yellow trace is the output.
Let's have a closer look at the rising edge. In the photo below the output has been superimposed on the input. Major divisions on the time scale are 100 ns and the major divisions on the voltage scale are 500 mV for both traces.
The rise time on the output is about 1 us with a bit of overshoot. So if I am interpreting this right the slew rate is about 3V / us. I set the mode to "low speed" in the code so it would be interesting to set it to "high speed" and see what happens to slew rate. Since my application will be DC amplification this isn't too important.
The photo below shows the falling edge with the same scales as above.
Let's now use the schematic above and set it up as a non-inverting DC amplifier. My bench power supply is set to about 250 mV and connected to the input (OA0+). The resistor Rf is 10k ohms and Rin is 1k ohms. Substituting these values into the equation and solving for gain gives:
G = (Rf / R1) + 1
G = (10,000 / 1,000) + 1
G = 11
The experimental setup is shown below.
The output voltage is 2.72 V and the input voltage is 246 mV.
G = Vout / Vin
G = 2.72 / 0.246
G = 11.06
That is less than a percent error so close enough given the crude setup.
I plan to have a look at the MSP430FR2355 next.
Links
Top Comments