-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAX32660 Examples TMR #1122
Comments
4 tasks
Thanks @tk2themax, I think the issue was just that the Can you try the fix below and confirm? #include "led.h"
/***** Definitions *****/
-#define MAX_TICKS pow(2, 32)
+#define MAX_TICKS 4294967296
+// 2^32
// Parameters for PWM output
#define FREQ 1000 // (Hz)
@@ -77,7 +78,7 @@ void PWMTimer(void)
// Declare variables
mxc_tmr_cfg_t tmr; // to configure timer
unsigned int periodTicks = MXC_TMR_GetPeriod(PWM_TIMER, 1, FREQ);
- unsigned int dutyTicks = periodTicks / 100 * 50;
+ unsigned int dutyTicks = periodTicks * (DUTY_CYCLE / 100.0f);
//Configure PWM GPIO Pin
mxc_gpio_cfg_t pwmOut; |
Oh my - I missed that ! But at least there was a problem - even if my diag was off ! Thanks - all good now with this fixes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On build for MAX32660, TMR example project warns "function call is not allowed in a constant expression" on line 72(Main)
Guidance suggests that The error "function call is not allowed in a constant expression" typically occurs when you try to use a function call in a context where a compile-time constant is expected
Although this does not stop the build/compile, there is a possible linked manifestation of this in that when the DUTY_CYCLE, as DEFINED in Main(line46), value is changed in the source and recompiled and flashed, the physical PWM duty cycle on TMR GPIO 3.7 PIN does not actually change from the 50% originally set. However, when FREQ is changed (line 45), and recompiled, flashed, the frequency does change as expected.
This suggests that there is a value being set for DUTY_CYCLE which, once set is not cleared and reassigned any given new value on recompile.
CLEAN_PERIPH on build/flash did not alleviate.
The text was updated successfully, but these errors were encountered: