Hello,
Is the code being produced for the PWM using a timer module in PWM mode?
If it is then the debugger slowing down the code should be irrelevant. The PWM then will be produced in hardware which should only be affected by the clock. Question is why should the clock be different when using the debugger.
What is your clock setup?
Hello,
Check the value within the ICSTRM register at address 0x003A, and compare with the value stored at flash address 0xFFAF. The two values should be identical, assuming the initialisation code sets the ICSTRM register using this flash value. If the two values are different during debug, this might account for the differences you are observing.
For the PWM frequency that you require, a trim frequency of 31.25 kHz would seem to be a better choice. This will require a modulo value of 39999 with a bus frequency of 4.000 MHz. This may simplify the calculation of the required channel value for a given duty cycle.
Regards,
Mac
Hello and welcome to the fora, Plato
Quite simple! Don't believe the marketing hype. The debugger is not non-intrusive. It does steal cycles from the CPU and it will slow down a running programme slightly. It is "not very"-intrusive! Mostly it still allows you to see what is going on though. For precise timing you need to run without the BDM doing accesses.
Hello,
This does seem to suggest that the PWM bean within PE does not use PWM mode associated with the TPM module - I might have expected that the CPU cycle stealing for the debug process would not have affected the operation of the TPM module hardware.
If the PWM bean does use a software method, it may also be susceptible to delays caused by other interrupt processing.
Regards,
Mac