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.
Hello,
I decided to see if it was possible to implement a pulse scheduling system (as per an engine managment system I implemented on an 8-bit platform) using the ePWM timers of the F28XX DSP. The DSP would make a great processor for giving me loads of time for complex control algorithms compared to the 8-bit CPU I currently use.
This is what would happen.
The DSP would enter a timer compare ISR (say from a compare event where the pin action is to SET on compare). The code would set up the end of a pulse (a CLEAR on compare event ) to occur in the future.
Net result. I see NO pulse at all, but the interrupts are happening!!! I discovered that although the DSP has generated the compare event ISR, the pin has not changed state (or SET) in this case. After a couple of hours.......I discovered that the pin change occurs on the next timer count after the one that causes the compare match interrupt.
Should they not be the same thing?
What this means, is that if I am using a ePwm timer rate (for example) of FCPU/150 to get a 1us resolution with a maximum pulse width approaching 65msec (assuming no 16-bit roll capable code) , that once I get to my compare interrupt, I cannot set up the timer for the clear on compare until about 150 clock cycles later, because otherwise I will interfere with the SET event which hasnt happened yet - I have to hang around in the ISR waiting.
Why has the PIN state not changed at the point the DSP has generated an interrupt because of a compare match? Is there a way to not waste CPU cycles?
(I mean other than assuming I having other work to do in the ISR, doing that first, and then setting up the timer compare register and action last so as to not waster too many cycles)
Regards, Nick
Have you had an opportunity to take a look at the C/C++ Peripheral Header examples? This software collateral provides a means of declaring peripheral registers in a way via data structures in your software. In addition to this infrastructure, there are a number of simple examples including ePWM examples that affect the action on the pin.
While I can't say your specific use case is embodied in an example, you should be able to run one of these examples and ensure the device can set/clear pins based on the action desired. Then take that and modify to your needs, or incorporate into your own project.
You should be able to go to the Product Folder of the specific device you are targeting and find a link to the aforementioned software.
Yes, thanks. I use the TI supplied header files. I can set and clear the pin as I wish. I am interested in why the pin action appears to follow the interrupt generation by one ePwm timer count.
Would you be able to setup the Compare A channel to perform the set and the setup the Compare B channel to perform the clear, and have both of these setup prior to the beginning of the PWM cycle?
I'm thinking of the example depicted in Example 2-3 and Figure 2-3 of the ePWM User's Guide (SPRU791).
That is a nice solution, however it's drawback is that it would mean I'd only get one 'independant' pulse output channel for each ePWM module on the DSP.
The more output channels I have, the more cylinders (injectors and ignitors) I can independantly operate.
Ideally I'd like 12 channels I'd get from 6 ePwm modules, enabling sequential injection and ignition for 6 cylinders......
If only there was a low end DSP with a whole bunch more ePwms...dont need the high resolution....perfect for automotive ;)
Ok. How are you configuring the counter, in an up-down configuration or something else?
If you use an up-down configuration, then you could configure the "action" for Compare-Up and Compare-Down differently per channel (ie. A and B). The risk in changing the compare value on the fly is at the peak of the counter value, if the compare value is close. You would not be able to update it in time before the down-side occurs.
I haven't experimented with this to see if it can actually be implemented, but was a thought that I wanted to share.
Maybe a stupid question, but did you define the used ePWM from GPIO to act as ePWM unit or is it defined as an I/O?
Nicolas- I've been monitoring the posts. I support your company world wide as TI's globla account manager. Although I'm sure the forum will be helpful, you may benefit by making contact with a local TI applications resource. I can put you in touch when appropriate. Where are you located? You can reach me directly via robeschbach@ti.com.
Thanks,
I'm using as an ePWM, using pin actions on the compare event to change pin state.
I am using the timer in count up mode (i.e. value looks like a saw-tooth waveform)