Go Down

Topic: Uploading Sketches to ATMEGA324p using MEGA (Read 1 time) previous topic - next topic

Nick Gammon

Code: [Select]

Bytes to write  = 1518


When you made that .hex file did you compile for a Uno? That seems large to me. What IDE did you use?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

legonick22

#106
Apr 15, 2015, 02:49 pm Last Edit: Apr 15, 2015, 02:51 pm by legonick22
I compiled for the 1284p 16MHz with optiboot on the Arduino IDE.

EDIT: Typo...
My mother said I could be anything I wanted. But I don't want to be anything I wanted. I want to be an engineer!

Nick Gammon

Hmm. Try doing direct port manipulation instead of using the pin numbers in the blink sketch.

Something like:

Code: [Select]

DDRB |= bit (7);  // pin mode: output

PORTB |= bit (7);  // turn pin 13 on
delay (500);
PORTB &= ~bit (7);  // turn pin 13 off
delay (500);


Then make sure you have an LED on PB7.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Budvar10

I compiled for the 1284p 16MHz with optiboot on the Arduino IDE.

EDIT: Typo...
I'm little bit out of discussion so don't beat be, but you have to compile program for exact MCU. 324P/1284P are not fully interchangeable even though they are the same type.

Quote
It will not blink the LED on D13 of the standard pinout, but it will give a constant light on D13 of Budvar's pinout diagram he gave me (see next post)
Pin for L is defined in pins_arduino.h and also in bootloader independently. Do you have defined it correctly? I've sent to you my own variant L/D13 == PB7 (http://forum.arduino.cc/index.php?topic=277260.0). Your is on PD5 as I remember, isn't it?

legonick22

#109
Apr 17, 2015, 08:07 pm Last Edit: Apr 17, 2015, 08:07 pm by legonick22
@Nick I am having issues with that compiling...
Code: [Select]
DDRB |= bit (7);  // pin mode: output

PORTB |= bit (7);  // turn pin 13 on
delay (500);
PORTB &= ~bit (7);  // turn pin 13 off
delay (500);

Code: [Select]

BareMetal.ino:5:1: error: expected unqualified-id before 'volatile'
BareMetal.ino:5:1: error: expected ')' before 'volatile'
BareMetal.ino:5:1: error: expected ')' before 'volatile'
BareMetal.ino:6:7: error: expected constructor, destructor, or type conversion before '(' token
Error compiling.

Adding setup() and loop() functions doesn't help.

I don't have any experience with direct port control like this, can you refer me to someplace where I can learn more?
My mother said I could be anything I wanted. But I don't want to be anything I wanted. I want to be an engineer!

Nick Gammon

#110
Apr 17, 2015, 11:27 pm Last Edit: Apr 17, 2015, 11:27 pm by Nick Gammon
I know I tell people not to post snippets, but that is when they are asking for help. What I posted was, I hoped obviously, a snippet.

You still need setup and loop. This compiles for me:

Code: [Select]
void setup ()
  {
  DDRB |= bit (7);  // pin mode: output
  }  // end of setup
void loop ()
  {
  PORTB |= bit (7);  // turn pin 13 on
  delay (500);
  PORTB &= ~bit (7);  // turn pin 13 off
  delay (500);
  }  // end of loop
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Budvar10


Quote
I don't have any experience with direct port control like this, can you refer me to someplace where I can learn more?
Datasheet of the MCU. It can be downloaded from official Atmel's web.

legonick22

All right, the code compiles and uploads.

When I tie an LED to PB7, it stays on. It doesn't blink. When I press RESET, it turns off, and when I release, it turns back on. Why won't it blink?
My mother said I could be anything I wanted. But I don't want to be anything I wanted. I want to be an engineer!

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy