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.
Dear team:
Routine: hrpwm_ex4_duty_updown_sfo.c
SFO enabled
My customer wants to generate centrosymmetric hrpwm waveform in up-down mode. How to adjust the duty cycle in high-resolution mode? The customer tried the following ways:
(1) In "both edge" mode, CMPAHR will phase shift the waveform instead of changing the duty cycle
(2) In "falling edge" mode, there is high-resolution duty cycle adjustment, but it cannot represent all duty cycles
Is there any better way?
Best regards
(1) In "both edge" mode, CMPAHR will phase shift the waveform instead of changing the duty cycle
This should not shift both edges in the same direction. It will shift the two edges towards/away from each other causing change in duty cycle only.
Hi Nima:
My customer tested it and found that the duty cycle can be modified with high accuracy in the asymmetric mode. But in symmetric mode, the two edges will move in the same direction.
Hi Nima:
This is the action qualifier settings:
EPWM_setActionQualifierAction(ePWM[j],EPWM_AQ_OUTPUT_A,EPWM_AQ_OUTPUT_HIGH,EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); EPWM_setActionQualifierAction(ePWM[j],EPWM_AQ_OUTPUT_A,EPWM_AQ_OUTPUT_LOW,EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA); HRPWM_setMEPEdgeSelect(ePWM[j], HRPWM_CHANNEL_A, HRPWM_MEP_CTRL_RISING_AND_FALLING_EDGE); HRPWM_setMEPControlMode(ePWM[j], HRPWM_CHANNEL_A, HRPWM_MEP_DUTY_PERIOD_CTRL); HRPWM_setCounterCompareShadowLoadEvent(ePWM[j], HRPWM_CHANNEL_A, HRPWM_LOAD_ON_CNTR_ZERO);
HRPWM_setCounterCompareShadowLoadEvent(ePWM[j], HRPWM_CHANNEL_A, HRPWM_LOAD_ON_CNTR_ZERO);
Change this to LOAD on CNTR ZERO AND PRD.
IT must be CNTR ZERO AND PRD.
Hi Nima:
In addition, I would like to ask a question.
Note in the routine: The loading method of CMPA must also be ZERO and PRD.
In the manual: The loading modes of HRPWM are ZERO and PRD, but actually only the value of the shadow register is loaded at ZERO, and PRD is used for internal logic.
So will CMPA load the value of the shadow register at ZERO and PRD, or will it follow HRPWM to load only the value of the shadow register at ZERO?
So it's a bit tricky. The user must set the load mode to ZERO AND PRD. BUT the user shadow value will only be loaded at ZERO. THE PRD load is used internally to update some internal settings hidden to the customer.