Re: halconf and mcuconf for pwm: #error compile time
Posted: Tue Mar 15, 2016 4:53 pm
It is a good idea to reduce the tick rate.
Giovanni
Giovanni
ChibiOS Web Boards
https://forum.chibios.org/
Code: Select all
static PWMConfig pwmcfg = {
1000000, /* 1MHz PWM clock frequency. */
50, /* Initial PWM period . 50 is for 20kHz , 1000000 is for 1 Hz*/
NULL,//no callback
{
{PWM_OUTPUT_DISABLED, NULL},//CH 1
{PWM_OUTPUT_ACTIVE_HIGH, NULL},//CH 2
{PWM_OUTPUT_DISABLED, NULL},//CH 3
{PWM_OUTPUT_DISABLED, NULL}//CH 4
},
0,
0
};
Code: Select all
pwmStart(&PWMD2, &pwmcfg);
pwmEnableChannel(&PWMD2, 1, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 5000));//DC 50%
Code: Select all
pwmStart(&PWMD2, &pwmcfg);
pwmEnableChannel(&PWMD2, 1, pwmcfg.period/2);