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.

How to use the CC2640 ADC Fun

Other Parts Discussed in Thread: CC2650, BLE-STACK, SYSBIOS, CC2640, CC1310, CC2650STK

Hi,

I am use ble_cc26xx_2_00_00_42893 on CC2650 now.

and I want to use the ADC fun in cc26xxware_2_00_06_14829 driver lib.

but I can not find any example fw code about ADC fun.

I use the AUX Analog to Digital Converter fun like below and I got some question:

AUXADCSelectInput(ADC_COMPB_IN_AUXIO6);---->AUXIO6 means IOID_6?


AUXADCEnableSync(AUXADC_REF_VDDA_REL,AUXADC_SAMPLE_TIME_2P7_US,AUXADC_TRIGGER_MANUAL);
System_printf("AUXADCEnableAsync\r\n");

AUXADCGenManualTrigger();-------> and after this line the MCU is stop, so I can not read the ADC data
System_printf("AUXADCGenManualTrigger\r\n");

uint32_t adtmp = AUXADCReadFifo();
System_printf("ADC: %d\r\n", adtmp);

Vincent

  • Hi Vincent,

    This is because the ADC drivers do not have a RTOS driver available yet handling power management for the ADC.
    AUX IO 6 means IO 6 connected to AUX/Sensor Controller. The mapping table is found in Chapter 12-6 of the Technical Reference Manual.

    I will see if I can write up a quick example for you and post here.

    Regards,
    Svend
  • Hi Svend,
    Thanks for AUX IO explain and I can wait for you quick example.

    Thanks again.

    Vincent
  • Hi Vincent,

    Please find attached a TI RTOS example which uses SmartRF06EB and powers the light sensor + samples the input 8 times and logs it through UART. Let me know if you have any questions.

    If you want to simplify it a bit you don't need an interrupt to do this but you can simply trigger sampling and wait in AUXADCReadFifo until it returns.

    Regards,
    Svend

    #include "Board.h"
    #include <ti/sysbios/knl/Semaphore.h>
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/knl/Clock.h>
    #include <ti/sysbios/family/arm/m3/Hwi.h>
    #include <ti/sysbios/family/arm/cc26xx/Power.h>
    #include <ti/sysbios/BIOS.h>
    
    #include <ti/drivers/PIN/PINCC26XX.h>
    #include <ti/drivers/UART.h>
    
    #include <driverlib/aux_adc.h>
    #include <driverlib/aux_wuc.h>
    #include <inc/hw_aux_evctl.h>
    
    #define TASK_STACK_SIZE 512
    #define TASK_PRI        1
    
    
    char taskStack[TASK_STACK_SIZE];
    Task_Struct taskStruct;
    
    Semaphore_Struct sem;
    Semaphore_Handle hSem;
    
    Hwi_Struct hwi;
    
    #define SAMPLECOUNT 8
    #define SAMPLETYPE uint16_t
    #define SAMPLESIZE sizeof(SAMPLETYPE)
    
    #define ALS_POWER   IOID_26
    #define ALS_OUTPUT  IOID_23
    
    SAMPLETYPE adcSamples[SAMPLECOUNT];
    SAMPLETYPE singleSample;
    
    // Analog light sensor pins
    const PIN_Config alsPins[] = {
      ALS_POWER       | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH   | PIN_PUSHPULL | PIN_DRVSTR_MAX,
      ALS_OUTPUT      | PIN_INPUT_DIS | PIN_GPIO_OUTPUT_DIS ,
      PIN_TERMINATE
    };
    
    PIN_Handle pinHandle;
    PIN_State  pinState;
    
    UART_Handle uHandle;
    
    void taskFxn(UArg a0, UArg a1);
    void adcIsr(UArg a0);
    
    int main(void) {
    
      //Initialize pins, turn on GPIO module
      PIN_init(BoardGpioInitTable);
    
      //Initialize task
      Task_Params params;
      Task_Params_init(&params);
      params.priority = TASK_PRI;
      params.stackSize = TASK_STACK_SIZE;
      params.stack = taskStack;
    
      Task_construct(&taskStruct, taskFxn, &params, NULL);
    
      // Construct semaphore used for pending in task
      Semaphore_Params sParams;
      Semaphore_Params_init(&sParams);
      sParams.mode = Semaphore_Mode_BINARY;
    
      Semaphore_construct(&sem, 0, &sParams);
      hSem = Semaphore_handle(&sem);
    
      BIOS_start();
    }
    
    
    void taskFxn(UArg a0, UArg a1) {
    
      Hwi_Params hwiParams;
      Hwi_Params_init(&hwiParams);
      hwiParams.enableInt = true;
    
      Hwi_construct(&hwi, INT_AUX_ADC, adcIsr, &hwiParams, NULL);
    
      UART_Params uParams;
      // Initialize default values
      UART_Params_init(&uParams);
      // Configure custom data, don't care about read params as not used
      // 115.2kBaud, Text, blocking mode
      uHandle = UART_open(Board_UART,&uParams);
    
      // Set up pins
      pinHandle = PIN_open(&pinState, alsPins);
    
      // Enable clock for ADC digital and analog interface (not currently enabled in driver)
      AUXWUCClockEnable(AUX_WUC_MODCLKEN0_SOC_M|AUX_WUC_MODCLKEN0_AUX_ADI4_M);
      // Connect AUX IO7 (DIO23) as analog input. Light sensor on SmartRF06EB
      AUXADCSelectInput(ADC_COMPB_IN_AUXIO7);
    
    
      // Set up ADC
      AUXADCEnableSync(AUXADC_REF_FIXED, AUXADC_SAMPLE_TIME_2P7_US, AUXADC_TRIGGER_MANUAL);
    
      // Disallow STANDBY mode while using the ADC.
      Power_setConstraint(Power_SB_DISALLOW);
    
      uint8_t currentSample = 0;
    
      while(currentSample < SAMPLECOUNT) {
    
        //Sleep 100ms in IDLE mode
        Task_sleep(100 * 1000 / Clock_tickPeriod);
    
        // Trigger ADC sampling
        AUXADCGenManualTrigger();
        // Wait in IDLE until done
        Semaphore_pend(hSem, BIOS_WAIT_FOREVER );
    
        adcSamples[currentSample++] = singleSample;
    
      }
    
      // Disable ADC
      AUXADCDisable();
      // Allow STANDBY mode again
      Power_releaseConstraint(Power_SB_DISALLOW);
    
      // Restore pins to values in BoardGpioTable
      PIN_close(pinHandle);
    
      // Log data through UART
      for(uint8_t i = 0; i<SAMPLECOUNT; i++ ) {
        UART_write(uHandle, &adcSamples[i], SAMPLESIZE);
    
      }
    
      // Goto STANDBY forever
      Task_sleep(BIOS_WAIT_FOREVER);
    
    }
    
    
    void adcIsr(UArg a0) {
    
      // Pop sample from FIFO to allow clearing ADC_IRQ event
      singleSample = AUXADCReadFifo();
      // Clear ADC_IRQ flag. Note: Missing driver for this.
      HWREGBITW(AUX_EVCTL_BASE + AUX_EVCTL_O_EVTOMCUFLAGSCLR, AUX_EVCTL_EVTOMCUFLAGSCLR_ADC_IRQ_BITN) = 1;
    
      // Post semaphore to wakeup task
      Semaphore_post(hSem);
    
    }

  • Hi Svend,
    I will try this and let you know how it works in next Monday. Because there are 3 days holiday in Taiwan.

    Thanks a lot

    Vincent
  • Vincent,

    Depending on what you are trying to achieve you might also consider using the Sensor Controller to perform ADC sampling, especially for periodic events.

    Regards,
    Svend
  • Hi Svend,
    I try it before but I dont how to use this tool,
    Where I can find the document of Sensor Controller.
  • Vincent,

    The documentation is included in the tool: www.ti.com/.../sensor-controller-studio
    There are also examples for TI RTOS included, see for example the Light Sensor project.
  • Svend,
    Ok, I got it.

    Thanks.
  • Hi Svend,
    I try the ADC sample Code and it does work.
    Thanks
  • I'm having trouble setting up the *.cfg file for the interrupts and tasks above. I also tried to remove them just to get a simple ADC sample but I'm finding it very difficult.. Is it possible to upload the full solution file? Thanks
  • Nathan Argetsinger said:
    I'm having trouble setting up the *.cfg file for the interrupts and tasks above. I also tried to remove them just to get a simple ADC sample but I'm finding it very difficult.. Is it possible to upload the full solution file? Thanks

    Nathan,

    I suggest using the example applications that comes with the BLE stack as a starting point, setting all this up can be fairly complicated.

    Regards;
    svend

  • I had looked ( not comprehensively ) for ADC examples in the BLE stack SDK but I didn't find anything. I will look again, and post if I succeed, with some notes on my experiences. Thankyou!

    P.S. Are there any other benchmark examples to build off of besides the TI-RTOS and the BLE-STACK?
  • do you use the ADC succeed,can share some experiences?

  • svendbt: How would you update this example for BLE Stack 2.1.0 ?

  • Hi!

    I found this code very useful to make use of the IO pins of cc2650 to connect an axternal sensor. Now I need to send the sampled data by bluteooth to an android phone. Do you know how to use this.

    P.S: I am using the CC2650 SensorTag Development Kit.

    Thank you 

  • You would then need to send the data to the variable that is in ICALL (SimpleBLExxxx)  for the characteristic you would like to send... 

    For example simplebleperipheral they have the ability to send a single byte and it is updated if I am not mistaken on Characteristic 3/4 (One reads the other updates or writes) 

    To make an array its a little more involved but it is very possible...

    Check out some of the code for the TI Design WMM as that might help you out a little! 

  • Hi svendbt,

    Can you help me about 'Sampling Multiple Pins' by using SCS? 'Sampling One Pin' example of Analog Light Sensor works fine. Examples' code of 'Sampling Multiple Pins' in SCS's help content is quite incomplete. Coz I modified SCS's Execution Code part followed help content and errors came out.

    Besides, is that the 4.3V ADC reference reliable when VDDS is lower than 3V or even more?

    Best Regards,
    Jim
  • Hi Jim,

    The "Sampling Multiple Pins " chapter simply uses the adcSelectGpioInput() API to switch between inputs and then adcGenManualTrigger to trigger a sampling/conversion. Copying the example directly would of course not work as you probably have not defined the data structures that the example uses.

    As mentioned in the data sheet the reference seems to be 4.3V because the input signal is scaled down when scaling is enabled. See chapter 5.16 in the data sheet for more details: www.ti.com/.../cc2650.pdf

    Regards,
    Svend
  • Svend,

    Any suggestion about 'Sampling Multiple Pins'? It's hard to debug due to SCS even not tell us where errors come from. Help check out my code below:

    // Power up the light sensor and wait for it to get ready
    //gpioSetOutput(AUXIO_O_ALS_POWER);
    //fwDelayUs(1000, FW_DELAY_RANGE_1_MS);

    // Enable the ADC
    adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_2P7_US, ADC_TRIGGER_MANUAL);

    // Sample the light sensor
    S16 adcValue;
    //adcGenManualTrigger();
    //adcReadFifo(adcValue);
    //state.adcValue = adcValue;

    **#define SENSOR_OUTPUT_COUNT 3 /* added in upper right frame */
    S16 *pAuxioASensorOutput[SENSOR_OUTPUT_COUNT ] = {AD1, AD2, AD3}; //** AD1/2/3 defined in upper right frame
    ** edit output in midle right frame and add an array: pAdcValue[n], n equals SENSOR_OUTPUT_COUNT
    // For each pin (with one entry per pin in cfg.pAdcValue[] and output.pAdcValue[]) ...
    for (U16 n = 0; n < SENSOR_OUTPUT_COUNT; n++) {

    // Select ADC input
    adcSelectGpioInput(pAuxioASensorOutput[n]);

    // Sample the pin and store the ADC value
    adcGenManualTrigger();
    adcReadFifo(output.pAdcValue[n]);
    }

    // Disable the ADC
    adcDisable();

    // Power down the light sensor
    gpioClearOutput(AUXIO_O_ALS_POWER);

    // Get the minimum and maximum for the current bin
    U16 bin = output.bin;
    S16* pThreshold = #cfg.pBinThresholds + bin;
    S16 min = *(pThreshold++) - cfg.hysteresis;
    S16 max = *(pThreshold++) + cfg.hysteresis;

    // Check if we need to generate output
    U16 doOutput = state.forceOutput;
    if (adcValue < min) {
    doOutput = 1;
    }
    if (adcValue > max) {
    doOutput = 1;
    }

    // If output is needed, find the new bin value and notify the driver ...
    if (doOutput == 1) {
    // For each bin ...
    for (U16 n = 0; n < BIN_COUNT; n++) {
    // If the ADC value is larger, move up one bin
    if (adcValue >= cfg.pBinThresholds[n]) {
    bin = n;
    }
    }
    // Output the new bin value
    output.bin = bin;
    state.forceOutput = 0;
    // Notify the driver
    fwGenAlertInterrupt();
    }

    // Schedule the next execution
    fwScheduleTask(1);

    Another question. I still cant understand why the 'state.adcValue' represents ADC result but not 'output.***'?

    Also I dont know what 'output.bin' is used for. SCS's starter guide describes very few content about this.

  • Hi Svend,

    Mohit this side. I am replying to this post since I have used the above example ADC program for development of ADC interfacing to collect the analog samples in digital domain.

    One of the problems that I observed with the above program are :

    1. I couldn't able to find the reference of this macro " AUX_WUC_MODCLKEN0_SOC_M" in the driver-lib of TI-RTOS , can u please help me to point where exactly the above macro is defined?
  • Hi Mohit,

    In newer versions of driverlib this define has been changed to a more descriptive name (Analog InterFace): AUX_WUC_MODCLKEN0_ANAIF_M.

    Regards,
    Svend
  • Hi Svend,

    Thanks again for the answer.

    One last help that I require from your side , is that I can see that in the ADC example project u have used Analog Light sensor as input to ADC which is being by seen this line " #define ALS_POWER IOID_26" and what is the meant by ALS_OUTPUT " #define ALS_OUTPUT IOID_23" ?
    Is that is the pin from which we will be getting the ADC output.

    Is my understanding correct?

    Please help me to understand this better.

    Thanks very much for your help till now.

    Thanks and Regards,
    Mohit
  • Hi Mohit,

    The Sensor Controller accesses the pins using an "AUX IO". The analog light sensor (ALS) is connected to IOID_23 and the define is the name used from the Cortex M3 side.

    Please see the "IO mapping" tab in the example in Sensor Controller Studio for an overview.

    Regards,
    Svend
  • Hi Svend,

    Thanks for the reply.

    If I am need to configure the ADC for ADC pins of CC22XX i.e 8 Channels pin for ADC i.e from pin number 36 to 43.
    Can I use your program with just ALS power and ALS ouput pin changes with the corresponding ADC pins let's say pin 36 and for input and pin 37 for ouput.

    Is that will work for me.

    Thanks and Regards,
    Mohit
  • No, you need to set up 8 pins in Sensor Controller Studio that matches the pins on your board.
    The overview of the pins to set up are found in the Technical Reference Manual (SWCU117) chapter 11-8.

    Regards,
    Svend
  • Hi Svend,

    Thanks for the reply.

    Actually we are using Code Composer Studio to see the functionality of ADC and not Sensor Controller Studio.
    So how can we setup the only single ADC pin whose AUX ID as per the document SWCU117 is 7 i.e pin 36?
    Can u demonstrate us by giving an example.

    Thanks again for your time.

    Thanks and Regards,
    Mohit
  • Mohit,

    there is an example earlier in this thread for how to do a single ADC conversion on a single pin.

    .:svend
  • Hi Svend,

    Thanks for all the answers.

    Actually I had used the code which was provided by you earlier in the thread. and I modified these lines.

    /* include main internal implementation definitions */

    //#include "package/internal/main.xdc.h"

    PIN_Handle pinHandle;

    PIN_State  pinState;

    #define SAMPLESIZE sizeof(SAMPLETYPE)

    #define ALS_POWER   IOID_7      ---------------------------------------------------------> Changed

    #define ALS_OUTPUT  IOID_23

    Hwi_Struct hwi;

    SAMPLETYPE adcSamples[SAMPLECOUNT];

    SAMPLETYPE singleSample;

    // Analog light sensor pins

    const PIN_Config alsPins[] = { \

     (ALS_POWER|PIN_GPIO_OUTPUT_EN|PIN_GPIO_HIGH|PIN_PUSHPULL|PIN_DRVSTR_MAX),\ -----------------------> Changed

     (ALS_OUTPUT|PIN_INPUT_DIS|PIN_GPIO_OUTPUT_DIS) ,\

     PIN_TERMINATE \

    };

    UART_Handle uHandle;

    extern const ti_sysbios_knl_Semaphore_Handle SEM_Taskfnc;

    void adcIsr(void);

    /*

    *  ======== main_Module_startup ========

    */

    Int main()

    {

    //Initialize pins, turn on GPIO module

    PIN_init(BoardGpioInitTable);

    /* Call board init functions */

    Board_initGeneral();

    /* Set constraints for standby, powerdown and idle mode */

    Power_setConstraint(Power_IDLE_PD_DISALLOW);

    Power_setConstraint(Power_SB_DISALLOW);

    Power_setConstraint(Power_SD_DISALLOW);

    System_flush();

    BIOS_start();

    return 1;

    }

    void taskFxn() {

    uint8_t i;

    Hwi_Params hwiParams;

    Hwi_Params_init(&hwiParams);

    hwiParams.enableInt = true;

    Hwi_construct(&hwi, INT_AUX_ADC,(ti_sysbios_interfaces_IHwi_FuncPtr) adcIsr, &hwiParams, NULL);

    UART_Params uParams;

    // Initialize default values

    UART_Params_init(&uParams);

    // Configure custom data, don't care about read params as not used

    // 115.2kBaud, Text, blocking mode

    uHandle = UART_open(Board_UART,&uParams);

    // Set up pins

    pinHandle = PIN_open(&pinState, alsPins);

    // Enable clock for ADC digital and analog interface (not currently enabled in driver)

    AUXWUCClockEnable((AUX_WUC_MODCLKEN0_ANAIF_M|AUX_WUC_MODCLKEN0_AUX_ADI4_M));

    // Connect AUX IO6 (DIO23) as analog input. Light sensor on SmartRF06EB

    AUXADCSelectInput(ADC_COMPB_IN_AUXIO7);        ----------------------------------------> Changed

    // Set up ADC

    AUXADCEnableSync(AUXADC_REF_FIXED, AUXADC_SAMPLE_TIME_2P7_US, AUXADC_TRIGGER_MANUAL);

    // Disallow STANDBY mode while using the ADC.

    Power_setConstraint(Power_SB_DISALLOW);

    uint8_t currentSample = 0;

    while(currentSample < SAMPLECOUNT) {

    //Sleep 100ms in IDLE mode

    Task_sleep(100 * 1000 / Clock_tickPeriod);

    singleSample = AUXADCReadFifo(); // Added to receive the ADC sampless

    // Clear ADC_IRQ flag. Note: Missing driver for this.

    HWREGBITW(AUX_EVCTL_BASE + AUX_EVCTL_O_EVTOMCUFLAGSCLR, AUX_EVCTL_EVTOMCUFLAGSCLR_ADC_IRQ_BITN) = 1;

    // Trigger ADC sampling

    AUXADCGenManualTrigger();

    // Wait in IDLE until done

    Semaphore_pend(SEM_Taskfnc, BIOS_WAIT_FOREVER );

    adcSamples[currentSample++] = singleSample;

    }

    // Disable ADC

    AUXADCDisable();

    // Allow STANDBY mode again

    Power_releaseConstraint(Power_SB_DISALLOW);

    // Connect AUX IO7 (DIO23) as analog input.

    AUXADCSelectInput(ADC_COMPB_IN_AUXIO7); --------------------------> Changed

    // Set up ADC

    AUXADCEnableSync(AUXADC_REF_FIXED, AUXADC_SAMPLE_TIME_2P7_US, AUXADC_TRIGGER_MANUAL);

    // Disallow STANDBY mode while using the ADC.

    Power_setConstraint(Power_SB_DISALLOW);

    currentSample = 0;

    while(currentSample < SAMPLECOUNT) {

    //Sleep 100ms in IDLE mode

    Task_sleep(100 * 1000 / Clock_tickPeriod);

    // Trigger ADC sampling

    AUXADCGenManualTrigger();

    // Wait in IDLE until done

    Semaphore_pend(SEM_Taskfnc, BIOS_WAIT_FOREVER );

    adcSamples[currentSample++] = singleSample;

    }

    // Disable ADC

    AUXADCDisable();

    // Allow STANDBY mode again

    Power_releaseConstraint(Power_SB_DISALLOW);

    // Restore pins to values in BoardGpioTable

    PIN_close(pinHandle);

    // Log data through UART

    for(i = 0; i<SAMPLECOUNT; i++ ) {

    UART_write(uHandle, &adcSamples[i], SAMPLESIZE);

    }

    // Goto STANDBY forever

    Task_sleep(BIOS_WAIT_FOREVER);

    }

    void adcIsr() {

    // Pop sample from FIFO to allow clearing ADC_IRQ event

    singleSample = AUXADCReadFifo();

    // Clear ADC_IRQ flag. Note: Missing driver for this.

    HWREGBITW(AUX_EVCTL_BASE + AUX_EVCTL_O_EVTOMCUFLAGSCLR, AUX_EVCTL_EVTOMCUFLAGSCLR_ADC_IRQ_BITN) = 1;

    // Post semaphore to wakeup task

    Semaphore_post(SEM_Taskfnc);

    }

    I have done changes in the above example code with reference to the document SWCU117 in which ADC pin 36 corresponds to AUX IO as IOID_7 , and are specified with a colour change. When I am running this code on CCS and try to check the ADC FIFO samples with this API "singleSample = AUXADCReadFifo(); it got struck inside the while loop "

    // Wait until there is at least one sample in the FIFO
    while (HWREG(AUX_ANAIF_BASE + AUX_ANAIF_O_ADCFIFOSTAT) & AUX_ANAIF_ADCFIFOSTAT_EMPTY_M); "

    I am using the function generator to send the Sine wave pulse to ADC pin 36 and I have confirmed that it is working fine that means the pulse is sending signal to ADC pin 36.

    Can u please help me to how to resolve this issue.

    Thanks and Regards,

    Mohit

  • Hi Mohit,

    Can you explain what happens? Does the interrupt ever trigger? Note that if you have the register view open in CCS looking at the ADC registers, this will also cause the FIFO to be read.

    Regards,

    Svend

  • Also, you are trying to read the FIFO one more time in your task in addition to the interrupt which will of course wait until the FIFO is not empty again. This is the reason for what you are seeing.

    I suggest you try to understand properly what your code does and remove the interrupt handling from the example since you clearly don't use it.

    Regards,
    svend
  • Hi Svend,

    No, the interrupt never triggers.
    Next, we come to your point :
    "Also, you are trying to read the FIFO one more time in your task in addition to the interrupt which will of course wait until the FIFO is not empty again. This is the reason for what you are seeing."

    This is being done delibrately by me because there is semaphore pend function which switches our this adc task to idle task. So we have try to read only single value from ADC FIFO register by putting that statement and we cannot able to see the FIFO is read even a single time during the working.

    Thanks and Regards,
    Mohit
  • Hi Mohit,

    Can you try the original example posted in this thread without any modifications? That one is tested by a number of people succesfully.
    Also, which example project are you basing your code on?

    Regards,
    Svend
  • Hi Svend,

    I am using the same example project which u had shared with on this forum.

    Actually, in the example project it was mentioned aux pins as ALS_POWER IOID_26 and ALS_OUTPUT IOID_23. I couldn't able to find the reference of these pins with the CC2650 pins in the IO Mapping table mentioned in Technical Reference Manual (SWCU117) chapter 11-8.

    Can u help me in above and I can give a try on that.

    Thanks and Regards,
    Mohit
  • ALS_POWER and ALS_OUTPUT are ports on the SmartRF06EB. These are connected to IOID_23 and IOID_26 when using the 7x7 evaluation module. IOID and DIO are the same thing.
  • Hi Svend,

    We are checking it now.
    Let u know the results.

    Thanks and Regards,
    Mohit
  • Hi Svend,

    One query here, for the code that I have posted here is I my changes are correct when we need to take analog signal from ADC pin36 ?
    Or there are more changes that are required.

    Thanks and regards,
    Mohit
  • Mohit,

    PIN 36 on the 7x7 package is AUX IO 7 (ADC_COMPB_IN_AUXIO7). This is the same as already used in the example.
  • Hi Svend,

    We are able to run the Example project and also we can read the ADC samples also.

    Taking this as a progessing step ,Can u please help us in what way we able read the ADC samples from ADC pin i.e either pin 36 , 37 ,38 etc

    Thanks and Regards,
    Mohit
  • You can change ADC channel using AUXADCSelectInput. The example is easily modifiable, we do not have the resources to provide a a full implementation for every use case requested unfortunately.
  • Hello vinect:
    I also learning How to use the CC2650 ADC function , but I can't find any complete sample code.They are tell me that I can find sample code in Sensor Controller Studio\examples\analog_light_sensor\source\main.c , when I try to import that project to CCS , Unfortunately, that project can't not building success , a lot of error messages. I am looking for help , please help , thank you.
  • Hi Tzuyu,
    I dont use CCS so I can not help you about CCS.
    and Sample code for ADC you can reference this post before your.
  • what different between AUX and ADC ? I was confused .
  • here is TRM doc:
    www.ti.com/.../swcu117d.pdf

    and Page 1188 has ADC in AUX fun explain.
    you can see more information about this AUX function.
  • Dear svendbt:
    How can I verification that ADC read values is correct ? Because I copy your code , it is working , but I can not see any display. TI SmartRF06 has one LCD display, I want to see values in display. Thank you.
  • then you can use LCD write function to display the values you read out, or run debugger to watch the value. Please take a look at our software developer's guide chapter 9 for how to debug(watch variable is also included in our guide).

    You can download our CC2640 Bluetooth low energy Software Developer’s Guide (Rev. A) here:
    www.ti.com/.../ble-stack

    Also simpleBLEPeripheral example project contains lots of LCD usage, please take a look at that project.
  • Using tirtos_cc13xx_cc26xx_2_15_00_17 on a CC1310 the following three items are unknown:   

    • AUX_WUC_MODCLKEN0_SOC_M (renamed to AUX_WUC_MODCLKEN0_ANAIF_M)
    • INT_AUX_ADC (renamed to INT_AUX_ADC_IRQ)
    • Power_SB_DISALLOW  (renamed to PowerCC26XX_SB_DISALLOW)

    Additionally I had to #include <inc/hw_ints.h> and remove #include <ti/sysbios/family/arm/cc26xx/Power.h> which does not exist and I replaced it with #include <ti/drivers/power/PowerCC26XX.h>

    When it compiled, I found that the call to Power_setConstraint() never returns when debugging.  If I comment out that line the code runs to UART_write() and then never returns.

    Did I do the right name substitutions? Some of these don't show up in the code or documentation so it is hard to match up names.

  • The changes look correct. Your issue sounds very much like a stack overflow to me , have you checked your task stacks using the TI RTOS real time object (ROV) viewer?

  • Can this code be used to programme the ADC in SensorTag cc2650? Thanks.

  • Yes, the hardware is the same. What do you plan to do with ADC?
  • Hi Christine,

    My project consist of connecting an external self-made PCB board with Force Sensitive Resistor(FSR) to the SensorTag and Debugger. I would like to take values from the FSR when pressure is exerted on the FSR and pass it through the ADC. Ultimately, values are supposed to be read by the ADC and the values can be recorded. Could you please guide me on how do i go about doing this?

    Thanks.

    From,
    Chelsia