Questions tagged [avr]

AVR is the family of microcontrollers used in Arduino boards.

Filter by
Sorted by
Tagged with
9
votes
4answers
54k views

Arduino compatible's serial port not showing Mac OSX

I bought an Arduino-compatible Freaduino board atmega8 (I selected the board type as Arduino ng or older atmega8). I installed the Arduino IDE on Mac OS X and the FTDI drivers. But my serial port ...
8
votes
2answers
9k views

Basic makefile for avr-gcc

I would like to make a makefile for compiling c programs for the arduino. I am somewhat familiar with make but have never used it with avr-gcc. What is the simplest way I could put the commands below ...
7
votes
3answers
27k views

I2C 2 way communication between Arduino Uno and Arduino Mega

If I remove the transmission code from slave this works properly but I need to transmit from slave. Here is my master code #include <Wire.h> void setup() { Wire.begin(3); Wire.onReceive(...
7
votes
5answers
7k views

What's the difference/relationship between Arduino and AVR?

I'd always thought Arduino was a microcontroller platform but the actual microcontroller is an AVR chip made by Atmel, or something like that made by someone else, based on a RISC ISA, and Arduino is ...
7
votes
2answers
418 views

Is there a way to make wiring a bare microprocessor to a shield easier?

I currently do most of my AVR work on breadboards, but the large variety of Arduino shields and code out there makes me wonder if I'm not beating my head against the wall sometimes, and looking up ...
6
votes
1answer
8k views

Change Options for the AVR Programmer via Arduino IDE

I want to program an ATtiny through the Arduino IDE. I have a somehow strange programmer. But I can upload via avrdude by avrdude -p attiny13 -P /dev/cu.usbmodemfa131 -c stk500v2 -F -B20 -U ...
5
votes
2answers
337 views

How are errors (not related to syntax) managed in arduino and in the AVR architecture in general?

I was just curious about how the AVR architecture manages errors that would cause a regular desktop program to crash. I'm talking about logical errors for example math problems that are undefined. ...
5
votes
1answer
115 views

Can I program a factory fresh Atmega328P through UART pins without burning a bootloader?

Can I program a factory fresh ATMega328P using the UART pins without burning a bootloader? These pins are TX, RX, VCC, GND, and DTR pins in the schematic below. They are not the ISP/SPI pins 10-13. ...
5
votes
1answer
381 views

Why are Arduino timer registers not 0?

I'm trying to use the timer registers to do some timing on my Arduino Mega 2560. The output of the following code confuses me: void setup () { // Set up serial connection Serial.begin(9600); ...
5
votes
3answers
9k views

I bought USB > FT232RL, can I use it to program a bootloader onto an Arduino?

I bought this thing off of eBay: eBay Link Will it allow me to program an ATmega[xxx] (Arduino clone) with a bootloader? --> If so, how would I go about it? What should I do, and what should I ...
5
votes
1answer
792 views

Cannot compile C++11 code via Makefile

I am building my Arduino project with a makefile: BOARD_TAG = uno ARDUINO_PORT = /dev/ttyACM0 USER_LIB_PATH = /home/prakhar/dev/alfred/arduino/libraries CPPFLAGS=-x c++ -std=c++11 -Wall -...
5
votes
1answer
8k views

Is it possible to program an Attiny85 with a USB-to-TTL converter?

I currently use my Arduino to program Attiny85. As I have one of these USB-to-TTL adapters I am wondering if it is possible to program Attiny85 with it, to free up my Arduino. I know it is possible to ...
5
votes
1answer
766 views

Remove Bootloader on Arduinos

I am trying to move from arduinos to AVR C. Would somebody know how to remove the arduino bootloader from the microcontroller? Is there a different process for the different atmega microcontrollers ...
5
votes
1answer
139 views

Does porting code to different MCU clock frequency affect serial baud rate?

Tried to upload my Arduino Uno sketch that writes to serial UART at 9600 baud rate onto my ATtiny2313 running at 1MHz. Not getting the signal on the ATtiny, does this have to do with my clock ...
4
votes
1answer
66 views

How does the microcontroller know which clock to use?

I had seen some tutorials on how to assemble an Arduino on a breadboard. They all just place the external crystal oscillator according to the circuit and then, just burn the bootloader and it starts ...
4
votes
1answer
259 views

How can I indicate that I am using ATmega2560 so that Arduino libraries understand it?

I am developing AVR microcontollers in Atmle Studio and sometimes I am using Arduino libraries(such as LiquidCrystal). When I initialize LiquidCrystal lcd(12, 11, 5, 4, 3, 2); I don't think Arduino ...
3
votes
1answer
660 views

