Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Nano PD3 PWM returns wrong frequency

2 posters

Go down  Message [Page 1 of 1]

1Nano PD3 PWM returns wrong frequency Empty Nano PD3 PWM returns wrong frequency Fri Nov 20, 2020 2:43 pm

kagamma



Hi, I am playing around with the app and notice Arduino Nano's PD3, which is controlled by Timer2 (base clock ~31Khz) returns wrong frequency.

According to documentation, TCCR2B = 110 should set the divisor to 256, thus PD3 should have a frequency of 122.55Hz, but the simulator shows 244.14 Hz.

Images:
Spoiler:

Source code (Pascal, but should be easy to translate to C)
Code:
begin
  // Configure PD3 as output
  DDRD := DDRD or %1000;
  // Configure PD3 in PWM mode
  TCCR2A := (%10 shl COM2B) or (%1 shl WGM0);
  // Enable timer 2, clock speed / 256
  TCCR2B := %110;
  // Duty cycle = 50%
  OCR2B := 128;

  repeat until False;
end.

2Nano PD3 PWM returns wrong frequency Empty Re: Nano PD3 PWM returns wrong frequency Fri Nov 20, 2020 5:46 pm

arcachofo

arcachofo

Hi. Thanks for reporting.

I think that issue is already solved in development version.

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum