2

I am building a boost converter using a mosfet. The mosfet is driven by PWM generated by an Arduino Uno through Matlab Simulink. In Simulink I am giving 10 KHz pulse width 50%. Practically 10 KHz available at pins 5 and 6. Up to how much frequency can pins 5 and 6 handle?

12
  • 1
    I think the maximum frequency is 4MHz. I wouldn't use pins 5 and 6, as those use timer0, which is already used by millis and delay. You'd better of using pins 9 and 10 which use timer1. Commented Jun 21, 2016 at 15:10
  • arduino.cc/en/Reference/AnalogWrite Commented Jun 21, 2016 at 15:52
  • 1
    Yes. Though you'd have to tweak some of the registers to get this exact frequency. If the frequency doesn't need to be exact you could just change the default /64 prescaler to e.g /1 to get around 30kHz. Commented Jun 21, 2016 at 16:06
  • 1
    PS the maximum PWM frequency is actually 8MHz. Commented Jun 21, 2016 at 16:07
  • 1
    Still 8MHz..... Commented Jun 21, 2016 at 17:14

2 Answers 2

1

See my page about timers. The maximum frequency the hardware can output is 8 MHz if you are running a 16 MHz clock.

10 kHz should be easily achievable if you tweak the hardware registers, as Gerben said.

0

Up to how much frequency can pins 5 and 6 handle?

here is a way for you to find out:

1) pin 5/6 are OC0A and OC0B -> two output compare pins tied to timer0

2) go to the datasheet and timer0 is a 8-bit timer, with a few pwm modes who top out at 0xff or OCR0A -> useless for your application.

So the theoretical but useless answer is 16Mhz/2, at 1:1 prescaler.

the more practical answer is 16Mhz / 256, at 1:1 prescaler.

with that said, some AVRs (ATtiny25/45/85 for example) can run in asynchronous modes generating incredibly high PWM with very little outside help.

if generating high speed pwm is your thing, check them out instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.