Arduino UNO ATMega328 substitution

Hi all,

I've bought some ATMega328PU mcu to try to use them in standalone projects. First I've tried to substitute the mcu of my Arduino Uno to test the new one with a simple led 13 blinking sketch. The test seems to work but I have an issue because the sketch get lost when I switch off the board. Indeed, when I power on again my Arduino UNO, I observe a different blinking of led on pin 13. This blinking is the same I observed when I powered on the first time the board with the new mcu.

It seems as if the sketch I loaded into the mcu was not permanently stored.

No problem, instead, using original mcu ... of course :drooling_face: Any idea ?

Thanks in advance. Antonio

It seems as if the sketch I loaded into the mcu was not permanently stored.

It is not possible for the chip to run a sketch without it being stored in program memory. What ever is happening it is not what you think.

Sounds like it is stuck in the bootloader.

What bootloader did you put on it? Precise details please.

How long did you wait to observer the LED blinking. It may be an older bootloader that can take up to 8 seconds before running the sketch.

@ Mike I agree. I'm sure the program is stored when I compile it to the board and it works (I've tested several frequency blinking so I'm sure that the sketch is correctly compiled and uploaded). The problem happens when I power off and on again the board. Using the original mcu the sketch I compiled starts again, using the new mcu it doesn't.

@ Nick I don't know, the mcu has come with a preloaded bootloader. I could try to burn a new one.

@ hiduino At compile time I observe about 1 second with tx/rx blinking and another second to start executing the sketch. At power on time only 1 second to start the "mysterious" sketch ... :)

Let me clarify, when you first power on the board what you are observing is the bootloader running, not a "mysterious" sketch. Did you try observing the LED for more than 8 seconds to see if it changes how it blinks?

It repeats the same blinking sequence continuously, something like:

on-on-on------on-on-on------on-on-on------ and so on and never stops.

Looks like it may have an older version bootloader that may not work correctly in the Uno board.

What happens when you press the reset button?

Unfortunately it start blinking again the same way.

What does it say when you load the sketch?

The usual message returned upon a succesfull compilation and upload, dimension of the sketch and max sketch size (32,256).

I have tested 5 mcu getting the same result but two of them have a variant. Powering the board through usb cable they "forget" the compiled sketch and play the strange sequence described above, but, powering by external supply (9volts), they "remember" and execute the uploaded sketch.

The other three mcu don't "remember" in any case.

Could this help to find a diagnose?

Other strange behaviour: all 5 mcu work fine if mounted on a breadbord instead of testing them on Arduino board. I've powered the breadboard getting supply from Arduino board powered either by usb cable or external dc source. :astonished:

PROBLEM SOLVED:

I've updated bootloader and the mcu have started working fine.

Thanks all for help !!!

Hai all…
Can anyone help me with my coding. I m using Arduino 328 with Mrf24j40.
I wanted to send a data to the receiver.I have to pass an array. The command
mrf16.send is not working while transmitting an array… can anyone help me…? Its urgent…
I have attached the code also…

sender.txt (5.07 KB)

receiver.txt (5.14 KB)