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.

Grace configuration MSP430G2432

Other Parts Discussed in Thread: MSP430G2432

Hi,

Im using the Grace code generator to configure my MSP430G2432. I dont quite understand the note that "configuring the flash controller is only needed in case of using in-system application self-programming techniques". In my application, the MCU communicates via SPI with two slave devices and needs to process incoming analog signals. Should I enable the flash controller?

Concerning the ADC, Grace offers the possibility to eable 2'Complement and Automatic Data Transfer Controller. When do I need these functions?

Thanks a lot!

Best regards

 

 

 

 

 

  • The flash controller is always active, as it provides teh stored applicaiton ot the CPU. However, it is necessary to configure the flash controller if you want to store data in flash by your program code.

    For processing incoming data, you usually use ram and do not store anything in flash. Writing to flash is only needed if you want to persistently store things (like the application itself, or calibration values or such)

    Yue Zhang said:
    2'Complement and Automatic Data Transfer Controller. When do I need these functions?


    2's complement is used when you sample level-shifted symmetrical signals. The ADC can only sample positive voltages. However, if the input voltage is an AC signal that has been move up by 1/2 of the reference, then you can enable 2's complement mode and get a signed result relative to1/2 of Vref instead of a positive value between 0 and Vref.

    DTC is sort of DMA. It can be used to automatically copy a number of ADC results from the ADC10MEM register to a memory buffer.

    Details are found in the ADC chapter of the 2x family users guide slau244.pdf

  • Hi Jens,

    thank you very much for your reply. I have two further questions please:

    Concerning the sampling rate would you recommend me to choose manually sample or timer sample. I dont quite understand the difference. 

    And when do I need the counter interrupt enable for my SPI communication?

    Thanks again!

  • Yue Zhang said:
    Concerning the sampling rate would you recommend me to choose manually sample or timer sample. I dont quite understand the difference. 

    It depends on your application.

    The ADC supports several mdoes. You can set it up to trigger each conversion manually, or run subsequent conversions as soon as the previous is done. Aslo, you can trigger the conversion either manually or by using a tiemr CCR unit.

    If you use a timer, you can start sampling one single vlaue in well-defined intervals. Or you program the sampling thime to one of the few available durations and let it do free-running converisons one after another. Depending on the clock source, this too gives equidistant intervals, but maybe not the exact frequency you need. It is, however, simple and doesn't require a timer 8whcih is a scarce resource on the G2432)

    Yue Zhang said:
    And when do I need the counter interrupt enable for my SPI communication

    If enabled, it calls your USI ISR when a byte has been transmitted (the bit counter reaches zero), so you can put the next byte in. But if you don't do background transfers, your code can just check for the current count and wait until things are done.

  • Jens-Michael Gross said:

    DTC is sort of DMA. It can be used to automatically copy a number of ADC results from the ADC10MEM register to a memory buffer.

    Details are found in the ADC chapter of the 2x family users guide slau244.pdf

    Hi Jens, 

    I checked the ADC description, but I still have some questions:

    In my application I want to compare the converted ADC value with the previous value. So if I use the automatic DTC to store the converted value, which memory block size should I choose?

    Grace also asks about the impedence. How do I choose that?

    Many thanks!

     

     

     

     

     

     

  • Yue Zhang said:
    In my application I want to compare the converted ADC value with the previous value. So if I use the automatic DTC to store the converted value, which memory block size should I choose?

    Well, if you need realtime comparison (compare a result with the previous as soon a s it arrives) then don't use the DTC at all. Just pick every result as it arrives. Unless you fear you might (due to otehr interrupts9 miss a value and need to catch everyone.
    If you don't need realtime,  you can as well fill a buffer of any size (use the two-block option of the DTC) and work on one block while the DTC fills the other.

    Yue Zhang said:
    Grace also asks about the impedence. How do I choose that?

    You do not chose. You tell. GRACE needs to knwo the signal impedance, because it affects the required sampling time. When sampling, a capacitor is charged before the conversion starts. If your signal source has  ahigh impedance, the capacitor only charges slowly. So GRACE needs to know the source impedance to calculate the required sampling time (for the SHTx setting). If the samplign time is too short, the conversion is done on an only partially charged capacitor and gives too-low results.

  • Jens-Michael Gross said:

    if you need realtime comparison (compare a result with the previous as soon a s it arrives) then don't use the DTC at all. Just pick every result as it arrives. 

    But won't the arriving result overwrite the previous ADC value in ADC10MEM even before I can compare them? Does the realtime comparison work with interrupt?

    Jens-Michael Gross said:
     

    GRACE needs to knwo the signal impedance, because it affects the required sampling time. When sampling, a capacitor is charged before the conversion starts. If your signal source has a high impedance, the capacitor only charges slowly. If the sampling time is too short, the conversion is done on an only partially charged capacitor and gives too-low results.

    I have found out that my input impedence is 10 MOhm. In Grace 10 kOhm is the maximum. How could I avoid the too-low results? The strange thing is even if I write 10 kOhm, Grace delete the value after generating the source code.

    Thank a lot!

     

     

     

     

     

  • Yue Zhang said:
    But won't the arriving result overwrite the previous ADC value in ADC10MEM even before I can compare them?

    Depends on conversion speed, MCLK speed and how much you do in-between.

    Yue Zhang said:
    Does the realtime comparison work with interrupt?

    You can do it in interrupt (each tiem a converison is done, the itnerrupt is called and you can compare ADC10MEM to a saved copy, then save ADC10MEM)
    Or you make busy-waiting for the ADC10IFG bit (which may save you some MCLK cycles if things are tight) but you cannot do anything else then.

    You may even setup the DTC for 2*1 byte transfer and get an interrupt after each byte and can do the comparison between two ram cells.
    It really depends on teh exact applicaiton conditions. There is no 'the solution'. There are many, all with pros and cons. It's your job to pick the one that you like best.

    Yue Zhang said:
    I have found out that my input impedence is 10 MOhm.

    That's quite high. In fact, it is much higher than usable. YOu need to charge a ~10pF capacitor.
    Charge time of 10pF through 10MOhm is roughly 1ms. This means you'd need 1024 ADC10CLK cycles SHTx for 1MHz ADC10CLK. More for higher clock. It also limits your sampling frequency to <1kHz.
    I suggest using an external OpAmp with FET or JFET inputs as impedance converter (gain of 1).

**Attention** This is a public forum