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.

CCS: CC2650

Tool/software: Code Composer Studio

Hi, 
I am trying to sample 4 analog signals at the same time using Sensor controller. I implemented the ADC driver on Sensor Controller Studio. I have been advised to use the Multi buffered Output Data exchange ressource. It's used to make communication with application CPU while the sensor controller continues to produce values. My problem is i can't see how it works (even though i tried looking at the examples and the documentation). Let's say i am using 2 buffers, Should i define ONE buffer in my output data structure where ADC values will be stored or TWO buffers ? (i can't see the relation between the buffers declared in the Task panel and in the buffers declared later in the data structures) 

In my project i am using 4 sensors, should this mean i have to declare four output buffers ?

  • Hi Tarak,

    Really you can do it how you like - either way, buffers can't be shared between tasks.

    Are you doing all your ADC logic in one Sensor Controller Task? Then you could do one large buffer and cycle that.

    If you have multiple tasks, then you're forced to create multiple buffers - each containing their entries for their assigned ADC.

    In other words, it depends on how your application is architected. Your main CPU will only be able to see what the tasks see, you could create a table of pointers pointing to each output buffer - so it'd appear as one buffer. Again completely up to you how you want to do this.

    Regards,
    Rebel
  • Hi Rebel, Thank you for your help. 
    In the ressource panel, the minimum buffer count when i try using the multi buffered output data exchange ressource is 2. Let's say i have one big buffer in my output data structure: Does this mean that i am going to use one buffer to load the values of my output buffer and the other one to transfer to the CPU application ? (I am sorry it's a bit confusing).

    This is my actual execution code implementation in Sensor Controller Studio :

    U16 isOutputBufferAvailable;

    adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_2P7_US, ADC_TRIGGER_AUX_TIMER0);

    adcStartAuxTimer0Trigger(5);

    adcSelectGpioInput(cfg.pAuxioAAdcInput[0]);

    fwCheckOutputBuffer(isOutputBufferAvailable) ;

    if(isOutputBufferAvailable == 1){

    for (U16 n = 0; n < BUFFER_SIZE; n++) {

    adcReadFifo(output.pAdcValue1[n]);

    adcSelectGpioInput(cfg.pAuxioAAdcInput[1]);

    adcReadFifo(output.pAdcValue2[n]) ;

    adcSelectGpioInput(cfg.pAuxioAAdcInput[2]);

    adcReadFifo(output.pAdcValue3[n]) ;

    adcSelectGpioInput(cfg.pAuxioAAdcInput[3]);

    adcReadFifo(output.pAdcValue4[n]) ;

    adcSelectGpioInput(cfg.pAuxioAAdcInput[0]);

    }

    fwSwitchOutputBuffer();

    adcDisable();

    }

    fwScheduleTask(1) ;

    As you could see i am using 4 output buffers (I tried with one, and putting one of the input pins on ground the values seem to overwrite) and this is really tricky since it's using a lot of RAM. 
    Besides, when i import the program to Code Composer Studio and try putting the sampled values of one of the sensors on a graph it looks like this (input is on 3 V) : 



    it looks like the application is receiving a buffer containing the values of one input at a time and then the application is receiving the the other inputs values ... i really don't know how to interpret this and to identify the source of the problem. I can't seem to understand how the Multi buffered output data exchange ressource is working.

  • No solution till now ?
    maybe i am using the wrong approach. can someone hint me ?