How can I make pinMode calls faster?

I'm trying to use 3 pins as capacitive pins along side the Mozzi. I had several attempts and so far the closest I had was using code from the ADCTouch library straight into the main code, but with ...
3
votes
2answers
156 views

What does an arduino sketch translate to before compilation?

I've been experimenting with Arduino on both esp8266 and AVR chips. The structure of the .ino file usually looks like this: #include "Arduino.h" #include "ESP8266WiFi.h" ##Some includes void setup() ...
3
votes
1answer
878 views

How to use printf with Arduino's serial ports without an intermediary buffer?

How to use printf with Arduino's streams without an intermediary buffer? The following seems unnecessary: char buf[256]; sprintf(buf, ...); Serial.print(buf); Is there a way to connect ...
3
votes
2answers
2k views

AVR - How to know that there is collision between stack and heap or the memory has filled?

I am using the dynamic memory in AVR microcontroller, so How to know that there is collision between stack and heap or if the memory has been filled?
3
votes
2answers
6k views

How to program AVR in Mac OS X?

In our college we are using a module developed by IIT Bombay (called FIREBIRD V[ver 5]). It has ATmega2560 and ATmega8 microcontrollers (master and slave) with bootloader. The staff uses AVR Studio ...
3
votes
2answers
1k views

Can I program AVR Microcontrollers using Arduino Development board with AVR Studio?

I know and I can program any AVR microcontroller with Arduino IDE and Arduino Uno board. Can I use Arduino board with AVR Studio? Or I have to buy an AVR Development board?
3
votes
3answers
3k views

Using ArduinoISP on an Arduino Uno to program an ATmega328

I have an Arduino Uno R3 and would like to use it to program a blank ATmega328 on a breadboard. I've followed the instructions for the 8 MHz version on http://arduino.cc/en/Tutorial/...
3
votes
1answer
3k views

Storing in a global variable using inline assembly

What I'm trying to do is pretty basic: I have a global variable and I'm trying to store some value in it (specifically, the SP_H and SP_L values). The variable is an array of structs and I'm trying ...
3
votes
3answers
1k views

Can I compile a sketch for my attiny85 without an arduino board?

I have a lot of Raspberry Pi's laying around, so I want to use those to program my attiny85 chips. The problem is that most of the code examples, libraries, and documentation out there assume you're ...
2
votes
2answers
1k views

Is Arduino IDE enough to program with C or C++?

I am using Arduino IDE to program my ATmegas with bootloaders. I can directly manipulate ports, use timers, interrupts, PWM pins and timers, etc. Everything is working. But this question arises: Does ...
2
votes
4answers
15k views

New to Arduino: Should I learn C, C++ or both (C & C++)?

From what i've researched here is my thoughts on both C++ I heard that you can create libraries using C++ in arduino. And you can use the Arduino IDE to do that stuff. Here is the proof http://...
2
votes
4answers
430 views

How are Arduino's OSH if Atmel AVR is proprietary?

I keep reading how Arduinos are "open source", but my understanding of OSH is that all its components must be open source. Arduino uses an Atmel AVR CPU - but Googling this shows the Atmel is ...
2
votes
5answers
1k views

Good book/reference for AVR coding in pure C/C++?

Can someone recommend a good book/reference for going vanilla (i.e. not using arduino simplified language) on e.g. ATtiny85? I will need to use the equivalents of analogRead() and digitalRead() quite ...
2
votes
5answers
219 views

can homemade arduino be powered up with battery?

I am new to arduino. It is costly for me to buy an arduino uno board. Therefore I am going to make a Arduino with breadboard at my home. I also want to make my Arduino portable. Arduino Uno boards can ...
2
votes
3answers
914 views

Is it possible to use extra AVR Flash memory as non-volatile EEPROM-like Flash memory storage?

In STM32 microcontrollers it is possible to use a technique that ST calls IAP, or In-Application Programming, in order to write to the Flash memory from your running application. They even have a nice ...
2
votes
2answers
3k views

ATmega328p hangs on USART RX interrupt

I was able to use USART without interrupt driven and it worked perfectly! However, when I tried adding interrupt on USART_RX_vect, the program does not work as expected anymore. Below is my small ...
2
votes
2answers
258 views

Is there an ICRn CTC mode interrupt vector?

I can use the CTC waveform generation mode to loop to OCRnA and trigger the corresponding TIMER1_COMPA_vect interrupt. // CTC mode TCCR1A &= ~(1 << WGM10); TCCR1A &= ~(1 << WGM11);...
2
votes
2answers
382 views

