Questions tagged [avr]

AVR is the family of microcontrollers used in Arduino boards.

Filter by
Sorted by
Tagged with
2
votes
1answer
52 views

3-instruction remote machine coding Arduino Atmel chip over a serial line from a tethered (host) PC

I'm trying to write a program for AVR Atmel 328 chip on Arduino Nano board that will allow me to send machine code instructions to the chip over a serial line, run/execute them on the chip, and ...
2
votes
2answers
651 views

Change the fuses of an Arduino Uno (can an Arduino Uno change its own fuses?)

For now, I'm using an Arduino Uno alone including its 328p (no other external chip to program). I would like to change its fuses to internal 8 Mhz clock (because then I'll move the 328p out of the ...
2
votes
1answer
247 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
2k 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
626 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
2k 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
949 views

Atmega328p programming with Arduino libraries

I'm trying to use the serial communication to work between a naked AVR Atmega328p and a computer (OS X and Linux Ubuntu). I can program the atmega (using a pololu programmer), I make it blink a LED ...
2
votes
1answer
2k 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
294 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
2answers
982 views

programming arduino in pure c

I'm trying to flash pure c-code to arduino Mega2560 board from linux using avr-gcc & avrdude. Compilation is done , now trying to flash using avr-dude, getting error as "avrdude: stk500_recv(): ...
2
votes
1answer
471 views

Cannot enter programming mode on Arduino Uno

I have an Arduino Uno that I've been programming with an AVR Dragon through Atmel Studio 7. I did two things in close proximity, and I'm not entire sure which action is the culprit. I tried using the ...
2
votes
0answers
466 views

Is it possible to put ATtiny85 to sleep while using TinywireS?

I have an arduino uno as the master I2C device talking to an ATtiny85 as the slave. What I want to do is have the Attiny85 receive a message from the UNO to tell it to power off which will then ...
2
votes
0answers
934 views

Does Proteus simulate external interrupts properly using Arduino? I can't get them to work

I am trying to simulate an interrupt with an Arduino Uno in Proteus. This is the simple test code that I'm using: void introutine() { digitalWrite(13,HIGH); } void setup() { pinMode(13,OUTPUT); ...
2
votes
0answers
97 views

SPI Interface between Arduino UNO and EVK1100 [closed]

I'm using Arduino Uno board as master and AVR32UC3A0512 as slave. I've written code for arduino using SPI.h library, and Atmel Studio 6.2 using spi.h. I'm sending data from arduino to atmel i.e from ...
1
vote
4answers
905 views

Float arithmetic vs. int arithmetic - is there any power penalty?

It is widely known that float arithmetic takes longer (that is, eats more cycles) than fixed-point (or integer, or bitwise arithmetic), and that surely is something to consider for speed- and time-...
1
vote
4answers
17k 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://...
1
vote
1answer
49 views

Problem with programming digispark ATtiny85 board with Arduino IDE

I have bought a Digispark ATtiny85 board to learn about that microcontroller. So I tried using internal register names in the code rather than using Arduino in built functions. I can get the board to ...
1
vote
2answers
675 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 ...
1
vote
2answers
2k views

Why we can wake Arduino Uno from sleep using only pin 2?

Can we use other pin as an interrupt to wake Arduino Uno from sleep ?
1
vote
3answers
676 views

Arduino UNO USART problems

I need to send 6 bytes value from Arduino UNO to the actuator using serial port in order to make it extends. I have added a button to send the data. For example, 0 20 1 1 0 0. The communication ...
1
vote
4answers
2k views

Reset and Remove Arduino ATmega328P?

