PWM asserts invalid
Posted: Sat Feb 25, 2012 10:15 am
Morning all,
I finally got board repaired to play with and need to hack a quick 32768 clock using pwm so I put:
And immediately hit a code in pwm_lld.c does not very much agree with me:
What I find fun is if I comment out that assert then the signal is generated perfectly and the component requiring it works...
I finally got board repaired to play with and need to hack a quick 32768 clock using pwm so I put:
Code: Select all
static const PWMConfig pwmcfg = {
32768*2,
2,
NULL,
{
{PWM_OUTPUT_ACTIVE_HIGH, NULL},
{PWM_OUTPUT_ACTIVE_LOW, NULL},
{PWM_OUTPUT_ACTIVE_HIGH, NULL},
{PWM_OUTPUT_ACTIVE_HIGH, NULL}
},
0,
};
pwmStart(&CRYSTAL_DRIVER, &pwmcfg);
pwmEnableChannel(&CRYSTAL_DRIVER, CRYSTAL_CHANNEL, PWM_PERCENTAGE_TO_WIDTH(&CRYSTAL_DRIVER, 5000));
And immediately hit a code in pwm_lld.c does not very much agree with me:
Code: Select all
chDbgAssert((psc <= 0xFFFF) &&
((psc + 1) * pwmp->config->frequency) == pwmp->clock,
"pwm_lld_start(), #1", "invalid frequency");What I find fun is if I comment out that assert then the signal is generated perfectly and the component requiring it works...