Page 1 of 1

How do I verify if ATMEGA328 has bootloader burned already?

Posted: Wed Nov 04, 2015 12:16 am
by bidbirdlin
Hi, Pyro

I bought two ATMEGA328 Microcontroller on Gadgetory and try to repeat the microcontroller Lesson2: Hello world in http://www.pyroelectro.com. After I follow all instruction and assembly ATMEGA328 with 7805 Regulator, USB-to-Serial Circuit, 16MHz oscillator, and reset button, and upload the program, I don't see LED which connected to Pin 13 turn on.

The first question is, is the ATMEBA328 already burned with bootloader so I just need to use Arduino to upload program?
The second question is how do I verify if the microcontroller is burned with bootloader already? Can I just give 5V to Pin2(RX) and see if pin13 give 5V output? Please advice.

Regard,
Lenny

Re: How do I verify if ATMEGA328 has bootloader burned alrea

Posted: Wed Nov 04, 2015 7:06 pm
by ThePyroElectro
bidbirdlin wrote:Hi, Pyro

I bought two ATMEGA328 Microcontroller on Gadgetory and try to repeat the microcontroller Lesson2: Hello world in http://www.pyroelectro.com. After I follow all instruction and assembly ATMEGA328 with 7805 Regulator, USB-to-Serial Circuit, 16MHz oscillator, and reset button, and upload the program, I don't see LED which connected to Pin 13 turn on.

The first question is, is the ATMEBA328 already burned with bootloader so I just need to use Arduino to upload program?
The second question is how do I verify if the microcontroller is burned with bootloader already? Can I just give 5V to Pin2(RX) and see if pin13 give 5V output? Please advice.

Regard,
Lenny


Hello,

Yea the bootloader is already installed -- you just have to use Arduino. You can't actually verify the bootloader is installed without reading the bootloader memory. I'm not sure what you mean by +5v to Pin2 -- don't do that!

Do you have a photo of your hardware connections? There are a lot of places where this can go wrong when you build it. I'm happy to give a shot at figuring what you might have done wrong.

Re: How do I verify if ATMEGA328 has bootloader burned alrea

Posted: Wed Nov 04, 2015 10:07 pm
by bidbirdlin
Hi, Chris

Thanks for taking time answer my question. Continue the conversation in the E-mail
"Hi Lenny,

Yes, All of the ATMEGA328 (Arduino Compatible) - SKU100064 that we sell are preloaded with an Arduino Compatible bootloader. For additional quality assurance we also upload a simple blinking LED program onto the microcontroller to ensure the bootloader was properly installed. So if you setup the basic circuit for the microcontroller, Digital Pin 13 should blink at around 1 Hz.

Unless you have an AVR programmer, the only way to know that the bootloader is installed, is by connecting to the Arduino IDE and talking to the microcontroller. Connecting +5v to Pin 2 will do nothing and I do not suggest doing this as Pin 2 is a communications pin, not a power or a ground pin."
************************************************************************************

I have posted three photos of my circuit setup. Please have a look. The only thing working now is 7805 +5V regulator which I do get +4.25V.

There few things I didn't follow the schematic on PyroElectro Microcontroller Lesson2 are:
1. In +5V Regulator section: I use two 1uF capacitor instead 10uF.
2. In 16MHz Oscillator section: I use two 0.1uF instead 22pF capacitor.
3. I used 16MHz oscillator I purchase from local store not Gadgetory.

Other then that I follow schematic in PyroElectro Microcontroller Lesson 2 but I don't see any LED blink on pin13 when I try to load the very simple Lesson 2 program.

Here are some suspect place I am wondering that I might cause problem:
1. Is Oscillator still alive?
2. Is Oscillator have polarity and which leg I should connect to XTAL1(pin9) and XTAL2(pin10)?
3. I did install virtual communication port driver and it seems the port is "COM4". I also choose board "Arduino Duemilanover or Diecimila" and Programmer "AVR ISP". Is there anything wrong here? It shows error message "avrdude: stk500_rev(): programmer is not responsing...etc"

Please advice me how to correct the problem and make it work.

Re: How do I verify if ATMEGA328 has bootloader burned alrea

Posted: Wed Nov 04, 2015 11:14 pm
by ThePyroElectro
bidbirdlin wrote:Here are some suspect place I am wondering that I might cause problem:
1. Is Oscillator still alive?
2. Is Oscillator have polarity and which leg I should connect to XTAL1(pin9) and XTAL2(pin10)?
3. I did install virtual communication port driver and it seems the port is "COM4". I also choose board "Arduino Duemilanover or Diecimila" and Programmer "AVR ISP". Is there anything wrong here? It shows error message "avrdude: stk500_rev(): programmer is not responsing...etc"

Please advice me how to correct the problem and make it work.


[1]
If the crystal doesn't work, that will definitely cause a problem. I don't think its likely that the crystal is causing the problem. If you have several crystals laying around, you can put a different one into the circuit and if the circuit starts working then you know the other crystal was bad. So this is a very easy problem to debug.

[2]
No polarity. Either way is fine.

