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

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
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.9k
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.5k
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

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.9k
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
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.9k
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,238
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
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.9k
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

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

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,795
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.5k
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,702
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.9k
3 votes
Accepted

Programmer vs target clock frequency

There are multiple ways of programming a 1284P board, such as: Using the bootloader, via serial input Using ICSP (via the SPI pins) High-voltage programming The bootloader is via a specific baud ...
Nick Gammon's user avatar
  • 38.5k
2 votes
Accepted

Change from using the external crystal to the internal oscillator

What do I need to change to use the internal oscillator? You'll need to change the fuses on the chip, and you probably want a new 8MHz entry in boards.txt so that timing functions still work as ...
Ignacio Vazquez-Abrams's user avatar
2 votes

Change Digispark clock speed, run at low voltage?

The digispark uses the micronucleus bootloader. You can flash that directly onto an Tiny85 without needing the digispark module. So your existing Tiny85 solution could acquire the USB bootloader if ...
jose can u c's user avatar
  • 6,974
2 votes

Does the Arduino Uno have two crystals?

There are 2 that you can see, but there are internal resonators in both chips. You can use the ATMega328's one if it's on a breadboard (it's half the frequency tho), and much more temperature-...
DaniFoldi's user avatar
  • 131
2 votes

Atmega328P 8MHz External Clock

Firstly, you can buy 8MHz Atmega328P Pro-Minis from China. They are cheap and run at 3.3V. Look at eBay. If you want to reduce the power consumption of Arduino boards, you have three primary attack ...
zx485's user avatar
  • 256
2 votes

Running quartz clock off an arduino

As I said in my comment, the idea of using the Arduino's own PWM as a clock source is completely misguided. It will be no more accurate than using millis() or micros(): both these functions and the ...
Edgar Bonet's user avatar
  • 43.9k

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