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.

Current measurement using MSP430's ADC

Other Parts Discussed in Thread: INA250EVM, MSP430F5529, ENERGIA

Hi everyone,

I want to measure the current flowing through a BLDC motor. The current can vary between 0.1A and 5A and I need a 0.1% accuracy. For this, I use an INA250EVM in order to measure the voltage.

 I would like to measure the waveform at the INA output using the ADC12 of MSP430F5529 Launchpad. So, I used Energia but the result was not satisfying due to a too small sampling rate. I saw on the datasheet : fADC12CLK = 5.0 MHz but I don't know if I can increase the sampling rate on Energia.

Use CCS seems to be a good idea in order to measure the current waveform with a better sampling rate.

Do you have some example code or paste me some snippets?  

Thank you  for your help

Mehdi

  • Hi Mehdi,

    You don't have to use the intrinsic Energia functions, you can instead use C commands similar to that provided in the TI code examples package. This allows you to determine important sampling rate register settings such as the ADC12SHTx bits inside of ADC12CTL0 and ADC12DIVx & ADC12SSELx bits from ADC12CTL1.

    This being said, there are several advantages to using CCS over Energia like the improved debugging features. You should consider importing your Energia sketch into CCS: energia.nu/.../

    Regards,
    Ryan
  • Hi Ryan,

    Many thanks, I didn't know I could import my Energia sketch into CCS.

    I just downloaded CCS V6 and I will try to determine a higher sampling rate using register setting, and I'll let you know very quickly if it works. 

    Best Regards,

    Mehdi

  • HI,

    I imported my Energia sketch into CSS but I have some trouble to increase the sampling rate.

    I have three projects in the Project Explorer.

    In the Current_measurement _1.35 folder, I opened  the .ino and I found different define ADC shows in the picture below

    These names don't exist on MSP430 datasheet and I can't find in the sketch where I can modify the sampling rate.
    Moreover, ADC12CTL0 and ADCCTL1 don't exist in this file.

    However in the lpmsp430f5529_25_core, I found  ADC12CLT0 and ADC12CTL1 in wiring_analog.c



    How can I use these registers in my sketch in order to increase the sampling rate ? 

    Thank you

    Mehdi

  • The defines shown in the Current_measurement _1.35 .ino file refer to a Stellaris ARM ADC, not a MSP430, and are therefore of no use to you. You should be referring to the MSP430F5529's User Guide as compared to the Datasheet in order to understand more about the ADC registers. You can also refer to the C code examples provided by TI: www.ti.com/.../slac300

    Regards,
    Ryan

**Attention** This is a public forum