I have had PWM running for some time but not tested it for a few months. Now that I come to test, it is crashing.
I thought I'd look at the SDK manual (1.5.2) and I noted that the manual states... for PWM_INIT - that the duty is a uint8 *duty
That cannot be right as the duty cycles are 32 bits. I tried changing my array to 8 bits regardless and that caused the processor to crash immediately on power up.
Here is my code.
#define PWM_1_OUT_IO_MUX PERIPHS_IO_MUX_MTDO_U
#define PWM_1_OUT_IO_NUM 15
#define PWM_1_OUT_IO_FUNC FUNC_GPIO15
#define PWM_3_OUT_IO_MUX PERIPHS_IO_MUX_GPIO4_U
#define PWM_3_OUT_IO_NUM 4
#define PWM_3_OUT_IO_FUNC FUNC_GPIO4
#define PWM_4_OUT_IO_MUX PERIPHS_IO_MUX_GPIO5_U
#define PWM_4_OUT_IO_NUM 5
#define PWM_4_OUT_IO_FUNC FUNC_GPIO5
#define PWM_CHANNEL 5
uint32 duty[] = {0, 0, 0};
uint32 freq = 1000;
static uint8 donepwm = 0;
uint32 io_info[][3] = {
{PWM_1_OUT_IO_MUX, PWM_1_OUT_IO_FUNC, PWM_1_OUT_IO_NUM},
{PWM_3_OUT_IO_MUX, PWM_3_OUT_IO_FUNC, PWM_3_OUT_IO_NUM},
{PWM_4_OUT_IO_MUX, PWM_4_OUT_IO_FUNC, PWM_4_OUT_IO_NUM}
};
and when I start the PWM (long after power up) - I use this... once only...
pwm_init(freq, duty, 3, io_info);
Within seconds of using this I get a watchdog timer timeout and the processor reboots...
This used to work.
So am I right in saying that even the latest manual is WRONG (because the PWM routines later on have 32 bits for duty - so 8 bits cannot be right in init, surely??) and assuming it IS 32 bits - why would running this crash the processor. It didn't used to.Statistics: Posted by scargill — Sat Apr 23, 2016 12:40 am
]]>