Hello!
I want to use the F2837xD block from said package to create four synchronized 100kHz, 50% duty cycle PWMs, each phased shifted with respect to the others.
The scheme I'm using is the following: ePWM12 generates a 100MHz "master clock" (the frequency is identical with the ePWM clock), that generates a SYNCOUT signal every time the counter reaches zero. I use this SYNCOUT signal to synchronize other "slave" PWMs (ePWM1 up to ePWM4). The latter have their Sync. Output set to "Pass through". The slaves share the counter period value of the master (ePWMLink TBPRD set to ePWM12).
Because high resolution is needed, I enabled the option "Enable high resolution PWM (HRPWM)" in the slave ePWM modules (not in the master). I enter the phase shift value as a decimal (in this case, i tried the register value 10.25 which should be "broken down" into TBPHS and TBPHSHR values). TBPHSHR doesn't work right now, but that's another story.
With that, I encountered a bug:
For exactly 100kHz, 50% duty cycle, I have to change ePWM12 counter period value to 991 instead of 1000 and the counter compare value for the duty cycle to 492 instead of 500. I apply no phase shift to the reference counter (ePWM12). What causes this error between mathematically correct and really needed values?
Sincerely
Matthias
Student (University of Applied Sciences Ingolstadt)
PS: I am generating my Code with the C2000 Simulink block set, but I don't think that causes the problem. I confirmed that the code only copies the values received from simulink into the corresponding registers.