Problem!! PWM frequency UNO vs MINI


hi

i'm having trouble pwm frequency on mini.
we going use make 0-5v signal ni-daq logging unit. (rc-filter)

i'm transfering code below uno(smd) , frequency around 15khz...
the same code transfered mini , frequency around 15hz???  :o
it's the same smd chip, atmega328p, on both boards...

what difference between 2 boards?
the scope measuring 16mhz on crystal on both...
is there difference in fuse bits?

sorry, in advance if writing not 100%
best regards norway

code: [select]

#include <avr/io.h>
#include <avr/interrupt.h>

volatile unsigned long tottime;
volatile unsigned int starttime, endtime;
volatile unsigned int teller=0;
volatile unsigned int overflow,  nyflow, lastcount;

volatile boolean startend = false;



int main(void)
{
 
  serial.begin(115200);
  cli();
 
  ddrb |= (1 << pb1); //set pin9/13/pb1/icp1 output pwm
  ddrb &= ~(1 << pb0); //set pin8/12/pb0/oc1a input timestamp frequency

  pcicr |= (1<<pcie1); //pin change interrupt pcint[14:8]
 
  tccr1a |= (1 << com1a1) | (1 << wgm11) | (1 << wgm10);                //com1xn set how waveform on output pin.
                                                                        //wgm1n in tccr1a , tccr1b chose waveform generation mode choose. here it's set mode 14: fast pwm, icr1 top value.
  tccr1b |= (1 << ices1) | (1 << cs10) | (1 << wgm12);                  //ices1 witch edge icp1 used trigger capture event. if set 1, capture happens on positive edge.
                                                                        //
  timsk1 |= (1 << icie1) | (1 << ocie1a) | (1 << toie1);                //icie1 enables input capture interrupt. ocie1a enables output compare match interrupt. toie1 enables timer1 overflow interrupt.
 
 
  sei();
  ocr1a = 512;

  while (1==1)
  {
  }
}

i'm curious comment on line:
code: [select]
ddrb |= (1 << pb1); //set pin9/13/pb1/icp1 output pwm
which pin on board measuring?

is there difference in fuse bits?
the difference related different bootloader sizes:
https://github.com/arduino/arduinocore-avr/blob/58006613a7c858417881744419c5da54cc21a401/boards.txt#l67-l69
code: [select]
uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0xfd

vs
https://github.com/arduino/arduinocore-avr/blob/58006613a7c858417881744419c5da54cc21a401/boards.txt#l444-l462
code: [select]
mini.bootloader.low_fuses=0xff
...
mini.menu.cpu.atmega328.bootloader.high_fuses=0xd8
mini.menu.cpu.atmega328.bootloader.extended_fuses=0xfd

of course assumes fuses on both boards set arduino defaults.


Arduino Forum > Topics > Science and Measurement > Problem!! PWM frequency UNO vs MINI


arduino

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???