Hi
Like so often ... it is impossible to give good assistance if we don't have sufficient information.
Most probably it is a problem of the code or the hardware.
--> show us your code and your hardware schematic.
maybe increasing filter capacitor solve this problem or check the output filter design. Little improvement can solve this problem if there is no problem in operating section.