Questions tagged [atmega2560]

Low-power 8-bit AVR microcontroller with 256kB flash.

Filter by
Sorted by
Tagged with
3
votes
4answers
1k views

Will an ATmega2560 board be faster than a Uno for hard real-time data logging?

I am designing a hard real-time data logger. The Uno is a bit marginal in processing speed. a) Would it be faster if I changed to an ATmega2560? b) On the datasheet, ATMEGA2560 has 135 instructions; ...
3
votes
2answers
2k views

Arduino crashing during serial print for no obvious reason

I've written some Arduino Code which kept crashing and i couldn't find out why. Then i reduced the code as much as i could in order to see the problem. The reduced code currently doesn't do anything ...
3
votes
1answer
353 views

Bootloader and Boards Definition for Atmega2560V-8AU at 8 MHz / 3.3v

I am working on a home made project,where i am using Atmega2560V-8AU (note the suffix, this part has an 8 MHz maximum clock rate) as my main controller, supplying 3.3V to this chip. I want this ...
2
votes
4answers
1k views

If else statement not mutually exclusive?

When I'm running some test on my encoder motors using the following provided code by Makeblock, it appears that the if..else.. statement is not mutually exclusive ie. I can control Encoder_1 and ...
2
votes
2answers
297 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
1answer
309 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
1k views

Arduino MEGA2560 Standalone

I had an Arduino UNO (ATmega168) standalone working, but I need more pins, and I decided to use the ATmega2560, I was searching for some schematics, and none of them shown an ATmega2560 standalone, ...
2
votes
1answer
122 views

I2C communication between arduino and raspberry pi breaks under stress for unclear reasons. Why?

I am having a behavior I cannot explain while using arduino mega as a I2C slave for a raspberry pi master. I am showing here an idealised program that shows the issue. I experience pretty much the ...
2
votes
1answer
134 views

Ardunio Mega/ATmega2560: Using Port F or K for both analog inputs and digital outputs

On an ATmega2560, can ports have some pins used for analog inputs but others as digtial i/o? Specifically, I only need to use 3-5 analog inputs but have many digital inputs. I would like to use the ...
2
votes
3answers
131 views

Conditional randomization gets stuck

First-time poster here... I have the following code to randomize note values and store them in an array loop1[i], where i is a specific step in the loop: nextNote = random(-2, 3); note = note + ...
2
votes
2answers
1k views

Error while boot loading Atmega 2560 using Arduino Mega 2560

I have developed custom board using Atmega 2560. I am doing boot loading process using the process of migrate from an Arduino board to a standalone microcontroller. I have followed this steps... 1) ...
2
votes
1answer
324 views

Arduino Mega and gyroscope erroneous values

I have Arduino mega2560 and MPU6050. I connected to Vcc pin of the gyro to +5V on the mega, the SDA to SDA pin, SDL to SDL pin, AD0 and GND to 2 GND pins. I used this code: #include<Wire.h> ...
2
votes
0answers
67 views

How to wake up Arduino with an rtc?

I am doing a data logger with an Arduino Mega2560 and I want to use a code to make it sleep when no measure is needed and wake it up with an RTC when time comes. The reason I want this is because I ...
1
vote
2answers
284 views

Trying to determine the phase difference between two square signals

I have been looking for the phase difference between two square signals and this is the code: #include <avr/io.h> #include <avr/interrupt.h> void setup() { //Serial.begin(9600); ...
1
vote
1answer
63 views

Set PWM by period? And have it variable?

In this other stack QA I'm asking about generating a pulse signal with a period ranging from 63 ms to 6.5 ms. There is a popular PWM library however it doesn't compile and also since 63 ...
1
vote
1answer
34 views

Serial Port fails with speeds greater than 19200

In Arduino Mega 2560 R3, properly selecting the Serial Monitor bauds, this code works with #define R 38400, but for some reason, not with #define R 19200 (?), #define R 38400 int rate=R; ...
1
vote
1answer
52 views

Switch statement cases not executing

Overview: I am trying to use a switch statement to run different tests. A main menu is displayed on the serial monitor, and then the user is given the option to enter their menu choice in the serial ...
1
vote
1answer
162 views

Using the Arduino compiler, is it possible to use Atmega2560 interrupt pins that are unused by Mega?

