Go Down

Topic: Upload issues. (Read 800 times) previous topic - next topic


Hello people, first of all, sorry about my english... it's not my native language.
So, here is my problem: I was reading about port registers on arduino site, and decided to try it on my arduino. I saw that if you put DDRD = B(1 or 0's) you can set pins as outputs or inputs at the same time.
So i uploaded the following code to my arduino MEGA:
void setup(){
  DDRD = B11111100;
void loop(){
  PORTD = B10101000;
  PORTD = B01010000;
finishing this, what i expected didn't happened. When i tried to upload a new code, the arduino wasn't responding to my pc comunnication anymore.
I Think i changed the RX TX pins to INPUTS, and now the serial communication is failling .
How do i erase the progammation that is running on it?
Is there a way to fix it?

I'm not expert on progammation and aletronics, i'm a really begginer. Please help me.


Uploading a different sketch, like blink, should clear the problem. If not you have some other problem then just what you did in this sketch. A reset forces all I/O pins to input mode, so uploading a new sketch 'erases' any prior pin mode setup from a prior sketch.



Hello, thanks for replying. I tried upload the blink example, but it didn't worked =/
When i try to upload an sketch, the following error appears:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x10
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.
On the upload process, the rx led barelly blinks, and the tx one never blinks...
If it isn't what i think it is, what could it be? is there any way to "Hard reset" the atmega? i searched how to reburn the bootloader too, but only found how to do it on the duemilanove...
It would be so sad if i had to buy a new arduino... this things here in my country are sooo expensive.


Lefty, problem solved. I changed the pc and the blink sktch uploaded. I don't know why, but everything is fine now. Thanks for the help :)

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!

via Egeo 16
Torino, 10131