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/TMS570LS0432: TMS570LS0432

Part Number: TMS570LS0432
Other Parts Discussed in Thread: HALCOGEN, TMS570LS0714

Tool/software: Code Composer Studio

I liked the C2000 demo project where we defined a voltage output using a PWM and read it via an Adc we had jumpered to the PWM

Is there something similar for the Hercules, or if not, could someone define the steps to do it?

Also for the Hercules is there any way using SW to generate a PWM -the example demo does everything in HalCoGen? Are no pwm.c and pwm.h available? I would like to set a SW tag to the wave generated so I could view it in the debugger.

  • Hello Nolan,

    In some of the Hercules devices we have include the 'e' timers used by the C2000 product team including eQEP, eCAP, and ePWM; however, we only include eQEP on the lower end devices in the Hercules family of devices. All of our devices also include our original timer peripheral called NHET or N2HET which are the latest versions of our HET IP.

    The HET is a programmable autnomous timer module capable of very complex time based operations involving PWMs, input capture, edge detection, and even logic to allow dynamic output of the timer signals all in a manner that is independent of the CPU. There is quite a bit of documentation on the HET module within our application notes and example projects. Although I will admit it can be quite daunting at first to master, once you do, the possibilities of use are very extensive including protocol implementations such as SENT, SPI, SCI, I2C and UART not to mention signal generation such as sinewave generation, traditional PWMs, etc.

    Halcogen includes the ability to make simple PWM outputs on NHET which is the starter function you are really looking for. To begin, there is an example application included with Halcogen that blinks an LED at a rate defined by the PWM duty cycle. You should be able to adapt this to the PWM generation you are looking for by selecting a different HET output channel to align with one of the NHET channels available on the 40pin header.
  • I understand about using the HET to program PWMs, and how to do it in HalCoGen.

    However my project manager wants to do it in software. HalCoGen does not generate a pwm.c ,  pwm.h, or a ePwm.c , ePem.h

    I do see an eqep. Dunno what that means, can I program it to generate a PWM in SW?

  • Nolan,

    I don't understand the comment that your project manager wants you to use software? The code generated by Halcogen is C code with the inclusion of the HET specific code which is HET assembler object code. The HET object code is loaded to HET RAM at startup and executed by the micomachine during operation. All of this is software so thus the confusion.

    If what your manager wants is to bit bang the PWM, that could be supported as well if you want to create some custom code. Generally, I would recommend using the RTI to issue an interrupt every desired number of clock cycles so the in could be toggled. If you want something other than 50% duty cycle, you could use more than one RTI counter with one being toggle high to low and the other low to high. Your software would have to set the ratio between the counters to define the duty cycle.

    If, however, you manager is expecting a ePWM oe ePWM like module on the device, the LS0432 does not have this. However, you could consider an upgrade to the TMS570LS0714 which does include the ePWM timers (for sure in the 144 TQFP, but would have to check the 100 TQFP pacakge.)
  • Chuck,

    I agree about using HET etc. However they only bought the low end board, which I di NOT think has any SW programming capacity for PWM generation. Sure I could generate one on HalCoGen using the HET timers, but they have this concept you can do it in SW, which I actually did for the C2000 series. SO do I tell them it's a no-go, that they have to buy another board?
  • Again, the HET programming is software as well so I don't understand where you are coming from? The LS0432 has up to 19 HET channels so it can be programmed to provide up to 19 separate PWMs. Perhaps if you explain a bit more what you mean by software PWMs? The name of the file (pwm.c, pwm.h, epwm.c, epwm,h, het.c, het.h) are all arbitrary and have nothing to do with the actual programming and use of the device features.

    Just to be certain we are on the same understanding, HALCoGen is a tool used to generate the Hardware Abstraction Layer Code for the device. It provides a GUI on top of a configuration engine that outputs the driver level code with the module configurations that you choose. If we had the ePWM module it would do the same for it. Its sole purpose is to prevent you from needing to write all the driver level code (software) to write to all of the registers to configure each periheral for your application. It provides APIs to be called by your application layer code to use the drivers to perform you application. Amongst these drivers is the HET driver. The simple interface supported by HALCoGen is limited to some simple PWMs but there are other examples of HET code where there is a very high degree of functionality implemented for complex operations. The HET also has it's own HET IDE and assembler that can be used to customize the HET program for your applciation. There is also a HTU (HET Transfer Unit similar to a DMA but focused on HET) that can be used to change parameters in the HET memory (command lines) so that you could, for example, dynamically alter the PWM outputs similar to adjusting the duty cycle in the ePWM.

    In the end, if you want to tell them it's a no-go, it's up to you. The HET can provide the same functionality as the ePWM and more so I don't think this is a true statement. If you would like to discuss in a call with your managers, for sure we could arrange that. If you need ePWM functionality, then for sure the next device up the family tree has it and is available in a pin compatible 100 pin TQFP package but it has substantially more capability at 160MHz system clock and up to 1MB of Flash compared to 80MHz/384KB for the LS0432.
  • Nolan,

    Look at the header file that you get from HalCoGen for HET and it's PWMs.. 

    void   pwmStart(hetRAMBASE_t * hetRAM,uint32 pwm);
    void pwmStop(hetRAMBASE_t * hetRAM,uint32 pwm);
    void pwmSetDuty(hetRAMBASE_t * hetRAM,uint32 pwm, uint32 pwmDuty);
    void pwmSetSignal(hetRAMBASE_t * hetRAM,uint32 pwm, hetSIGNAL_t signal);
    void pwmGetSignal(hetRAMBASE_t * hetRAM,uint32 pwm, hetSIGNAL_t *signal);
    void pwmEnableNotification(hetBASE_t * hetREG,uint32 pwm, uint32 notification);
    void pwmDisableNotification(hetBASE_t * hetREG,uint32 pwm, uint32 notification);
    void pwmNotification(hetBASE_t * hetREG,uint32 pwm, uint32 notification);


    So you have functions to call to start and stop a PWM,  set it's duty cycle,  set/get it's 'signal' struct (duty + period together in a struct), and manage interrupt notifications.

    You don't have to write any HET code to use the HET for PWMs as long as you can live w. the above APIs and you configure which pins have the PWMs come out of them through the HalCoGen GUI.   You can have up to 8 PWMs coming out of each HET with the default program and the GUI lets you pick which pins.


    There's similar APIs for the edge detect and input capture functions of the HET program.


    In a nutshell - someone wrote a HET program to make the HET look like a standard timer you might find on any MCU, and they wrote C APIs to interface to this program like a standard hardware timer. And all that is packaged neatly in HalCoGen's HET driver.

    As an end user of this Driver just think about it as a hardware timer implementing the block diagram of PWMs, Edge Detects, Captures etc that you see in HalCoGen. 

    Don't worry about anything else really.    Know in the back of your mind though that you can change how this 'simple' view behaves if you need to by reprogramming HET... but try to avoid needing to.

    My 2 cents anyway.


    Best Regards,

    Anthony

  • Wow Anthony,

    That's a great answer. It made my day, and saved me a lot of development time.

    Thanks,

    Nolan

  • Anthony,

    I tried the functions you reference in a simply blinky program. No joy.

    Can you give me a idea of what is wrong. When the Het inits the LED stays lit regardless of the code, which is below. If I do not init the Het the led never lights.

    It's probably some undocumented thing I need to do on HalCoGen, which I totally hate.

    Thanks,
    Nolan


    int main(void)
    {
    /* USER CODE BEGIN (3) */
    hetRAMBASE_t * hrt;
    hetSIGNAL_t signal;
    hetInit();
    signal.duty=80;
    signal.period=500;
    pwmSetSignal(hetRAM1,8, signal);
    pwmStart(hetRAM1,8);
    uint32 flip =0;
    while(1)
    {
    if(flip)
    {
    pwmSetDuty(hetRAM1,8, 80);
    flip=0;
    wait(0xFFFFF);
    }
    else
    {
    pwmSetDuty(hetRAM1,8, 0);
    flip=1;
    wait(0xFFFFF);
    }

    };

    return 0;
    }
    /* USER CODE END */


    /* USER CODE BEGIN (4) */
    void wait(uint32 time)
    {
    while(time){time--;};
    }
    /* USER CODE END */