My project on XIAO MG24 sense includes steering Motors via PWM, coding in the arduino IDE.
The PWM-frequency effects the loudness and torque of the motors, but I can not find out, what settings are used on the MG24 and how I could change them.
There seems to be a difference compared to the ESP32-C3, motors have less torque.
Silicon Labs provides an SDK with direct timer and PWM configuration APIs. If you switch your development from Arduino to using the EMLIB/SILABS SDK (or Zephyr), you can:
CMU_ClockEnable(cmuClock_TIMER0, true);
TIMER_TopSet(TIMER0, topValue); // set PWM frequency
TIMER_CompareSet(TIMER0, chan, duty); // set duty cycle
...
This same approach applies to EFR32MG24 timers. But from Arduino you’d have to drop to register level or include parts of the SDK. Sun May Sky: How to generate PWM on EFR32
Thank you, for the good hint on how to change settings.
I want to use the arduino IDE, to keep it simple for me, and firstly find out, what setting for PWM frequency is used in “default”, then how to change it (using register level).
How could I find out?
As far as I understand, the MG24 Board is installed in the Arduino IDE and therefor the PWM Information should be there. I don’t know where to look. How do I find the file with the code that defines the default setting for PWM in the Arduino IDE?