STM32F030: Combining/modulating two PWM signals (logical AND) into one output
I have a requirement to generate two PWM signals on an STMF030 MCU
- PWM1: 3-5kHz, 40-60% duty cycle
- PWM2: >40kHz, 1-100% duty cycle
I need to combine these two PWM signals, using logic AND, into one (modulated) PWM output, like so:

The signals could be combined, by:
- Using (external) hardware to combine PWM1 and PWM2, using an AND gate or dual open collector/-drain output.
- Configuring PWM1 to generate interrupts on rising and falling edges, and switching PWM2 on and off (x%/0%) in the ISR. PWM2 would generate the desired output.
Is it possible to perform the logic AND of the two PWM signals within the STM32 hardware/timers itself, without wasting cycles and power by having to service up to 10,000 interrupts/second?
The application is VERY cost sensitive, so changing to a more powerful STM32 range is not really an option. I might even attempt to shoehorn the final firmware into an STM8 in the end, but that would obviously be incompatible in this regard.
Any suggestions/ideas are welcome, and the solution can be hardware unique, i.e. not be HAL compatible.
/Morten
