[Solved] Atmega328p -au bootloader and execution failures

Hello everybody.

I have an atmega328p -au on a custom pcb.

I use a 16MHZ ceramic resonator, but I forgot to burn the bootloader before and I uploaded the code directly via USB ASP programmer.

About the code, is quite long to put it completely at the moment.

I noticed that the sequence was very slow. Then, I realised that I had not burned the bootloader before.

I burned it and uploaded the sketch again.

In principle everything was fine at the beginning, but I realised that after a while the light sequence was doing strange things and not what I had put in the code.

I have tried it with another pcb and another atmega, doing the process of burning and uploading using the programmer, and it works fine.

My question is if due to this failure that I had, it could be that internally the atmega328p -au has broken down. And it doesn't run any program properly because of a memory overflow, for example.

And if it can be reset in some way, or if it is necessary to replace it with another one.

Thank you very much.

Don’t double post please.

https://forum.arduino.cc/t/bootloader-de-atmega328p-au-y-fallos-posteriores-de-ejecucion/959579

do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation for your ask).

Thanks. Deleted in spanish section.

I would try to bootload it again and reprogram it. Or even program it with an entirely different program.
This very slow working when not bootloaded is known. I had this a few times too, but was always able to bootload and reprogram it.
As the software works on a equal board, there can always be something wrong.... but i doubt it can be caused by programming it prior to bootload.

Indeed
β€”β€”

See for example sketch gets slow when burning atmega328 witout bootlader!!!! - #4 by pert

Thanks.

Yes, i burned the bootloader again and with other simple sketch (blink leds) and it works.

But when i upload my sketch, there is some weird things. I think is about the Memory.

The most curious is that with other atmega and pbc, it works well.

So, the code i think is ok. Maybe is the internal Atmega working. Maybe the fuses?

Uploading code with no boot loader should not damage your MCU. There is something else going on

There are probably a few sketches to be found on the internet which do a memorytest or show you the fuses and do a intensive functionality-test

Thanks! I will check them.

And other question, is possible to reset the atmega328p in oder to begin again burning the bootloader?

Hello everybody, problem solved!

Definitely the atmega328p is ok.

Problem was in the code (typical mistake of these forum topics...sorry for that).

I explain:

I connect the atmega to a Wireless adapter. So, when the pin is LOW, the Wireless connection with the computer is active.

But, sometimes there is EMIS or readings a little different, even the Wireless adapter can change sometimes a little the voltage of that pin. Then, the connection seems to have disconnected, but not really.

Problem was in the code with the sentence IF.

 IF analogRead == 0, then connected 

I have changed the sentence:

  IF analogRead < 100, then connected 

And it works, because the code always executes the correct lines of the IF. And before of that, the code, sometimes executed the lines of the ELSE.

Thanks again to everybody.

Regards

Glad you figured it out. Have fun

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.