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.

TMS570LC4357: problem with example_EPWM_ADC provided with TMS570LC4357

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

I am unable to generate a varying PWM with the example provided in the HACoGen 4.06.00.

The oscilloscope shows 5000ns period with 50% duty cycle(which was set initially in HALCoGen) but doesn't change even when I rotate the potentiometer.

(Note that I am taking input from ADIN[6] since the TMS570LC43x development kit doesn't have an ambient light sensor mentioned in the example_EPWM_ADC)

I have attached my project file below:

https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/908/1778.ETPWM_5F00_ADC.7z

  • Hello Yash,

    Unfortunately I don't have an answer for you yet on your post, but I wanted to let you know I am investigating and will get back with you as soon as I am able to complete some background work.
  • Hello Yash,

    My apologies for the delay in getting back with you. I have looked at your code and ran it in the debugger. The issue is that the function adcNotification where the PWM update is happining is never called. I assume the intention is that this would be an ADC interrupt service routine or a function called from an ADC ISR, but it doesn't appear that you have included an ISR for the ADC in your code.

    Given the simplicity of this code, I would recommend that you first set up a loop in main that includes a call to the adcNotification function on a periodic basis. Be sure to include a delay of some type so that it is not cycling too quickly. Sometimes it helps to slow these types of things down so they are observable. If you want to replicate the example on the LAUNCHXL2-TMS57012 launchpad, trace through it to see where the adcNotification is called and how the ADC interrupt is setup.
  • Thanks, Chuck,
    I tried calling the adcNotification at the rate of 100Hz, but the PWM was not changing till the controller was PORST after every change.

    But I was able to have the interrupt working as I checked and the ADC1 Event had to be traced to IRQ in the VIM Channel 0-31.

    Please note that this step is left out in the example code and the explanation. It would be nice if that could also be corrected.
  • Hello Yash,

    Thanks for the feedback on the example. I'll forward this information to the project owner.

    In regard to the example, is the PWM being updated once you enabled the interrupts? I believe this is the case based on your post, but it isn't clear to me.
  • Hello Chuck,
    Yes the PWM is being updated after enabling the interrupts.