I am trying to program the atmega 328p mcu from Jaycar. This is the one with a bootloader installed and in a dip format.
I want to use the part number 018-usb-avr-isp from core. The mcu does not have the references mos1, sck or miso. It only has the reset and vcc and ground.
So what are those other pins connected to on the mcu? They must be the programming pins for the mcu?
Do you mean this one?
The MOSI, MISO, SCK pins on the Atmega328 are respectively 17, 18, and 19
There is a detailed schematic here for use with an Arduino as programmer, but you can use the same diagram for the USBASP/ISP
This setup is used to program a bootloader. You state that your chip already has a bootloader, so it’s not clear why you are using the USBASP/ISP. Are you trying to load a different bootloader?
To program user code for a chip that has the bootloader already installed you would use a USB to serial converter, or a MCU such as UNO that already incorporates a USB to serial converter.
Hi Peter,
Can you let us know a bit more about the hardware you already have?
The typical way to use an atmega328p is as part of a pro-built microcontroller. As Jeff has indicated you can build your own from scratch using the Jaycar part he has linked, but it is a rather bespoke option for someone wanting to custom build their own microcontroller.
For comparison, a 3rd party manufactured board that is compatible with the official Arduino Uno is normally less than $20 and allows you the convenience of programming it via USB and skipping the need for direct programming via the ISP interface.
Hi Trent, I have programmed the nano and uno boards via Arduino. The advantage of the uno board is that after programming the Atmega 328p you can remove it from the board and then use it on a solderless breadboard with the connected hardware, sensors etc.
The problem with the Atmega chip is the number of pins. Hard to unplug from the board and then plug in again to a breadboard without bending one or more pins. In most applications you only use one or several analog pins and digital pins.
The ISP refers to many different types of MCU chips. I imagine there are several there that have much less pins. They would be much easier to use on a breadboard. With the nano and uno you only have the Atmega 328p. Unless I am wrong here and you could plug in an MCU with lesser pins for the uno.
Still want to know what those unknown pins are on the ISP and how they connect to an Atmega MCU for programming it.
Hi Jeff, Please let me know which pins on the Atmega 328 are 17, 18 and 19. Can you give me the references actually shown on the chip. Which pins; rst,rx, tx, d3, a4 etc. or where is you numbering starting from?
I have tried a usb to serial converter to try to program the chip. No luck. Also seen the trouble someone else is having trying to program with this. He couldn’t do it also. So I want to program it with the USBASP/ISP. The bootloader as I understand it is just necessary to let you program the chip. It has nothing to do with the actual downloading of a program.
Hey Peter,
I have had to remove those chips in the past from a Uno and it is definitely a tricky thing to get done.
I have found the chips pinout diagram for you below for the numbering of the pins and associated functions:
I think other MCus may work as the Uno itself can be configured to act as an FTDI programmer, though it will be based on the pinout of the chip itself and it would have to match the necessary pins on the board. Though its not something I can ever say I have tried to do using the port that the pin would normally sit in.
Cheers,
Blayden
If you hold the chip with the indent pointed to your left, you can count the pins going anti-clockwise from bottom left. In Arduino IDE terminology they are D11-MOSI, D12-MISO and D13-SCK. The Jaycar image is not good enough to be able to indicate what labels have been used - they could also be PB3, PB4 and PB5 respectively.
You are correct that the bootloader is necessary to let you program the chip, but it has everything to do with the actual downloading of a program. The Arduino IDE knows how to communicate directly with the bootloader in order to identify the chip, ensure that it is set up correctly and negotiate the whole process of downloading your program and restarting the chip.
If you don’t want to use the bootloader you can override it with your own code using the in-built programming mode, accessed with the ISP interface. This is a completely different protocol that is much more complex than just using the IDE and the UART interface via the bootloader. The simplification of the download procedure via the UART is the point of providing the chip with the bootloader pre-installed.
I would strongly recommend that you go back to the USB to serial converter and try to download a simple program such as the blink, using the bootloader. However, starting from a bare chip is going to add an extra layer of difficulty, because you really need to know that you have it set up and running correctly before trying to do a download.
Most bare chips that have the bootloader already installed also have the blink program installed. You could try adding a resistor and a LED to D13 (PB5/SCK/PCINT5/Pin19) and see if you can get it to blink. That would confirm that it is working properly. It’s worth a try, even though failing to get it to blink will not prove that it isn’t running, because you don’t know whether or not the blibk program has been loaded.
Once you are sure that the chip is running correctly, if you have difficulty programming it using the USB to serial interface it is likely that the problem can be easily identified and resolved.
Hi Blayden, Thanks for that. I now see in very small printing on my Atmega 328p mcu d13=sck,d12=miso, d11=mosi.
This is the chip from Jaycar with the bootloader already installed. Now if I order the usb isp avr programmer from Core I may be able to program it by downloading the code from the Arduino ide.
Hi Peter,
I’m with @Jeff105671 here, although you could buy that ISP programmer and bypass the bootloader to program your ATmega you don’t really gain anything by doing it this way if you already have a USB to serial converter which can utilise the bootloader you already have pre-loaded on the chip.
Using the ISP programmer just requires more configuration steps to go right to achieve the same outcome. This is partly why most modern microcontrollers have a USB interface built in, there is less configuration required to get your device programmed so you can get on with your project.
This is supposed to be a programmer. It has the usb connector for a laptop. Can I use an arduino ide program on my laptop to download a program to a atmega 328p dip mcu from Jaycar?
Some people are asking why I want to use this when there is a bootloader already on this chip. Apparently they think that this item is only to burn a bootloader. It is called a programmer for a reason.
You also need a driver for this device which I have already downloaded which is then used with this part which I don’t have yet.
I really need to know if somebody can tell me will this part let me program the atmega 328p chip from Jaycar? This chip has pins labelled sck,miso, and mos1 which correspond to labels on the part.
I don’t think anyone said it is only used to burn a bootloader. Burning a new bootloader is one thing it can do, and that is how it is mainly used in the hobby community. But a bootloader is just a program, and if you wanted to use the ISP interface to burn a different program, you can. You haven’t given any reason why you would want to do this, considering that it is much more difficult than just using the bootloader, the UART interface and the IDE.
There is a description of one way to use the ISP interface to program the ATmega328 here:
How to Program ATmega328p using ATMEL Studio & AVR ISP MKII | ee-diary
Here is another example:
How to Program an ATmega328 MCU on a Custom PCB | Custom | Maker Pro
It is also possible to use a UNO as the programmer:
Programming an AVR ATmega328P with an Arduino (brennantymrak.com)
Notice that the code for a simple blink program is somewhat different than the example sketch in the IDE.
Hi Jeff
I think peter23346 asked similar question on the same subject a few days ago. Last reply was yesterday.
Cheers Bob
Hi Peter,
I’ve merged your two topics since they are asking the same question.
Jeff has answered the topic well, I’d also take a look at the Arduino docs for more info on the bootloader:
and for info on programming directly, overwriting or bypassing the bootloader with a programmer board:
If you have any questions about either option (programming or bootloading), let us know, but generally uploading with a usb-to-serial converter is going to be a lot easier from my perspective