Controlling the PWM output of MCU (STM32L152RE)?
Yes, most MCUs do allow changing both duty and frequency.
But perhaps it helps to not to think of your signal as frequencies and duties, but simply as high or low pulses with various lengths.