Elegant way to generate 6 variable frequency GPIOs with STM32F446RE.
Hello forum, my goal is to emulate a DC motor family with some electronics and an STM32F446RE.
The current setup is, an ECU to control 6 of these motors, 6 coils of the motor family as load, 6 current sensors, running in the STM32, and from there i need 6 frequency modulations back to the ECU. The frequency goes from 5or1Hz up to 5or10kHz.
The STM will do current measurement conversion from cur. to freq. and some state machine for testing different behaviers/errors that these motors have. And later on some communication with the PC for better testing.
My first approach will be a 100kHz timer decrementing a counter variable for a defined high and low time. Lets say count from 10 to 6 with GPIO high and from 5 to 1 with GPIO low. If counter reaches 0 get new high and low times calculated in the main loop.
So my question are: Can i get this leaner? Especially for the processor. I allready use the DMA for ADC conversion so maybe its good for the GPIO as well?
Is a 100kHz time interrupt ok/feasible? Can i go even higher or is 20kHz with 1 up 1 down the way to go for a task like this?
I'm also open for other experience in frequency modulation with the STM32.