17 votes
Accepted

_delay_ms() is much slower than expected (by a factor of 6) on TinyAVR 0/1 (ATTiny1604)

Your toolchain is not broken. In the ATTiny804/1604 datasheet, page 77, it shows the CPU clock is divided from the 20/16 MHz oscillator by a prescaler (the ATTiny1614 datasheet shows the same clock ...
比尔盖子's user avatar
14 votes
Accepted

Does the Arduino Uno have two crystals?

The ceramic resonator in yellow is connected to the main MCU, and the crystal in red is connected to the other MCU. USB requires tighter tolerances than is available from a resonator therefore a ...
Ignacio Vazquez-Abrams's user avatar
13 votes
Accepted

Why is there a clock in my arduino?

Why is there a clock in my arduino? Because that is how computers and microcontrollers, etc, work. With a 16mhz clock, each line of my program will take 1/16000000 second, right? No. even a ...
Majenko's user avatar
  • 105k
10 votes

Why is there a clock in my arduino?

Not answered in @Majenko's post: Yes, with a 8MHz clock, each line will take the double of the time. Unless the line waits for something that is not clock driven - e.g. external input. In addition to ...
AMADANON Inc.'s user avatar
9 votes
Accepted

Arduino 16 MHz with only 3.3V?

Officially, no. Practically, often but not always. If I follow the datasheet to the the letter, this configuration should not work. BUT... After some test, it did work. The data sheet does not ...
Chris Stratton's user avatar
5 votes
Accepted

How can you reduce the clock frequency of an Arduino Mega?

You can set the clock prescaler for that: void setup() { noInterrupts(); CLKPR = _BV(CLKPCE); // enable change of the clock prescaler CLKPR = _BV(CLKPS0); // divide frequency by 2 ...
Edgar Bonet's user avatar
  • 43.1k
5 votes

Arduino 16 MHz with only 3.3V?

According to the datasheet you need 3.78V to run at 16 MHz, and 3.3V isn't that far off. I would be surprised, for example, if it stopped working at 3.77V, because that would mean that the operating ...
Nick Gammon's user avatar
  • 38.2k
5 votes

Programming standalone Atmega328p-PU with NE555N timer IC

No, you won't be able to build a 16 MHz clock signal using a 555 timer. That's far beyond the 555 capabilities (see N.B.). If you could squeeze out of the 555 a mere 1 MHz (which I seriously doubt), ...
Enric Blanco's user avatar
  • 2,114
4 votes

Arduino at 20 MHz?

You can, and I do. It's not technically an Arduino anymore, I guess. I made my own board, replacing a resonator on a board will require some fine soldering, but it is definitely possible. There are ...
AMADANON Inc.'s user avatar
4 votes

Confusion with ATmega328P and 3.3V/8MHz

If you are using an LED to indicate that your sketch is running, then that may be the problem. For example, if you have a fairly average red LED, it might have a forward voltage of 2.0v @ 20ma (...
AMADANON Inc.'s user avatar
4 votes
Accepted

Confusion with ATmega328P and 3.3V/8MHz

It was a brownout fuse problem. Changing boards.txt from: atmega328bb.bootloader.extended_fuses=0x05 to atmega328bb.bootloader.extended_fuses=0x02 solved it for me (*). The chip and red LED now ...
Paul Grime's user avatar
4 votes

Arduino 16 MHz with only 3.3V?

A little test, not very scientific, but shows it runs fine on 3.3V - https://www.youtube.com/watch?v=If0eOa0Uj5I. Again, if you would like to stay withing the specification just use a "clock divider/...
Talk2's user avatar
  • 579
4 votes

Programming standalone Atmega328p-PU with NE555N timer IC

Yes, you could use a 555. You can also go even simpler and use an RC network. Even simpler still is to use the 1MHz RC network built in​ to the chip. The main drawback of these methods, and the 555 ...
Majenko's user avatar
  • 105k
4 votes

Programming standalone Atmega328p-PU with NE555N timer IC

The default configuration of these chips, as they come from the factory, is to use their internal 8 MHz RC oscillator downscaled at 1 MHz. So you do not need any extra oscillator to program them. ...
Edgar Bonet's user avatar
  • 43.1k
4 votes
Accepted

Which of the clock sources are actually internal to the ATmega328P?

If it requires a crystal, as the ones in question clearly state, then obviously you need to connect a crystal (and load capacitors). Or use a ceramic resonator. Only those labelled as internal are ...
Majenko's user avatar
  • 105k
4 votes

How to divide high input frequency by 1.25 like old-school TTL logic by Arduino?

Your question is a perfect example of an XY problem: you are asking something that has little to do with your actual problem, but is rather about your misguided idea of a solution. Counting Mars ...
Edgar Bonet's user avatar
  • 43.1k
3 votes
Accepted

Atmega328P 8MHz External Clock

If you reduce the main clock speed by 50% then everything else is reduced by 50% as well. The whole chip runs at half the speed. That includes things like the UART. For example, the bootloader is ...
Majenko's user avatar
  • 105k
3 votes

Atmega328P 8MHz External Clock

The easiest way is to use the settings: Tools > Board > Arduino Pro or Pro Mini Tools > Processor > ATmega328 (3.3V, 8MHz) The problem with that is the Pro Mini bootloader is 2kB and has a bug that ...
per1234's user avatar
  • 4,098
3 votes
Accepted

Change Digispark clock speed, run at low voltage?

You can set the clock prescaler at run time. For example: #include <avr/power.h> void setup() { clock_prescale_set(clock_div_8); // etc... } More details in the documentation from avr-...
Edgar Bonet's user avatar
  • 43.1k
3 votes

Arduino 16 MHz with only 3.3V?

I've built a few 3.3v home-brew-duinos with 16Mhz crystals (because I have a bag of 50 xtals!) - they run fine in the conditions I've put them in so far (on my desk). Some of them may be closer to ...
JRobert's user avatar
  • 15.3k
3 votes
Accepted

Syncing/taking external clock for SPI on Arduino Due

For your external source to be an SPI bus master, it has to be the only one generating the clock signal. Yet, calling SPI.transfer() also generates a clock signal from the Arduino; both devices are ...
SoreDakeNoKoto's user avatar
3 votes

Programming standalone Atmega328p-PU with NE555N timer IC

It depends on how you're programming it. If you're using a bootloader to accept programming commands via a serial connection then you will need to use the clock method specified by the fuses ...
Ignacio Vazquez-Abrams's user avatar
3 votes

Does delay() pause the counting of millis()?

Delay uses millis. It just waits examining millis until a certain time has passed. Millis is driven by an interrupt. The only thing that stops it working is another interrupt (you can only have one ...
Majenko's user avatar
  • 105k
3 votes

Can the IDE handle a 32khz main clock?

Yes, things will break. The main culpret is this: #define clockCyclesPerMicrosecond() ( F_CPU / 1000000L ) With any value below 1000000 the result of that calculation will be 0. That means code ...
Majenko's user avatar
  • 105k
3 votes
Accepted

Why ESP8266 slower than Arduino nano?

However, despite ESP8266 running at 160MHz, 10 times faster than nano, it's taking 3.5 ms to complete the loop, compare to 2.5 ms than that of nano. There's a number of reasons for that. Chiefly: ...
Majenko's user avatar
  • 105k
3 votes

The analog read is not giving the correct waveform as that of an oscilloscope

Your sampling rate is far too low for the signals you are looking at; you're not getting enough data points for drawing something that looks like the original signal. The Arduino library's analogRead()...
ocrdu's user avatar
  • 1,775
3 votes
Accepted

Is there a way to get about a 10ns Timer resolution from an AVR CPU?

There is nothing you can do on the AVR processors that I know of, which can run on from a quite slow clock, and I think up to 24 MHz. Since your Uno / Leonardo / Micro run at 16 MHz that would be only ...
Nick Gammon's user avatar
  • 38.2k
3 votes

Is there a way to get about a 10ns Timer resolution from an AVR CPU?

1 ns is a billionth of a second. A 1 gHz clock has a cycle time of 1 ns. If you have a timer that's able to count single clock pulses you'd need a 1 gHz clock to get to 1 ns resolution. for 10 ns, you'...
Duncan C's user avatar
  • 5,682
3 votes
Accepted

Achieving nanosecond accuracy with MKR Vidor 4000

No. You can't. To achieve 1ns precision you need a 1GHz clock. That can't happen. The MKR Vidor 4000 uses an FPGA with an "A7" speed grade. That means that (according to Table 20 here) you ...
Majenko's user avatar
  • 105k
3 votes
Accepted

slower clock frequency than expected on attiny202

Just as a complement to chrisl's answer, if you disassemble the compiled program, you should see that your infinite loop looks like this: 1: sts 0x0407, r24 ; write to PORTA_OUTTGL rjmp 1b ...
Edgar Bonet's user avatar
  • 43.1k

Only top scored, non community-wiki answers of a minimum length are eligible