I'm trying to broaden my knowledge by learning to program my own Atmega CPU but have encountered some problems that I can't seem to figure out a solution to.
I've bought 2 Atmega328P microcontrollers and connected them properly according to the Data Sheet which I will go through in this topic. But can't seem to upload the simple Example - Blink, code to the Atmega.
I've connected 5V to pin 7 and 20, GND to pin 8.
I have a 16Mhz crystal between XTAL1 and 2, as well as two condensators with 22pf later connected to GND.
RX to TX and vice versa, as well as a 10kOhm resistor from pin 1 to +5VDC.
I open Arduino IDE and select the appropriate port,
Board = "Arduino Duemilanove or Diecimila"
Processor = "Atmega328P"
Programmer = "AVRISP MKII" (Not sure what this one should really be).
I've downloaded the drivers for my FTDI chip.
Error 1: Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB Sketch uses 924 bytes (3%) of program storage space. Maximum is 30720 bytes. Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes. avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xb7 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xb7 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xb7 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xb7 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xb7 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xb7 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xb7 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xb7 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xb7 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xb7 Problem uploading to board. See https://support.arduino.cc/hc/en-us/sections/360003198300 for suggestions.
Error 2:
** Using Port : COM5**
** Using Programmer : arduino**
** Overriding Baud Rate : 115200** avrdude: ser_open(): can't open device "\.\COM5": Access is denied.
OK, the pin P30 on the FTDI adapter might be the DTR signal and needs to be connected to the reset circuit of the 328P. When you start an upload and the serial port is opened, the pin is (temporarily) pulled low; this should results in a reset of the processor and as a result the boot loader will run.
2. Open IDE and select the COM Port properly. 3. From IDE Examples, open the Blink sketch and upload it into the target MCU. 4. After uplaoding, press the RESET Button and chcek that LED is blinking at 1 Hz.
In Device Manager on my computer, I right clicked COM 5 and went into advanced, changed it's name to COM100. I also figured out that the programmer had to be ArduinoISP.
I programmed the Atmega328 and grounded PIN 1 resulting in a successful upload.
The second problem seems to have been with 1 of my 3 Atmegas. It started working after burning a new bootloader.
I have no idea why I need to use ArduinoISP as programmer, I'm pretty new to this still. I read online to use it as a possible solution and it worked. I just tried again just to see if it actually does help and it gives me no errors, while Avrisp MKII does.
Strange that you would assume port issues to have nothing to do with uploading problems.
COM 5 was being used by some software blocking it from being used properly resulting in avrdude: ser_open(): can't open device ".\COM5": Access is denied.
I could have obviously gone through and checked what software was using it.
Changing it to a different name however, seems to have thrown whatever software that was using it off and therefore letting me use it for my intended purpose, without me having to search around.
Thanks for your suggestion, the FTDI I sent a picture of was from the manual but doesn't resemble the actual FTDI at all, which is very strange. My chip doesnt have the DTR signal anywhere where I can connect it. But using a cable to ground pin 1 works for me in the meantime