[3]
This response means that the Arduino IDE cannot talk with the microcontroller. Sometimes it happens when the Rx/Tx signals are connected opposite (Remember connect Tx->Rx and Rx->Tx).

In 16MHz Oscillator section: I use two 0.1uF instead 22pF capacitor.


Take these 0.1uF capacitors out. Big no no. They will act like a low pass filter and kill the 16 MHz signal. This might be your problem. The 22pF capacitors are optional, but recommended -- so try the circuit without them first and see if things work.

Re: How do I verify if ATMEGA328 has bootloader burned alrea

Posted: Wed Nov 04, 2015 11:51 pm
by bidbirdlin
I think I just found one of my problem is that I didn't push Microcontroller harder to attach on breadboard so the connection is lose. Now I can see the LED light keep blinking.

I also change those two capacitor at each side of oscillator from 0.1uF to 27pF.

However I still can not load program onto microcontroller. On Arduino I still get error message which imply computer is not talking to microcontroller. The LED light keep blinking and no stop. If I push reset, light go off, then three quick flash and then off and then continue to flash no stop again.

Does this mean my microcontroller is still alive or dead already?

Lenny

Re: How do I verify if ATMEGA328 has bootloader burned alrea

Posted: Thu Nov 05, 2015 1:49 pm
by ThePyroElectro
Hi,

That's an easy solution for that first problem then :D .

What you are seeing is exactly what you should see. The LED blinking is the test program that the people at the Gadgetory load onto the microcontroller for testing and when you reset the microcontroller, the boot-loader reloads the program. Since you see the 3 fast LED blinks after reseting the microcontroller, it means that the bootloader is working exactly as it should.

It seems like there is either a problem with the USB-to-Serial converter or some setting inside of your Arduino IDE. Perhaps try changing the board to Arduino UNO, double check the COM port is correct (device manager) and use the programmer 'AVRISP mkII'. Swap the Tx/Rx pins as well, you may have them backwards.

If the LEDs on the usb-to-serial converter PCB don't light up when you try uploading a program then there might a problem with the driver you installed, or the board itsself may be bad.

Hope one of these fixes it!

Re: How do I verify if ATMEGA328 has bootloader burned alrea

Posted: Thu Nov 05, 2015 6:47 pm
by bidbirdlin
Hi, Chris

It is good to hear that the Microcontroller is still alive and do what it should do. However program still can not be written into the chip. I have changed board to "Arduino/Genuino Uno", make sure USB to serial port is at "COM4", USB to serial converter light is on, driver is working in "Device mangement", change Programmer to "AVRISP mkII" and try to swap RX and TX between the wire to Microcontroller.

No matter I unplug USB or plug in USB to computer and only leave +9V battery power on, the LED connect to pin19 just keep blinking every 0.3 second and no stop which is very fast. Is this a good sign or is this a bad sign?

I have doubt on the 16MHz crystal oscillator. I don't know if it is working. Maybe I should buy from Gadgetory too which I didn't. I just place order again yesterday. Is there any method to verify crystal oscillator dead or alive? Oscilloscope? Digital Multimeter? and how?

Lenny

Re: How do I verify if ATMEGA328 has bootloader burned alrea

Posted: Thu Nov 05, 2015 7:24 pm
by bidbirdlin
I just used frequency counter to check crystal oscillator and I get reading is 16.005MHz which is pretty good. I also use Oscilloscope with 10x probe to check and get 900mV Peack to peak reading which imply voltage is 9V peak to peak and 60 nano second which imply 16MHz (1/16000000).

This just confirm crystal oscillator is fine but this does not solve my problem yet. If you have any thought please let me know.

Lenny

Re: How do I verify if ATMEGA328 has bootloader burned alrea

Posted: Fri Nov 06, 2015 12:00 am
by bidbirdlin
Hi, Chris

Finally I have a good news. I was using my laptop with Windows 7 and kept having problem. After I change to my desktop with Windows 7 and everything goes fine and I can upload program successfully. After I change back to my laptop, it works too and have no problem to upload too. It becomes a mystery that what wrong was before.

Anyway, after spends few days trouble shooting, finally I can really have a progress and move on.

Thank you for all your help.

Regard,
Lenny Lin

Re: How do I verify if ATMEGA328 has bootloader burned alrea

Posted: Wed Nov 18, 2015 4:44 pm
by ThePyroElectro
bidbirdlin wrote:Hi, Chris

Finally I have a good news. I was using my laptop with Windows 7 and kept having problem. After I change to my desktop with Windows 7 and everything goes fine and I can upload program successfully. After I change back to my laptop, it works too and have no problem to upload too. It becomes a mystery that what wrong was before.

Anyway, after spends few days trouble shooting, finally I can really have a progress and move on.

Thank you for all your help.

Regard,
Lenny Lin


The ghost in the machine...glad you got it working!

Re: How do I verify if ATMEGA328 has bootloader burned alrea

Posted: Sun Feb 07, 2016 2:12 am
by Sourz182
Hey I'm having the same issues. I followed and tried all of the solutions in this post and nothing has worked. it just keeps running the factory bootloaded program flash LED. also i keep getting "denied access to PORT4" from avrdude from time to time. any ideas?