Code: Select all
#define SOC_MCPWM_GROUPS (2) ///< 2 MCPWM groups on the chip (i.e., the number of independent MCPWM peripherals)
#define SOC_MCPWM_TIMERS_PER_GROUP (3) ///< The number of timers that each group has
#define SOC_MCPWM_OPERATORS_PER_GROUP (3) ///< The number of operators that each group has
#define SOC_MCPWM_COMPARATORS_PER_OPERATOR (2) ///< The number of comparators that each operator has
#define SOC_MCPWM_GENERATORS_PER_OPERATOR (2) ///< The number of generators that each operator has
When allocating such a driver one has to go through this cascading config calls to configure a timer, then it's operator, then it's comparator and so on...
I've basically copied the init code from the BDC speed control example here.
During configuration some "group ID" has to be set twice, once in a mcpwm_timer_config_t and once in a mcpwm_operator_config_t struct.
Code: Select all
mcpwm_timer_config_t timer_config{
.group_id = SOME_ID
// ...
};
mcpwm_operator_config_t const operator_config{
.group_id = SOME_ID
// ...
};
So I'd have two PWMs running from MCPWM group 0.
And two PWMs from MCPWM group 1.
However that doesn't seem to work. Once I allocate a second driver on the same ID the first one stops working...?
Is this supposed to happen? What would be the correct way to initialize four PWMs?
/edit
ok nvm, it works as intended...
Can't say why it didn't before.