So I have 2 Arduinos, and im wanting to remove the chip from one and reset it to like it came from the factory and then breadboard it and attempt to program it using an AVR programmer (Or maybe an ...
1
vote
2answers
3k views

AVR (Arduino Uno) Serial.print and Serial.println only printing 1 or 2 chars

I first used the Arduino IDE but now I'm using PlatformIO which is awesome. But I have some big trouble with Serial.print() and Serial.println(). To show this error I have the following example code: ...
1
vote
4answers
1k views

How to program a CLK signal and its inverse with Arduino/AVR

Is it possible to simultaneously output a clock signal and it's inverse using the timer register(s)? I'm using the following code in arduino to output a 1MHz signal on OC1A: //Use Timer/Counter1 to ...
1
vote
2answers
607 views

ATmega328p - ISC00 with INT1?

I was reading about external interrupts using the ATmega328p, and I saw in the chip datasheet under the paragraph "Bits 3:2 – ISC1n: Interrupt Sense Control 1 [n = 1:0]" the following table: Value | ...
1
vote
2answers
3k views

Do AVR delay functions (_delay_us() and _delay_ms()) use timers?

I'm trying to determine if the AVR delay functions _delay_us() and _delay_ms() use timers in such a way that I can't use those timers for other functionality in my code. If so, what timer does it use? ...
1
vote
1answer
58 views

A confusion with setting timers

I was reading a tutorial on timers. My aim is to generate 16MHz pulse output from the pin 8. Here is the code I modified from the tutorial (I use Arduino's ATmega328P): #include <avr/io.h> #...
1
vote
1answer
3k views

AVR timer overflow interrupt not working

My problem is an interrupt service routine (ISR) that seemingly never executes! Here's some info on my set up: I am flashing an avr attiny85. I have the bare bones of a project set up so far with ...
1
vote
1answer
305 views

Porting Arduino code to AVR/C++ input not working?

So. I'm trying to read an input on the Arduino Nano using C++/AVR/Eclipse instead of the regular arduino IDE. The code below is working in the arduino IDE void setup() { // put your setup code here,...
1
vote
1answer
35 views

Is it possible my ATMega is burnt due to bad wiring?

While working on a project I tried sending data from my Arduino NANO to ATMega64 placed on AREXX Robot arm PCB via TXD/RXD. After plugging in VCC, GND, TXD and RXD to UART socket it didn't work so I ...
1
vote
2answers
198 views

Use ATTiny as a battery-backed RAM?

So, I found an interesting article the other day, and I'm trying to build a project that could benefit from a battery-backed memory (no wear limits, but keeps data over power cycling). The article ...
1
vote
1answer
190 views

Trying to make sense of the coding style in Arduino libraries. (Particularly the Radiohead library)

I've been using the Arduino IDE for some time now, and I want to shift to coding for the bare AVR microcontroller. So I wanted to begin by porting required arduino libraries to C/C++. I started with ...
1
vote
2answers
1k views

Arduino analogWrite source code explanation

The source code for the analogWrite function looks like this: void analogWrite(uint8_t pin, int val) { ... sbi(TCCRnA, COM0x); OCRnx = val; ... } Where n is which timer (0, 1, 2...) ...
1
vote
1answer
5k views

How does avrdude burn a bootloader much quicker than the Arduino IDE?

To burn a bootloader to the Arduino Micro (ATMega32u4), I'm using an Arduino Uno with the ArduinoISP program uploaded to it. 1st case: Arduino IDE Very straightforward, using the ArduinoISP sketch ...
1
vote
1answer
64 views

Complete Bread board arduino

I bought a ATmega328 microcontroller and burn the bootloader. Now I want to upload code directly from pc to the microcontroller on bread board. I have max232 ic for the communication but I recently ...
1
vote
1answer
75 views

Assign an interrupt to any pin of the atmega328 microcontroller

I need to record the appearance of a signal from the sensor on the PD0 pin. This is the first time in my life that I want to use an interrupt for this. With your help, I configured the sketch for my ...
1
vote
1answer
187 views

AVR & PIC 8-bit Microcontrollers - Can you add: external flash memory, external RAM, video & audio output, more address busses?

so I was planning on creating a mini PC out of basic ICs and 8-bit microcontrollers such as ATTinys and/or PICs and I have several questions regarding those: Can you add external RAM, say with SRAM, ...
1
vote
1answer
90 views

about how to share one External serial EEprom using two microcontrollers?

strong texti have Vector nav100 IMU sensor that sends data serially UART.I want to receive data from it using ATmega32 and then store data in AT24c1024 EEprom using I2C,then using another ATmega32 to ...
1
vote
1answer
77 views

Arduino Timer0 Piggyback

As described here https://learn.adafruit.com/multi-tasking-the-arduino-part-2/timers I use timer 0 to get my own timer with a milliseconds resolution. It is setup like this: void setup (void) { ...
1
vote
1answer
119 views

Force TCNT to stay below OCRxA on ATmega328P

I'm using a timer and the TIMERx_COMPA ISR to generate a signal in "the background". This ISR is triggered when the timer reaches a certain value (OCRxA), which in turn can be changed by the user. ...
1
vote
3answers
911 views

Shift Register on ATMEGA328p

I want to learn more about the shiftout function used with Arduinos and used the implementation with my ATMEGA328p. The Setup This is the original shiftout function used in Arduino Programming, ...
1
vote
1answer
212 views

How do I use SNAP protocol, correctly?

I've reviewed the documentation I'm still a little lost when it comes to applying the functions. Each of the redundancy check methods take in an unsigned char and return an unsigned char. Shouldn't ...
1
vote
3answers
459 views

Modify the call stack of interrupts on Arduino

I'm working with Arduino's libraries. And my interest in the possibility to change the call stack of the SPI interrupt, this because I want: after the interrupt happen, the program could jump to other ...
1
vote
1answer
2k views

ATmega32u4 bootloader

Hey all this would be my first encounter needing to burn the Arduino IDE bootloader onto a blank ATMega32u4 that I bought from Digikey. What all do I need to buy in order to program the bootloader ...
1
vote
2answers
4k views

Using Arduino as USB Device?

I'm trying to get audio data from an ADC connected to an Arduino into a host PC. I've done some digging and found LUFA, which I think Arduino uses under the hood. Is it possible to use the Arduino as ...
1
vote
4answers
2k views

Using Arduino to learn AVR programming

I want to learn AVR C programming instead of arduino programming. I have an arduino UNO board and few Atmega328 chips that I bought, and Atmel studio for programming. Can I use Arduino Uno board as ...
1
vote
1answer
27 views

About maximum length of matrix can be use for matrix invertsion on atmega32

what is the maximum length for matrix can be used for matrix inversion on atmega32,for example,can we implement matrix inversion for 15x15 matrix on atmega32? And if it can be done on atmega32..does ...
1
vote
1answer
111 views

about how to write data in the whole EEprom?

I have interfaced AT24c1024 EEprom with ATmega32.AT24c1024, which has 512 pages each of 256 bytes. There are two mode of writing (byte write and page write). In page write mode, it is capable of ...
1
vote
1answer
298 views

.elf and .hex equivalency? (code, eeprom, fuses, and lock bits all in one)

I have all configurations (eeprom data, fuses, lockbits) of my ATMega168A together with the code in my C files. The compilation creates an elf file that I use as an all-in-one programming file for ...
1
vote
1answer
308 views

OpenOCD with FT2232H on Arduino Mega (ATmega2560)

I want to do on-chip-debugging on an Arduino Mega. According to its datasheet, the ATmega2560 chip supports JTAG. (IEEE 1149.1 compliant) Can I use a generic FT2232H interface to do on-chip-debugging ...
1
vote
1answer
817 views

bit_is_clear(ACSR, ACO) Instead of digital_read(1)==LOW

I am attempting to create a program for the atmega328P which will enable the aux input of a Toyota Corolla stereo. In order to do this, I'm bitbanging AVC LAN. Nearly all of my research comes from ...