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.

TMS320F28377D: TMS320F28377D

Part Number: TMS320F28377D

Hi,

I modified the original example adc_ex5_soc_continuous that has 2 continuous conversion into 1 conversion.

Here is the code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//
// Included Files
//
#include "driverlib.h"
#include "device.h"
//
// Function Prototypes
//
void configureADC(uint32_t adcBase);
void setupADCContinuous(uint32_t adcBase, uint32_t channel);
//
// Defines
//
#define RESULTS_BUFFER_SIZE 1024 //buffer for storing conversion results
//(size must be multiple of 16)
#define EX_ADC_RESOLUTION 12
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
// Sample on single pin (VREFLO is the low reference)
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

When I input 5 kHz sinusoid and use different interrupt sources i see that there are glitches. I would expect  ADC_setInterruptSource(adcBase, ADC_INT_NUMBER1, ADC_SOC_NUMBER15);  should not have any glitches as it makes sure all conversions completed. Here is the screen shot of the graphs

thanks vadim

  • Hi, 

    The expert is out of the office because of Holiday. Please expect a reply by Tuesday.

    Thanks.

  • Hello Vadim,

    If you only use 1 interrupt for all 16 SOCs, there will not be enough time to convert the values before beginning the conversion of the next set of SOCs. The example you were looking at provides the proper way to trigger all 16 SOCs (with at least 2 interrupts), that way there is enough time to convert SOCs while reading the results of the other SOCs.

    Also, as a future note, please use the Instert -> Code method of copying and pasting code. The way you have inserted your code here makes it unnecessarily difficult to read, and I will not be able to find what you're talking about as easily.

    Best regards,

    Omer Amir

  • Hi Omer,

    Thanks for your support. I understand that ADC SOC has priorities according to round robin method. I understood this as the current conversion will not start till the previous conversion is not finished.

    In this case the interrupt assigned to the last SOC15 should trigger the first SOC0 of the first channel? So if my EPWM time base is larger than sequential 16 SOC*75 ns , I should not see any glitches?

    I believe that I am doing the same thing as the example, with the difference of having 16 continuous channels versus 4 in example for A2 input.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    //! This example sets up ePWM1 to periodically trigger a set of conversions on
    //! ADCA including multiple SOCs that all convert A2 to achieve oversampling on
    //! A2.
    //!
    //! ADCA Interrupt ISRs are used to read results of ADCA.
    //!
    //! \b External \b Connections \n
    //! - A0, A1, A2 should be connected to signals to be converted.
    //!
    //! \b Watch \b Variables \n
    //! - \b adcAResult0 - Digital representation of the voltage on pin A0
    //! - \b adcAResult1 - Digital representation of the voltage on pin A1
    //! - \b adcAResult2 - Digital representation of the voltage on pin A2
    //!
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    thanks Vadim

    PS I tried to input code as you suggested.

  • Hello Vadim,

    In this case the interrupt assigned to the last SOC15 should trigger the first SOC0 of the first channel?

    The interrupt assigned to an SOC will cause that SOC to trigger, so you can use 1 interrupt to trigger multiple SOCs. However, the way your code was structured made it so that interrupt 1 was triggering all 16 SOCs. By the time an ISR is reached or the interrupt is triggered again, the data may or may not be ready and the SOCs may not have time to convert the results before another interrupt is fired (you can monitor the interrupt overflow status for this).

    So if my EPWM time base is larger than sequential 16 SOC*75 ns , I should not see any glitches?

    If you're using the ePWM to trigger the SOCs and not just the interrupt or software trigger, then if you make the time base period long enough it should be okay. However, the code you have does not look like the ePWM is being used to trigger the SOCs, it looks like you're using ADC interrupt 1.

    PS I tried to input code as you suggested

    I've reformatted your original post so that it's easier to view.

    Best regards,

    Omer Amir

  • Thanks Omer,

    So if I use  ADC_TRIGGER_SW_ONLY in

    Fullscreen
    1
    2
    ADC_setupSOC(adcBase, ADC_SOC_NUMBER0, ADC_TRIGGER_SW_ONLY,
    (ADC_Channel)channel, acqps);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I must define the interrupt that triggers SOC ADC_INT_SOC_TRIGGER_ADCINT1

    Fullscreen
    1
    2
    ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER0,
    ADC_INT_SOC_TRIGGER_ADCINT1);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    in original example 16 SOC were split into 2 groups each triggered by different interrupt.

    thanks vadim

  • Hello Vadim,

    Yes, that is correct; the original example used 2 groups of interrupts and used ADCINT1 to trigger one group of SOCs, but this is because using 1 interrupt will not give enough time to convert the results before that interrupt is triggered again. If you using a trigger like a ePWM or CPU timer, you should be able to set the period to be long enough such that the results can be converted (but to a certain degree, this will not be converting results as fast and continuously as possible, since you will be missing values as you extend the conversion time).
    Best regards,
    Omer Amir
  • Thanks Omer for fast response!

    vadim