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/LAUNCHXL2-TMS57012: Trouble triggering ADC from PWM

Part Number: LAUNCHXL2-TMS57012
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

I have been using HALCOGEN to initialise the device peripherals, but i'm having trouble triggering an ADC measurement at the end of a PWM cycle.

I have configured PINMUX, PWM and ADC1 to use ePWM_A1 using HALCOGEN, but nothing was working until I cleared the SOC1A_SEL bit in PINMMR35[0], but I had to do this in code after the HALCONGEN init functions.

Is there a way to get HALCOGEN to clear the SOC1A_SEL bit?

Also the continual triggering from PWM doesn't work until I perform a single software trigger for the ADC group, is this related to the unusual init sequence I have ended up with due to the workaround mentioned above?

Thanks.

  • Hello,

    The code generated through HALCOGen doesn't configure PINMMR35/36. SOCxA_SEL used in PINMMR35/36 are set by default. If you want to use ePWM_A1 to trigger the ADC sampling, you have to clear the SOCxA_SEL bit in PINMMR35 manually in your application. To use ePWM_A2/ePWM_AB, no change is needed.

    I am sorry for the inconvenience.

    The ePWM trigger can be used for both single conversion and continuous conversion. The clearing the SOCxA_SEL bit in PINMMR35 doesn't affect the mode of conversion. Is wPWM_A2 (don't need to clear SOCxA_SEL bit in PINMMR35) able to trigger the continuous conversion?

  • Thanks for getting back to me so quickly.

    That clears up the first point, thanks for the clarification on that.

    I don't think I explained my second point very well. I've configured the ADC for single conversion mode and i'm triggering that from the end of period signal from the PWM (this works when SOC1A_SEL is cleared), the problem is the first of the repeated conversions (when triggered by PWM) only happens once a software trigger is issued to the ADC (after this it works as expected). I would expect the PWM trigger signal to the ADC would be enough on it's own without any extra steps to start the process.

    Thanks,

    Steve

  • Hello Steve,

    You need to write the desired channels to the Channel-Select Registers first before ADC conversion triggered by HW. 

  • Thanks for your help, it's working great now!