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/MSP-EXP432E401Y: Code Composer Studio MSP-EXP432E401Y

Part Number: MSP-EXP432E401Y

Tool/software: Code Composer Studio

Sequencer question. MSP-EXP432E401Y. Used last SDK 4.20.00.12.

 

I am Interested in a system like your SimpleLink Academy Example “ADC Simultaneous Sampling”.

I am planning to use simultaneously two ADCs. ADC0 will read from 4 channels. ADC1 will read from

other 4 different channels. Triggering will be after.

I tried both variants: Sequencer 0 for both ADC0, ADC1 and Sequencer 0 for ADC0 and Sequencer 1 for

ADC1. EACH ADC has its own sequencers (Four Sequencers - 0, 1, 2, 3. Sequencer 0 has 8 channels).

If in ADCBuf and ADCBuf1 drivers we choose Sequencer 0, will be these sequencers different for ADC0

and ADC1?

I did not find in your descriptions how “deep” is your sequencer? Looks like one channel of the

sequencer can hold only ONE 32-bit number.

I will appreciate if you can look at this Lab Example Program. I think that the program is stopping around

line       if (!adcBuf) { while(1); } I am using only Channel 0 for each ADC in the program.

 

Thank you in advance,

Eugene

 

 

 

ADCBufsimultaneous.c   from SimpleLink Academy Lab

 

*/

/*

* ======== adcBufContinuousSampling.c ========

*/

/* DriverLib Includes */

#include <stdint.h>

#include <stdio.h>

#include <string.h>

#include <unistd.h>

#include <semaphore.h>

 

/* Driver Header files */

#include <ti/drivers/ADCBuf.h>

 

/* Display Header files */

#include <ti/display/Display.h>

#include <ti/display/DisplayUart.h>

 

/* Board Header file */

#include "ti_drivers_config.h"

 

#define ADCSAMPLESIZE   (5)

 

uint16_t sequencer0BufferOne[ADCSAMPLESIZE];

uint16_t sequencer0BufferTwo[ADCSAMPLESIZE];

uint16_t sequencer1BufferOne[ADCSAMPLESIZE];

uint16_t sequencer1BufferTwo[ADCSAMPLESIZE];

uint32_t buffersCompletedCounter = 0;

uint16_t outputBuffer[2][ADCSAMPLESIZE];

 

/* Display Driver Handle */

Display_Handle displayHandle;

 

/* ADCBuf semaphore */

sem_t adcbufSem;

 

/*

* This function is called whenever a buffer is full.

* The content of the buffer is then converted into human-readable format and

* sent to the PC via UART.

*

*/

void adcBufCallback(ADCBuf_Handle handle, ADCBuf_Conversion *conversion,

   void *completedADCBuffer, uint32_t completedChannel, int_fast16_t status) {

   uint_fast16_t i;

   uint16_t *completedBuffer = (uint16_t *) completedADCBuffer;

 

 for (i = 0; i < ADCSAMPLESIZE; i++)

   {

       outputBuffer[completedChannel][i] = completedBuffer[i];

   }

   /* post adcbuf semaphore */

   if(completedChannel == CONFIG_ADCBUF_1_CHANNEL_0)

   {

       sem_post(&adcbufSem);

   }

}

 

/*

* ======== mainThread ========

*/

void *mainThread(void *arg0)

