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

Part Number: TMS570LS3137


Tool/software: Code Composer Studio

I want to use the function "pwmGetSignal()" to get current duty and period of the given PWM signal, the program is like below:

and I monitor the value by CAN message. But I do not get the needed result. (The right result should be 0x32/0xe8/0x03 in last three Bytes). The given duty is 50%  and period is 1000 us.

I don't know what's the reason. 

  • Hello Shushua,
    Did you check the values of tx_data1[5], tx_data1[6] and tx_data1[7]? Could you try:
    hetSIGNAL_t tx_signal;
    ....
    pwmGetSignal(hetRAM1, 2, &tx_signal);

    Best regards,
    Miro
  • tx_data1[5], tx_data1[6] and tx_data1[7] values are in the above picture:FD 00 00;

    And this way you said "pwmGetSignal(hetRAM1, 2, &tx_signal);" is not right. Because the function is like this:
    void pwmGetSignal(hetRAMBASE_t * hetRAM, uint32 pwm, hetSIGNAL_t* signal)
    The last parameter is a pointer.
  • Hello,

    I slightly modify your code to test it in general.

    Here are my modifications:

    hetSIGNAL_t signal;

       hetSIGNAL_t tx_signal;

       uint32_t i=0;

       uint8_t tx_data[3];

       uint64_t uData = 0;

       hetInit();

       for (i=0; i==5000000; ++i);

       signal.duty = 10;

       signal.period = 1000;

       pwmSetSignal(hetRAM1, pwm0, signal);

       pwmGetSignal(hetRAM1, pwm0, &tx_signal);

       tx_data[0] = (uint8_t)tx_signal.duty;

       uData = (uint64_t)tx_signal.period;

       tx_data[1] = (uint8_t)tx_signal.period;

       tx_data[2] = (uint8_t)(((uint64_t)tx_signal.period) >> 8);

    And results are as expected:

    Best regards,

    Miro

  • Thank you very much, your solution resolve my problem.