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.

Generating PWM using Halcogen

Other Parts Discussed in Thread: HALCOGEN

Hi,

I try to do a motor control with Hercules Launcpad TMS570. Is it possible to generate synchronus pwm to 3 output nhet pins with Halcogen ? If not, what is the best way to provide synchronization of 3 pwm output. Is there any documents, example or tutorial for generating PWM with Halcogen except "PWM Generation Using Halcogen" exercise ?

  • Furkan,

    This post has some links to various programs you can try.

    From HalCoGen you can run these type of programs by selecting 'Enable Advanced Config Mode' in the HET Global Timing Configuration tab and then browsing to the .h and .c file.

    You should run the programs in the HET IDE first though.  

    They probably need changes to be configured for the TMS570 Launchpad.

    Two things that you should check are:

       - pin assignments - might need to be changed for the launchpad. 

      - het memory usage.

    The first is pretty trivial.  The PIN# is just a field in the HET instruction and you can change it with search/replace OR even easier if you look at the HET program that I posted I know they are defined symbolically with .equ statements at the top of the program.  So if some pin like HET[20] isn't available on your launchpad, and there's a  SOMEPIN .equ 20 statement at the top of the program, you can change that .equ and it should change which pin is used for the HET function but the rest of the program won't need changing.

    The program that I posted does use XORSHARE mode though and this means 2 adjacent 'pins' are used.  These need to be kept adjacent (i.e. 0 and 1   or   2 and 3  or  4 and 5... ) and the .equ should be setup already to ensure they're adjacent.   But you might need to adjust the XOR share boxes on the PIN x-y Tab of HalCoGen to match the pins you're using.

    And in general you also need to make the pins your are mapping to outputs in those PIN x-y tabs of HalCOGen.

    That's all there should be to changing the pin mapping.   

    For the HET RAM size, this is something that might be harder to fix.  You might need to remove some functionality from the HET program if it goes over the size available in the TMS570 launchpad.     If this is the case I'd do the work in the HET IDE until you get a good understanding of how the program works and it simulates like you want.   It's MUCH eaiser to debug HET in this environment than on actual silicon because you have visibility to registers, RAM, and can trace the internal states in Waveformer from Synapticad.

     

  • Anthony;

    Thanks for your explainations but i could not find any post or attachment. Where did you post them. Sorry, i am new at TI forums.

    I have another question. How can i generate complementary pwm to two output. I planned to use this complementary outputs for switching 3-phase bridge's high and low mosfets.

  • Furkan,

    Sorry I think I'm the newbie ... I forgot to hit CTRL-V to past the link.

    http://e2e.ti.com/support/microcontrollers/hercules/f/312/p/287386/1002667.aspx#1002667

    I think the example there will do what you want (link in post from me on AUG 29, 19:27.
    But there's a small bug that needs to be worked around when the counter rolls over; and I haven't made this workaround yet.  See post on Sep 4th.

    I'm pointing to the post above rather than directly to the post that has the code, because we had some good discussion in this post about how the code works and it's not a simple program; so the discussion might be very useful.

  • Anthony,

    Thanks again for answer. I partically solved my problem. Instead writing it with HET IDE, I generated 3 PWM output and one RTI with  using halcogen. For 50 Hz sinus, i set up my RTI counter for 1 ms. When my program interrupted and go to  rtiNotification routine, i changed the duty cycle of pwm outputs. With adding offsets to dutycycles, 3 phase outputs phases shifted.

    Now, i will gonna add a sine look-up table for dutycycles. My complementary PWM output problem still waiting for solve. I want to seperate outputs as high and low and change their duty cycles simultaneously. Of course switching mosfets simultaneously cause band-gap problems.

    I will update my post when i solve my other problems and i'm waiting for your opinions.

    Furkan.