When using a 16-bit PWM you need a frequency of 50 kHz. That means your PWM input frequency divided by the PWM-period+1 must give 50,000. so when using 24MHz your period value must be 479.
To dim the LED you should set the pulsewidth to something between 0 (zero) and your period value (479) to have it dimmet 0 to 100%.
Not sure if this is appplicable but there is a LED dimming module,
SSDM, under LED Dimming in the module catalog.
Has the advantage of reduced clock noise.
I´ve set the System Clock to 24 MHz and use the following Dividers VC1=6, VC2= 4, VC3=20 to create the 50KHz.
If you want the led to switch at a 50 Khz period, duty cycle changed to control its
brightness, then use a 8 bit, and its clock would be 256 X 50 Khz, period set to 255,
and change the compare value over a range of 0 - 255.
The PWM relationships from datasheet (FCLOCK is the clock you feed to PWM) -
TOUT = (PeriodValue+1)/FCLOCK
FOUT = FCLOCK/(PeriodValue+1)
If you are just doing dimming 50 Khz probably unnecessarily fast, something like
100 Hz to 1 Khz typical. If you used clock of 50 Khz to 8 bit PW, VC3, set PWM
period to 249, then you would get LED switching freq of 200 Hz..
Thank you for your help, now that I see how the period-value is calculated, things are much clearer.
I know that 50KHz is a lot for just dimming a LED, but thats what is written in the specifications for the LED-Drivers im using, so I hope this works out.
Keep in mind, if you can use it, the SSDM approach minimizes EMI.