Looking into the schematics for the Arduino Mega I noticed that pins PE6 and PE7 are interrupt-enabled (INT6 and INT7 respectively); however, they remain unconnected to any Arduino I/O pin. I'm ...
1
vote
1answer
236 views

PROGMEM Corrupted Array

I am trying to store a large number of values into a couple of arrays using PROGMEM, but I am finding that a few of the values are read back corrupted. I am storing just 1s and 0s, but when I read ...
1
vote
1answer
195 views

Confusion over Transistors for a switching circuit with an Arduino Mega 2560

Apologies if this is a stupid question asked by a noob, but I've looked around to try and find the answer and just can't work it out. Basically, I'm making a project on thingiverse (Glitch's MK2 ...
1
vote
1answer
124 views

Controllino Debugging

Its a well known fact, that you can debug your arduino board with the help of an Atmel Ice. However, you might know the Controllino which is an arduino compatible device. It has an ATmega2560 on it. ...
1
vote
2answers
1k views

Programming ATmega2560 processor with FTDI instead of ATmega32

Has anyone tried to program an ATmega2560 with an FTDI chip as is done in the Arduino Nano (this is for a custom design). Will it work?
1
vote
1answer
50 views

How to count the number of rising edges on DS3231 rtc?

I am using a DS3231 rtc and I would like to get millisecond accuracy from it so I decided to use the 32kHz generated clock from it. I wrote a code that would count the rising edges or falling edges ...
1
vote
2answers
68 views

Matrix keyboard and 7segment display countdown combination

I'm working on an escape room for my university with an Arduino Mega. The last part consists of a 7segment display representing a time countdown, and the participants have to introduce the correct ...
1
vote
1answer
769 views

SOLVED: Strange phenomenon with avrdude: stk500v2_ReceiveMessage(): timeout only with ATmega250 on windows 7x64

I know this problem has been reported multiple times but in my case I think there is a different light on it. My desktop is a w7x64 box and I also have a notebook with w10. Both system have the ...
1
vote
1answer
4k views

Rotary encoder I2C LCD menu

I am trying to make a menu for a monitoring/control system. I am not sure how to make this without interrupting my current code which needs to be monitoring my system at all times to shut off if it ...
1
vote
2answers
493 views

7 segment displays arduino mega 2560

I'm trying to use an Arduino Mega 2560 to use 7-segment displays, 6 displays... I use 3 CD4543B to pilot the 6 displays. It works very well for 4 displays as you can see in this video. But when I ...
1
vote
3answers
839 views

Understanding writing to input pins and pull up resistors

I am new to Arduino, and am trying to understand the following code. The question is: Is my understanding correct, or if not, what is happening here? I have to reverse engineer an existing ...
1
vote
0answers
21 views

Advice needed for powering Multiple HX711 with Arduino Mega

I have a project where I need to use multiple load cells (6-8), with individual HX711 for each load cell, which need to be powered simultaneously. I am not sure if I can power all the HX711 with 5V ...
1
vote
1answer
144 views

Arduino Mega Pins for SoftwareSerial (vs. AltSoftSerial)

I am currently looking at using an Arduino Mega to build a MIDI Receive box that will then pump the data over USB, but am having design issues/uncertainties with the Arduino's receiving end. I am ...
1
vote
0answers
70 views

Erasing all flash on boards with over 64kb of program memory

I'm using a Mega2560 board. My project needs to store some large constant data. To preserve the first 64kb flash chunk, I write these data on addresses beyond this limit. But there is either an ...
1
vote
0answers
57 views

Is there an easy way to connect and control 3 servos?

I need to connect and control three Parallax Standard Servos to an Arduino board, and apart from the USB connection, nothing else will be connected to the board. My predecessor used a setup of and ...
1
vote
0answers
213 views

Intermittent wifi/hotspot connection

I have an Arduino Mega 2560 with a cc3000 Wifi shield that is sending messages to dweet.io. Here is the relevant portion of my code: // Post data to dweetio char data[125]; sprintf(data, "?t1=...
1
vote
0answers
106 views

Arduino not responding while trying to flash over BLE

