Questions tagged [atmega328]
The ATMega328 is the chip that is the heart of the Arduino Uno. It is popular also as a chip to use to create your own board. Since it is available in the through hole version, it can be placed on a breadboard easily for circuits.
509 questions
0
votes
1
answer
49
views
Send uint32_t over i2c from attiny85 slave to atmega328p master
I run into an issue with querying a uint32_t with an atmega328p master from an attiny85 master.
I have put both codes below.
I did run the equivalent code for just sending a uint8_t and all works ...
1
vote
1
answer
83
views
Generate all frequencies between 5 and 8 kHz in steps of 1Hz
Is it possible generate all frequencies between 5000 and 8000Hz, 1Hz in between with an ATmega328?
When I create a c-program outside the Arduino IDE to calculate the frequencies with the formula ...
1
vote
2
answers
97
views
Unwanted toggle on OC1A
The code below for the ATmega328P (Arduino Pro Mini 5V @ 16 MHz) produces a periodic sequence on timer1 pins OC1A and OC1B:
#include "Arduino.h"
// For Arduino Pro Mini 5V @ 16 MHz
// ...
1
vote
2
answers
100
views
Translating PIC PWM settings to ATMega328P
I'm trying to get some C code that runs on a PIC18F, working on an Arduino '328P. It uses an 8-bit timer, PWM, and a LUT to generate sine waves. I hope to get it going using Timer2 on a Nano.
The PIC ...
7
votes
2
answers
3k
views
Finite loop runs infinitely
To gain better understanding of both Rust and Arduino (Uno), I'm trying to write direct hardware code for Arduino in Rust. Here's a very simple LED blink example, that I've tried to write.
I've made ...
2
votes
1
answer
290
views
Hardware serial baudrate inconsistent between Arduino nano and standalone 328P
I have a 328P (328P-AUR to be specific, [link]), and in the schematic below is how I've implemented it to a PCB:
Uploading a program works fine, but I hink there is an issue with the clock source, ...
2
votes
1
answer
744
views
Emulating Arduino Uno with QEMU: interrupts do not work
So I wrote this code for Arduino Uno:
// file qemu.ino
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println(millis());
}
And then compiled and uploaded it to the real ...
-2
votes
2
answers
88
views
Physically passing through a pin to access another [closed]
I would like to know about physically passing through a pin in order to get to another. For instance, if I have a sensor on one side of an ATMEGA328P or ESP8266 (Wemos D1 Mini) yet need to connect to ...
0
votes
1
answer
281
views
ATmega328 drop-in replacement with more flash memory
Is there a ATmega328 drop-in replacement with more flash memory?
Needs to be 28 pin DIL to fit the socket.
Alternatively, is there a board that has the exact dimensions and pins as an Arduino UNO, but ...
4
votes
1
answer
363
views
Connecting nRF24L01 to ATmega328PU with external 8 MHz crystal problem
I am trying to fix the problem of communicating between two nRF24L01+ together, one connected to an Arduino Uno and another connected to an ATmega328PU with an 8 MHz external crystal.
The bootloader ...
1
vote
0
answers
42
views
Mirroring PWM input on a pin + Motor Encoder
I am interested in hooking up a nano to an RC receiver. I want the nano to mirror the PWM input and output on another pin when a specific command is given via serial. I also want to send the received ...
-1
votes
2
answers
148
views
Atmega 328pu on breadboard. What to choose in order to upload code with ftdi converter
When I program atmega328 PU on breadboard,vwhat programmer do I have to use and what arduino board type I have to choose? I am trying this with ftdi converter I have already done the connections and ...
0
votes
1
answer
770
views
IDE will not upload to ATTiny88
I was successfully compiling sketches and uploading to various MCUs, including the ATTiny88. Suddenly the IDE quit compiling and complained of various missing compilers. I found and corrected an ...
1
vote
0
answers
61
views
Atmega328P constantly restarting when defining a function
I wanted to make a simple led on/off program using USART interface. When the code doesn't have any functions other than main it runs fine, however Arduino keeps resetting when one is included. At this ...
1
vote
2
answers
627
views
Timer 1 "Set on Compare Match" in Normal Mode - Not working
I'm using the hardware timers on the 328 for phase angle control of a triac with zero-crossing detection. I am encountering some strange behavior with the "Set on Compare Match" feature not ...
0
votes
2
answers
1k
views
SoftwareSerial will not read all of the printed string when calling readString()
I have an Arduino UNO and an ESP32 that need to communicate to each other using SoftwareSerial. The problem I am coming across is that when I call readString and print it out using Serial, it will not ...
2
votes
1
answer
192
views
Curious Collision between OneWire and RadioHead
The code below runs on an Arduino Pro Mini (8MHz 328p) sending temperature readings using an inexpensive ASK transmitter. I use OneWire to read the DS18B20s, and RadioHead to manage the radio.
The ...
0
votes
0
answers
58
views
Writing to ADMUX on 3.7V from battery restarting chip
Given: arduino nano (atmega328P) with nrf24l01.
What am I trying to do: Measure battery drain.
What am I doing for that.
So I made a small research of how could I measure the battery voltage without ...
1
vote
2
answers
2k
views
Call functions of one class from another class - Callback
I am new to C++ & I need to call functions of one class from another class. And so that the classes do not know anything about each other. How to do it in Arduino environment?
class Encoder {
...
0
votes
0
answers
60
views
How does C2 work on the ATMega328P?
What is the purpose of C2 on this schematic below?
How does it work when the microcontroller is being programmed?
0
votes
2
answers
2k
views
Standalone ATMega328 - do I need to burn the bootloader?
I want to get an ATMega328 off of the Digi-Key, and use it like an Arduino (without requiring the whole Arduino board).
When it comes to programming, do I need to do anything special like burn the ...
3
votes
1
answer
206
views
Why am I reading only zeroes from PORTB?
I am using a custom Arduino Nano compatible board with an Atmel 328P. I am externally changing the values applied to several pins on PORTB. I expect to be able to read the values of these pins (low ...
1
vote
2
answers
113
views
Can we use more than one timer when programming an Atmega32/16?
I tried to do a simple program using the ATmega16 microcontroller, the program is to toggle two LEDs the first one by using timer0 interrupt and the other using timer2 interrupt.
1
vote
1
answer
256
views
Help with Arduino sleep and watchdog timer interrupt
I want to use Arduino's sleep and wakeup functionality but have hit a roadblock and can't seem to get past it. As I am just prototyping for a final system, I cannot use the LowPower library to ...
2
votes
1
answer
644
views
Arduino Nano Atmega328P not sleeping with either <LowPower> or <avt/sleep.h>
I'm working on a battery powered Arduino Nano project. I really need it to save power for hours on end, so I turned to Arduino LowPower Library and avr/sleep.h to do the job.
However, whatever I do, ...