3.a.11. Command 210: Set Motor PWM Frequencies

Effect: Sets the resolutions and clock prescalers of the two motor PWMs, which in turn allows customization of the PWM frequencies. The PWMs can have either seven- or eight-bit resolution, and the allowed clock prescalers are 8, 64, 256, and 1024. This means the eight possible PWM frequencies are 19.5 kHz, 9.77 kHz, 2.44 kHz, 1.22 kHz, 610 Hz, 305 Hz, 153 Hz, and 76.3 Hz. A seven-bit resolution coupled with a prescaler of 8 will result in the only frequency in this group that generally exceeds what can be detected by the human ear ( 19.5 kHz); the daughter motor-driver boards with VNH2SP30s will function at this frequency, but those with VNH3SP30s will not. Because of this, the default frequency is 9.77kHz. Lower frequencies can be used to decrease switching losses, however the motor 1 PWM frequency is used for acceleration timing, so decreasing it below 1 kHz can slightly reduce the frequency at which acceleration updates are performed (at the lowest frequency, acceleration updates will occur every 13 ms instead of every 10 ms).The frequencies can be different for each motor so long as the X2 isn’t being run in joint motor mode. In joint motor mode, both PWMs are set to based on the motor 1 PWM frequency settings.

This command does not save this setting to EEPROM, however it can be saved by issuing separate EEPROM-write commands (240—Section 3.d.02) that store the values at the appropriate addresses (1 for motor 1, 2 for motor 2). The EEPROM byte saved for a given motor should be set as follows: bit 2 high = 8-bit pwm resolution, bit 2 low = 7-bit pwm resolution; bits 0 & 1 represent the PWM’s clock prescaler setting as detailed below.