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.

SAR Initialization & usage

All:

We are using the C5505 SAR to measure some very slow moving signals. Presently, we are using GPAIN3 and GPAIN2 to do these measurements.

The GPAIN1 and GPAIN0 inputs are grounded thru some large pull-down resistors.

In terms of initialization, it looks like it focuses only on GPAIN3 and GPAIN2. Does anything need to be with respect to GPAIN1 and GPAIN0 at init-time to make sure that there is no power loss thru these pins?

  • Hi,

    The GPAIN pins can be configured as general purpose outputs driven low to save power and avoid contention with the external pull-down resistors.

    See SAR A/D GPO Control Register (SARGPOCTRL) in the C5505 SAR ADC User's Guide.

    Hope this helps,
    Mark

  • hi mark

    help me out i have program ADC 10 bit SAR by using ADC user guide i m using c5535ezdsp. my program as follows

    #include "stdio.h"
    #include "sar.h"
    #include "data_types.h"
    void Init_SAR(void)
    {
    *SARCTRL = 0x4C00; // Select AIN4, which is GPAIN2
    *SARCLKCTRL = 0xC34F; // 100/50000 = 2KHz
    *SARPINCTRL = 0x7104;
    *SARGPOCTRL = 0;
    *SARCTRL = 0xCC00;
    *SARDATA = 0xCC00;
    }

    void Read_GPAIN2(void)
    {
    Uint16 val, i;
    while(1)
    {
    for(i=0;i<500; i++)
    asm(" nop");
    val = *SARDATA;
    if((val&0x8000) == 0)
    break;
    }
    }

    but i am enable to run down this program on ccs v4. i m new to ccv4 environment plz help me out the error shows.........

    Severity and Description Path Resource Location Creation Time Id
    errors encountered during linking; "sar123.out" not built sar123 line 0 

    unresolved symbol _main, first referenced in C:\Program sar123 line 0 

  • It looks like I have a similar example, but the clock is a bit different:

    *SARCLKCTRL = 0x0031;                   // 100/50 = 2MHz

    Try the lower value and see if that makes a difference.

    Also, the for() loop has i<50 instead of i<500.