How to read OC0A when in CTC (toggle) mode?

I have this code, which puts the Arduino into CTC mode with interrupts, and outputs a square wave on PD6 (OC0A): void setup_timer(double p_ms, double duty){ DDRD |= (1 << 6); // set pin 3 as ...
2
votes
1answer
1k views

How is the bootloader activated when device is running?

For the sake of specificity I am referencing my question to Arduino. It applies to all AVRs with hardware USB and a bootloader though. The bootloader is capable of receiving new program data over the ...
2
votes
1answer
202 views

Trying to run Timer1 in ATmega2560 with assembly

I have a slight problem with Timer1 in arduino (ATmega2560) while coding it in assembly. I try to run the Timer1 in CTC mode - I configure everything well in my opinion, but the TCNT1 just doesn't ...
2
votes
2answers
891 views

Burning arduino generate hex file to blank atmel chip

Is it possible to burn the hex file to a blank chip, generated by Arduino to burn using USBASP to that particular chip without using Arduino board ? Will the program work ? My main goal is to use ...
2
votes
1answer
551 views

Generating 200 kHz pulse on Arduino Uno in normal mode

I need to obtain 200 kHz from Arduino Uno. I am using Timer0. I have configured it to run in normal mode and the Prescaler is set to clk/8 (the clock frequency of Arduino is 16 MHz). TCNT0 ...
2
votes
1answer
5k views

How to convert Arduino example sketch to a complete c++ project?

I'm experimenting something new with my Arduino Leonardo. I removed its original bootloader and flashed it with LUFA mass storage example with added functionalities(now its a firmware). I'm trying to ...
2
votes
2answers
4k views

Since double and float represent the same data type (usually), which is preferable?

It looks like on ATMega based boards, float and double are equivalent 32-bit (4-byte) data types. However, on the Arduino Due, doubles are 64-bit (8-byte) where floats are 32-bit (4-byte), same as ...
2
votes
1answer
633 views

Why does my Arduino keep waking up?

This is my first post. Please excuse me if this is a repost, but I couldn't find a similar question via search. I have some experience with Arduino and I'm looking to utilize AVR's sleep mode in a ...
2
votes
1answer
761 views

Atmega168 Watchdog timer

I'm trying to use the watchdog timer to prevent the atmel from being stuck in a loop. Right now, I have the watchdog timer in System Reset Mode, with a 8sec timer. I reset the timer in every loop ...
2
votes
1answer
3k views

How to create delays in AVR assembly language

Hi i'm new to AVR assembly language so i was trying to get delay function to create 1 ms , 100us, and 1us delays to do that i need to figure out what to replace nop's with below here (mainboard ...
2
votes
1answer
138 views

Assembly for loop repeating 2 times when it's only suppose to do it once

I'm programming an Arduino Nano so I belive that this question should be qualified for this SE. I am trying to dim up an LED using a for loop in AVR assembly. My problem is that the cycle is ...
2
votes
1answer
928 views

How does DDRD |= _BV(PD2) differ from digitalWrite(2,HIGH)?

I'm attempting to copycat the work of Louis Frigon's Toyota Aux Enabler. I have (with a lot of help on this site) managed to begin capturing and understanding messages on the AVC-LAN bus, but I can't ...
2
votes
1answer
545 views

Building Custom Bootloaders

Recently I was checking out the Atmel's AVR series and I found the Atmega328PB. I am really familiar with Arduino's environment. So I thought if somehow we could bootloader it with Arduino bootloader. ...
2
votes
1answer
1k views

Arduino EEPROM retains old data after flashing with a new program

I have a custom 5V 16Mhz Arduino Uno (a breadboard Uno of sorts) that runs the grbl firmware. After the initial flashing I can see all the settings (through the serial monitor) and everything works. ...
2
votes
1answer
1k views

Uploading .hex to ATTiny13 using Arduino

I would like to upload a .hex to ATTiny13V (or '13A) using Arduino Uno R3. I think I know everything to do, but ATTiny13 ISP support and Arduino IDE is a bit search-and-find, and I have some grey-...
2
votes
1answer
166 views

In UART, what mechanism sets the “new data received” flag back to 0?

I was reading documentation on UART on AVR and it looks simple: when a flag (bit RXC0 of register UCSR0A) is set to 1, it means the micro controller has new data for you, and you read this from ...
2
votes
1answer
1k views

Custom Arduino library problem

I have made my custom serial(UART) library. So I made uart.h and uart.cpp files as following. uart.h #ifndef UART_H #define UART_H #include <avr/io.h> #include <stdlib.h> //creating ...