Other Parts Discussed in Thread: TM4C123GH6PM
Tool/software:
I initialize a PWM with a pulse width of 0; everything runs fine. Some time later I change the pulse width, the system continues for a while, then issues a hard fault; at this point the CFSR is 0x00020000 which is "Instruction makes illegal use of EPSR. The HFAULT register is 0x40000000 which is "Forced Fault, see other registers to determine the source", but as can be seen in the CFSR the BFSR and MMFSR are both 0. Code as follows:
SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_XTAL_20MHZ | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN); // 80MHz
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM1);
(delay a little bit here)
GPIOPinTypePWM( GPIO_PORTE_BASE, PD_Pwm1_2_BIT );
GPIOPinConfigure(GPIO_PE4_M1PWM2);
SysCtlPWMClockSet(SYSCTL_PWMDIV_64); // 1250 KHz PWM Clock.
PWMGenConfigure(PWM1_BASE, PWM_GEN_2, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC );
PWMDeadBandDisable(PWM1_BASE, PWM_GEN_2);
PWMGenPeriodSet(PWM1_BASE, PWM_GEN_2, 6250); // 200Hz
PWMPulseWidthSet(PWM1_BASE, PWM_GEN_2, 0); // 0% duty cycle
PWMOutputUpdateMode(PWM1_BASE, PWM_OUT_4_BIT | PWM_OUTPUT_MODE_NO_SYNC);
PWMGenEnable(PWM1_BASE, PWM_GEN_2);
some time later I issue:
PWMPulseWidthSet(PWM1_BASE, PWM_GEN_2, 69); // ~10%
some significant time later the hard fault occurres.
Thanks, Doug