{

   Display_Params displayParams;

   ADCBuf_Handle adcBuf, adcBuf1;

   ADCBuf_Params adcBufParams;

   ADCBuf_Conversion continuousConversion1;

   ADCBuf_Conversion continuousConversion2;

   uint_fast16_t i;

   int32_t status;

  

   /* Call driver init functions */

   ADCBuf_init();

   Display_init();

 

   /* Configure & open Display driver */

   Display_Params_init(&displayParams);

   displayParams.lineClearMode = DISPLAY_CLEAR_BOTH;

   displayHandle = Display_open(Display_Type_UART, &displayParams);

   if (displayHandle == NULL) {

       Display_printf(displayHandle, 0, 0, "Error creating displayHandle\n");

       while (1);

   }

  

   status = sem_init(&adcbufSem, 0, 0);

   if (status != 0) {

       Display_printf(displayHandle, 0, 0, "Error creating adcbufSem\n");

       while(1);

   }

 

   Display_printf(displayHandle, 0, 0, "Starting the ADCBuf Simultaneous Sampling");

 

   /* Set up an ADCBuf peripheral in ADCBuf_RECURRENCE_MODE_CONTINUOUS */

   ADCBuf_Params_init(&adcBufParams);

   adcBufParams.callbackFxn = adcBufCallback;

   adcBufParams.recurrenceMode = ADCBuf_RECURRENCE_MODE_CONTINUOUS;

   adcBufParams.returnMode = ADCBuf_RETURN_MODE_CALLBACK;

   adcBufParams.samplingFrequency = 10;

   adcBuf = ADCBuf_open(CONFIG_ADCBUF_0, &adcBufParams);

   adcBuf1 = ADCBuf_open(CONFIG_ADCBUF_1, &adcBufParams);

 

   /* Configure the conversion struct for Sample Sequencer 0 */

   continuousConversion1.arg = NULL;

   continuousConversion1.adcChannel = CONFIG_ADCBUF_0_CHANNEL_0;

   continuousConversion1.sampleBuffer = sequencer0BufferOne;

   continuousConversion1.sampleBufferTwo = sequencer0BufferTwo;

   continuousConversion1.samplesRequestedCount = ADCSAMPLESIZE;

 

   /* Configure the conversion struct for Sample Sequencer 1*/

   continuousConversion2.arg = NULL;

   continuousConversion2.adcChannel = CONFIG_ADCBUF_1_CHANNEL_0;

   continuousConversion2.sampleBuffer = sequencer1BufferOne;

   continuousConversion2.sampleBufferTwo = sequencer1BufferTwo;

   continuousConversion2.samplesRequestedCount = ADCSAMPLESIZE;

 

 

// I think that the program is stopping somewhere here. Eugene.

   if (!adcBuf){

       /* AdcBuf did not open correctly. */

       while(1);

   }

 

   if (!adcBuf1){

           /* AdcBuf did not open correctly. */

           while(1);

       }

 

   /* Start converting sequencer 0. */

   if (ADCBuf_convert(adcBuf, &continuousConversion1, 1) !=

       ADCBuf_STATUS_SUCCESS) {

       /* Did not start conversion process correctly. */

       while(1);

   }

 

   /* Start converting sequencer 1. */

   if (ADCBuf_convert(adcBuf1, &continuousConversion2, 1) !=

       ADCBuf_STATUS_SUCCESS) {

       /* Did not start conversion process correctly. */

       while(1);

   }

   /*

     * Go to sleep in the foreground thread forever. The data will be collected

     * and transfered in the background thread

     */

   while(1)

       {

       sem_wait(&adcbufSem);

      

       /*

         * Start with a header message and print current buffer values

         */

 

       Display_printf(displayHandle, 0, 0, "\r\nBuffer %u finished:",

                       (unsigned int)buffersCompletedCounter++);

       Display_printf(displayHandle, 0, 0, "\r\nCONFIG_ADCBUF_0_CHANNEL_0:");

       for (i = 0; i < ADCSAMPLESIZE; i++)

       {

           Display_printf(displayHandle, 0, 0,

               "   %u,", outputBuffer[CONFIG_ADCBUF_0_CHANNEL_0][i]);

       }

       Display_printf(displayHandle, 0, 0, "\r\nCONFIG_ADCBUF_1_CHANNEL_0:");

       for (i = 0; i < ADCSAMPLESIZE; i++)

       {

           Display_printf(displayHandle, 0, 0,

               "   %u,", outputBuffer[CONFIG_ADCBUF_1_CHANNEL_0][i]);

       }

       memset(outputBuffer[CONFIG_ADCBUF_0_CHANNEL_0], 0, sizeof(uint16_t) * ADCSAMPLESIZE);

       memset(outputBuffer[CONFIG_ADCBUF_1_CHANNEL_0], 0, sizeof(uint16_t) * ADCSAMPLESIZE);

   }

 

}

 

  • Hello,

    For the details about the sequencer, please see the technical reference manual.

      

  • This table is not clearly answering my question about Sequencer’s Depth.

     

    In CCS  *.SysCfg TI is using the word “channels” meaning inputs with pin number. That is, I can

    connect to SS0 let’s say 8 sensors. In TI reference manual the word is “samples”. The “depth” is equal

    to the number of “samples”.

     

    Rephrased question 1: Does this mean that SS0 has only 8 electronic registers to hold the data, or it has

    8 x 8 electronic registers? That is if I have 8 inputs (8 samples) – each input has the depth of 8, that is

    total number of data that the SS0 is holding is 64 ?

     

    Rephrased Question 2: If I have 4 inputs connected to SS0, does this mean that the depth is 2 (shared),

    or the depth will be 8 for each input?

     

    Question 3:  Also, I asked to check the example with the last SDK 4.20.00.12. This is not my

    programming. This is TI SimpleLink Academy Lab named “ADC Simultaneous Sampling”, with some

    modification according to Lab instructions and using only one channel and SS0 for each ADCs.

    This is not the same SS0. Each ADC0 and ADC1 has its own SS0. This is not the only TI Lab Example

    that is not working.

     

    Thank you in advance.

  • Sequencer 0 has 8 FIFO entries (words) total. [Ref User Guide (SLAU723A) Sec 10.3.1 (final paragraph) and Table 10-25]. It has 8 entries total even if you're only sequencing one channel, so in theory you could run 8 such sequences before you have to unload the FIFO.

    The FIFO depth doesn't need to be the same as the sequence (channel) count, but that's what they chose. It really ought to be at least the sequencer count, or with a "full" sequencer any hiccup in the DMA would cause an overflow, and non-DMA would be infeasible.

    I'm not familiar with SimpleLink Academy, so someone else will have to help with that. If you changed something, though, that would be a place to start.

  • Hi Bruce,

    Thanks for information. 

    Eugene

  • I was asked by TI if this resolved my issue. 

    Partially Bruce solved - Thanks!

    I am spending time trying to fix TI SimpleLink Academy Lab Example “ADC Simultaneous Sampling” that is not working.

    Why to publish software that is not working?  And this is not the only Example that is not working. Can you fix your software

    and your Lab instructions?  You will save a lot of time on customer's questions, if you will publish working software!

    I am still waiting somebody to look at the code.

      

**Attention** This is a public forum