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/TMS570LC4357: pwmGetSignal

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Hello,

I generate a PWM-Signal via HCG and want to use another Pin from the HET as Input to calculate the PWM-Period. I found the function pwmGetSignal() in HL_het.h.

My questions:

1. Why the hell is this function a nonvalue-returning method? 

2. Can I use this function to get the period?

I tried to define a hetSignal_t struct and use pwmGetSignal(). But when i define the struct, i get an error "incomplete type is not allowed", althoug I include the header file.

Best regards

Kenan

  • 1. The function does not return a value because it provides two values which are stored in a structure. You must pass a pointer to the structure.
    2. This function returns the period and duty cycle of a PWM that was previously defined in HALCoGen. I am not sure this is what you really want. See this post for some application notes that might help you: e2e.ti.com/.../624051
  • Thanks Bob for the answer,

    I have another Problem. Short section from my Code:

    struct hetSIGNAL_t *s1;
    pwmGetSignal(hetRAM1, 1, s1)

    While pwm0 is defined as output on pin 30 and pwm1 is defined as input on pin 4. Pin 30 and pin 4 are connected.
    When I run my Code and read the variables, I get the info "cannot load from non-primitive-location" for s1.

    Based on the informations from the site https://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/3325 I changed the stack size, but than I get an FTDI-error.

    I also set breakpoints in HL_het.c and read the pwmDuty there. The pwmDuty is 586 and the pwmPeriod is 1172 (no idea what these values are meaning; I set 50% as duty and 1 kHz in HCG).

    Best regards
    Kenan

  • I think what you are trying to do is:

    	hetSIGNAL_t s1;
    	pwmGetSignal(hetRAM1, 1, &s1);
    

    This declares the structure s1 and then passes the address of the structure to the function pwmGetSignal().

    Notice that 586 is 50% of 1172. What is your HET loop time?

  • I'm really grateful for your answer Bob.

    There is still the text "cannot load from non-primitive location", but now I can interpret these values.

    Best regards
    Kenan