This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR6989: Using external VRef and ADC Oversampling in Energia

Part Number: MSP430FR6989
Other Parts Discussed in Thread: ENERGIA, LMP91000,

Hi

I am new to coding and I am using Energia to program my MSP4306989 launchpad. I am not comfortable with CCS.

I am not able to find much information regarding external VRef and oversampling the ADC in Energia. I have removed the pushbutton to use the P1.1 for the External VRef. I have a gas sensor using LMP91000 with VRef of 2.048V. The MENB1-MENB4 from the sensor board are connected to P9.0,P9.1,P9.5 & P9.6. The V-Out for gases are connected to P8.4 to P8.7 on the launchpad. The 2.048 VRef from the is connected to P1.1 of the launchpad.

Please guide me on how to use the External VRef and also oversample the ADC from 12bit to 16bit using Energia. I read in some forums that I need to make some changes in the energia library.

Regards

Vijay

  • Easiest way to start is to use CCS with the examples code. It should have one for using the ADC. Once you get the example code working, you should be then able to make any changes as needed.

    As with using any ADC in a microcontroller, it is just a matter of setting the proper registers. There is nothing complicated about it, just look at the user's manual of the device here (you can skip to Chapter 34 on page 865): www.ti.com/.../slau367o.pdf

    For oversampling: Keeping the mathematics aside, you need to sample 4 times faster for every extra bit of resolution. So, to get your extra 4 bits (from 12 to 16), you need to sample 4^4 faster (256x), this should not be an issue with the built-in ADC sampling at a max of 200-Ksps.
  • I have searched the Internet extensively but could not find any useful examples in Energia for using external ADC and oversampling. The examples in CCS show that I need to set the clock and also read samples directly from the ADC. The Energia library does not have such access setting sample frequency, clock etc. Since I am not a regular programmer, CCS is more challenging environment for me. Energia is quite simple for my application and I could use some help in Energia.

  • Hi Vijay,

    Energia involves a high-level API intended for very simple applications that don't require many low-level register modifications. Although you can directly alter the registers using Energia, your project is complicated enough such that you really should be using CCS. It would be more complicated to try and alter the Energia library functions as you've suggested. Like Mike mentioned, there are several examples available for you to start with. Here is an App Note for oversampling ADCs with the MSP430: www.ti.com/.../slaa694a.pdf

    Regards,
    Ryan
  • Thanks Ryan. I am almost finished programming but for this oversampling that I need to do. I will try CCS again but it is like starting all over again from scratch.

  • Dear Ryan

    Can please point me to a sample code for MSP430FR6989 which can read data from a certain register (0x10) from I2C slave on address 0x48? I am not able find any example for my launchpad
  • Vijay,

    This would be a combination of write and read sequences, I recommend a combination of msp430fr69xx_euscib0_i2c_master_multislave.c (without the multislave) and msp430fr69xx_euscib0_i2c_10.c from the code examples package: www.ti.com/.../slac668

    Regards,
    Ryan
  • Dear Ryan

    I read your guide "MSP MCU I2C getting started guide". I am trying to use the driverlib. I am trying to read from internal address 0xd0 of slave device address 0x77. Please let me know if below sequence is correct.

    #include "driverlib.h"
    #define SLAVE_ADDRESS 0x77
    #define INT_ADDRESS 0xd0

    //Initialize Master
    EUSCI_B_I2C_initMasterParam param = {0};
    param.selectClockSource = EUSCI_B_I2C_CLOCKSOURCE_SMCLK;
    param.i2cClk = CS_getSMCLK();
    param.dataRate = EUSCI_B_I2C_SET_DATA_RATE_400KBPS;
    param.byteCounterThreshold = 1;
    param.autoSTOPGeneration = EUSCI_B_I2C_NO_AUTO_STOP;
    EUSCI_B_I2C_initMaster(EUSCI_B0_BASE, &param);

    // Send the start sequence & Send the slave address with R/W bit low
    EUSCI_B_I2C_enable(EUSCI_B0_BASE);
    EUSCI_B_I2C_setMode(EUSCI_B0_BASE, EUSCI_B_I2C_TRANSMIT_MODE);

    //Send the register number
    EUSCI_B_I2C_masterSendSingleByte(EUSCI_B0_BASE, INT_ADDRESS);

    //Send the start sequence again (repeated start)
    EUSCI_B_I2C_masterReceiveStart(EUSCI_B0_BASE);

    Send the slave address with R/W bit high
    EUSCI_B_I2C_setMode(EUSCI_B0_BASE, EUSCI_B_I2C_RECEIVE_MODE);
    EUSCI_B_I2C_masterSendSingle(EUSCI_B0_BASE, slave_address);

    Read data byte(s)
    EUSCI_B_I2C_slaveGetData(SLAVE_ADDRESS);

    Send the stop sequence
    EUSCI_B_I2C_disable(EUSCI_B0_BASE);

**Attention** This is a public forum