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.

TMS570LS0432: Texas Instruments Hercules TMS570 HET serving two functions

Part Number: TMS570LS0432
Other Parts Discussed in Thread: HALCOGEN

I have adapted an example from this forum to make the NHET behave as an I2C interface. This is working OK. My issue is that I also want a PWM. Will this processor support both functions?

With 19 HET I/O pins do I only get one HET function?

Worst case scenario, can I piggy-back the PWM code to the end of the I2C code?

My I2C HET code takes 72 instructions and the example PWM is 58 instructions for a total of 130. The High-End Timer (N2HET) Module document indicates that there's a max of 128 instructions. If I can piggy-back the PWM after the I2C I would have to find a way to trim two instructions, most likely from the PWM.

For reference:

SDA_PIN is N2HET[19], SCL_PIN is N2HET[6] and PWM output pin is N2HET[0].

Thanks in advance,

        ken

  • Hi Ken,

    You don't need 58 instructions to generate a single PWM, it is only the HALCoGen implementation which is a specific "canned" example to support the other configurability options. A PWM can be simply generated using three instructions:

    CNT (max value defines the period of the PWM),
    ECMP (compare value defines the duty cycle of the PWM), and
    MOV32 (for synchronous update of PWM).

    You can use the HET IDE to simulate the code required to generate the PWM: http://www.ti.com/tool/HET_IDE

    Regards,
    Sunil
  • Sunil:

    Thanks for your reply. I will give this a try.

    PWM is really overkill for our application. I've implemented a GPIO that turns on or off every 1ms depending on an ADC reading. This resolution is good enough for our purposes. However, when I've got a free minute or two I'll try the PWM implementation that you've suggested. In the meantime I'm going to close this as resolved.

         ken