I'm working on wireless uploader for Arduino from iOS devices. I'm using HM-10 BLE module which seems to work ok. PIO 2 is used as DTR for resetting (see A [0x41] T [0x54] + [0x2B] P [0x50] I [0x49] O ...
1
vote
1answer
172 views

Did I just brick my ATMEGA 2560?

I bought an ATMEGA2560 on eBay and programmed it with Arduino IDE 1.6.9 using the USB cable, and the LED blinked as expected - All well and good. Now I wanted to program the mega from my UNO as ...
0
votes
1answer
194 views

Extrapolate require MCU from Arduino MEGA2560 performance

I am running a control program for an ebike on an Arduino MEGA2560 which uses this MCU: http://www.atmel.com/devices/atmega2560.aspx. Currently, the program loops every 100ms which gives me a sample ...
0
votes
1answer
44 views

ADC register always returning high

Regardless of whatever voltage at A0, the software is always returning high (1023) volatile unsigned char* ADmux = (unsigned char*) 0x7C; volatile unsigned char* ADCSRa = (unsigned char*) 0x7A; ...
0
votes
1answer
33 views

Why is Serial Print causing different behaviour based on where its located

Im trying to test out these two motors I have where I need to call a function from the loop. I only want to call this function once so I made a quick little if statement to have the program only run ...
0
votes
1answer
92 views

Help understanding how avrdude works with ArduinoISP and why its not working for me

I am trying to use avrdude with a Mega2560 running ArduinoISP Note: I have the 10uF cap on the Mega2560 RESET line as described by Ardunio. Also, I am using avrdude/6.3 on Windows 10. The Mega2560(...
0
votes
1answer
55 views

C++ State Machine / Wpmf-convesion

I'm quite a newbie using C ++. I am trying to implement in C ++, the state machine described in this link for C language: https://barrgroup.com/Embedded-Systems/How-To/Coding-State-Machines. I have ...
0
votes
1answer
33 views

Maximum sampling rate of Arduino Mega2560

I'd like to know what is the maximum sampling rate achievable while using ADC on Arduino Mega2560. Thanks
0
votes
1answer
57 views

How can i stop DC motor when button on remote is released? [closed]

I am trying to control a motor using a remote with Arduino Mega. The motor turns on when I press the button on the remote but when I release the button, it continues to move. Does anyone know how to ...
0
votes
2answers
216 views

Will a 12 VDC 1A Power Supply Adapter supply too much power and damage an Arduino Mega 2560?

The specs shown here: show that it has 54 digital pins with each outputting a DC current of 20mA which makes it 54 * 20 = 1080 mA Plus the DC current of the 3.3V Pin of 30mA we get a total of 1110mA....
0
votes
1answer
69 views

Converting code for ATTINY85 to ATMEGA2560. Pin change interupts

I have code that compiles correctly for an ATTINY85 board using the ARDUINO IDE but I don't have an ATTINY85 board. I have an Arduino Mega ATMEGA2560 and when I select this board in the Arduino IDE ...
0
votes
1answer
25 views

Arduino loop over a function is always displaying 0 as final values

I trying to loop over a function in arduino to get values for 2000 times, and then divide it by 2000 to get an average offset: int16_t x_offset = 0; int16_t y_offset = 0; int16_t z_offset = 0; And ...
0
votes
2answers
368 views

Burn Bootloader to Chinese Arduino 2560 with AVR ISP programmer

I got my hands on one of these ISP programmer for Atmel AVR microcontroller in USB stick design: Then I selected Progammer > AVR ISP and clicked on Burn Bootloader but it says stk500_recv(): ...
0
votes
2answers
191 views

mega2560- Interrupts reading digital input

Hi I am very new to Arduino, with very little programming experience. I am using mega 2560 and trying to understand how interrupt works. I have a code written, it is very similar as the example ...
0
votes
3answers
796 views

2.4Mhz clock for 3-wire SPI using Arduino Mega 2560

I am trying to develop an Arduino sketch for ADS8320 ADC IC, which is 3-wire SPI. I need a 2.4MHz serial clock for the SPI interface. I tried the code below, but I don't know how to generate clock ...
0
votes
2answers
27 views

what will be the sampling frequecy of my arduino Mega 2560 code. How would I calculate it?

void setup() { // initialize the serial communication: Serial.begin(9600); pinMode(10, INPUT); // Setup for leads off detection LO + pinMode(11, INPUT); // Setup for leads off ...
0
votes
1answer
34 views

Floating power supply for Arduino - Is it still connected to the USB ground?

I am trying to power my Arduino Mega 2560 from a benchtop power supply. I plan to essentially feed in a 9V supply directly on the Vin pin and connect the GND pin to the floating ground pin on the ...