Skip to content
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

Changing PWM Frequency does not seem to work #302

Closed
LordSyd opened this issue Apr 5, 2022 · 2 comments
Closed

Changing PWM Frequency does not seem to work #302

LordSyd opened this issue Apr 5, 2022 · 2 comments

Comments

@LordSyd
Copy link

LordSyd commented Apr 5, 2022

Hi,

I need to change the PWM frequency the board provides to 5000 Hz for my project. I tried using the code sample provided here:
#57
This snippet to be precise:
`#define PWM_PIN_MAX 6
int pwm_pins[PWM_PIN_MAX] = { 3, 5, 6, 9, 10, 11 };
byte i;

void setup() {
for(i = 0; i < PWM_PIN_MAX; i++)
{
drv_pwm_set_freq(pwm_pins[i], 1000000); // It is constrained to frequencies from 1Hz to 1MHz.
drv_pwm_setup(pwm_pins[i]);
}
}

void loop() {
for(i = 0; i < PWM_PIN_MAX; i++)
{
drv_pwm_set_duty(pwm_pins[i], 8, 255); //100% duty cycle
}
delay(100);
}`

But this did not work as expected. I measured the voltage using a multimeter and got around 3,3v, which seems odd. I was hoping, as these are Arduino pins, for the upper bound to be 5v, or am I mistaken?

Regards, Daniel

@LordSyd
Copy link
Author

LordSyd commented Apr 5, 2022

Ok, it seems I was mistaken. Sorry about that. After measuring the signal with an oscilloscope, I confirmed the frequency was as intended, but the output voltage at max was only 3.3v, which confused me before.

@LordSyd LordSyd closed this as completed Apr 5, 2022
@ROBOTIS-Will
Copy link
Contributor

Hi @LordSyd

I'm sorry about the delayed response on this issue.
The OpenCR is running on ST MCU which runs with 3.3V.
Some pins are 5V tolerant, but not able to output a 5V level signal.
Hope this information helps.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants