This is for Stan and anyone else wanting to eliminate the bootloader on AVR Chips . Recently Stan posted on another thread ....
"I don't know if icsp works the same way for avr as pic. Seems if uchip usb dev boards have no bootloader then a usb to ttl converter connected to a 328p should work the same...or am I missing lots of stuff."
Generally speaking , a USB/TTL converter can only be used to program a chip with a bootloader. Most modern Microchip Dev boards have a PKOB (PICKit ON BOARD) PRogrammer that is basically another PIC that acts like a PICKIT.
To program an UNO with no bootloader or a bare Mega328P on a breadboard with no bootloader, a programmer is necessary. This can be one of many different programmers but can also be a Pickit 2.
An UNO or a bare m328p can be programmed from GCB using a Pickit 2. There is an entry in the Programmer Preferences titled "AVR Chips using PICkit2". However there is a typo in the commandline preferences.
The command line preferences read: -c pickit2 -p AT%chipmodel% -U flash:w:"FileName":i
It should instead read...... -c pickit2 -p AT%chipmodel% -U flash:w:%FileName%:i
The connections from the PICKIT 2 to the UNO are as follows.
That is very useful info, thank you for posting. Can info like this be permanent for others ie not lost in time and hard to find on the forum?
Nice explanation, ta again.
The 328p on my uno board can be 28 pin dil or a tiny square smd thing with more pins than you can wave a stick at.
I was thinking of ordering blank 328p from??? ebay? :)
I suppose I prioritise things and this on the list...after I sort my lander prog which is doin' my head :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"Generally speaking , a USB/TTL converter can only be used to program a chip with a bootloader. Most modern Microchip Dev boards have a PKOB (PICKit ON BOARD) PRogrammer that is basically another PIC that acts like a PICKIT."
In software as I only see the usb and pic.
It was a crap chip anyway...not enough ram to run an oled.
edit wrong pic, it's the other one.
Maybe I could transfer this fine Article to our Homepage.
Btw: Even I am posted very seldom in the last months, I am still reading and hopefully come more active next couple weeks )
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi bed. I think your gcb web home page is very good.
Would you like some of my projects to show things that gcb can do?
A mp4 file or youtube link address ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Before posting this as an article please allow me to add some more info, Specifically concerning the fuses and how to change them.
For example , you may want to use the internal OSC on an UNO or a bare m328p. This will free up the 2 IO pins required for the crystal. I have this running on a bare m328p on a breadboard right now all programmed with GCB and a Pickit 2. The internal OSC is not a accurate as a PIC but it can be after it is tuned. I am working on the tuning process as I write this.
Another thing to note is that the AVR processor operating at 8MHz executes instrucions as fast as a PIC operating at 16mhz. This reduces power requirements and is excellent for battery operated projects and extended battery life.
One other thing to note is that the Pickit2 programmer like many others cannot do HV Parallel programing, meaning that if you "brick" an AVR by setting the fuses incorrectly it cannot recover the microcontroller. I bricked one already in experimenting with all of this as I am not an AVR expert. However I made a cheap HV Recovery Programmer with an UNO and a few resistors and a single NPN transistor and was able to successfully recover the chip. I wil also provide the info on how to do this as time allows.
William
Last edit: William Roth 2020-02-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
don't break a leg!
Take time. Again thanks. Gcb is open source and people like you William put much into it.
Respect to all contributors to Gcb. The hardware device libs are so useful.
I wouldn't know where to start otherwise.
Little gems like your info are like gold. I've spent ages looking up past posts...not fun.
And do I need to go to github for latest gcb stuff? ...not moaning.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I read a 328p does an instruction every clock cycle but pics do an instruction every 4 clock cycles
so #chip 328p,16 will be as fast as #chip 18f25k22,64. I probably got it wrong as usual.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I like the usb uno/nano cos you can use the gcb teminal easy to serprint data.
not tried with uchip usb boards.
Using just a chip is not so easy I guess.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using just a chip on a breadboard is mostly all I do. It is not hard at all if you follow the datasheet and get the connections right. Even with an AVR.
For a Mega328p I connect a 16MHz crystal & the caps to the XTAL pins, put a 10K pullup on the reset pin, and connect the PK2 to the proper SPI pins and to the reset pin. Then good to go.
This is for Stan and anyone else wanting to eliminate the bootloader on AVR Chips . Recently Stan posted on another thread ....
Generally speaking , a USB/TTL converter can only be used to program a chip with a bootloader. Most modern Microchip Dev boards have a PKOB (PICKit ON BOARD) PRogrammer that is basically another PIC that acts like a PICKIT.
To program an UNO with no bootloader or a bare Mega328P on a breadboard with no bootloader, a programmer is necessary. This can be one of many different programmers but can also be a Pickit 2.
An UNO or a bare m328p can be programmed from GCB using a Pickit 2. There is an entry in the Programmer Preferences titled "AVR Chips using PICkit2". However there is a typo in the commandline preferences.
The command line preferences read: -c pickit2 -p AT%chipmodel% -U flash:w:"FileName":i
It should instead read...... -c pickit2 -p AT%chipmodel% -U flash:w:%FileName%:i
The connections from the PICKIT 2 to the UNO are as follows.
After the connections are made and the PK2 is powered up
the connections can be tested from within Synwrite/GCB by
clicking on GCBasic => AvrDude GUI.
At the top left select programmer as Microchip Pickit 2. The Port should be USB.
baud rate should be blank.
At the top right click on "Detect" . The output window should report
Now the GUI can be closed and the UNO Programmed with the PK2 set as the
programmer in Programmer Preferences.
Note: The PICKit 2 will not power the UNO after programming. An external power source
should be used and can be connected during programming.
Warning ! ....... Programing the UNO with this mehhod will erase the bootloader on the m328p.
However the PICKit2 can also burn the bootloader back on if needed.
Enjoy
William
Last edit: William Roth 2020-02-13
That is very useful info, thank you for posting. Can info like this be permanent for others ie not lost in time and hard to find on the forum?
Nice explanation, ta again.
The 328p on my uno board can be 28 pin dil or a tiny square smd thing with more pins than you can wave a stick at.
I was thinking of ordering blank 328p from??? ebay? :)
I suppose I prioritise things and this on the list...after I sort my lander prog which is doin' my head :)
"Generally speaking , a USB/TTL converter can only be used to program a chip with a bootloader. Most modern Microchip Dev boards have a PKOB (PICKit ON BOARD) PRogrammer that is basically another PIC that acts like a PICKIT."
In software as I only see the usb and pic.
It was a crap chip anyway...not enough ram to run an oled.
edit wrong pic, it's the other one.
Last edit: stan cartwright 2020-02-13
Maybe I could transfer this fine Article to our Homepage.
Btw: Even I am posted very seldom in the last months, I am still reading and hopefully come more active next couple weeks )
Hi bed. I think your gcb web home page is very good.
Would you like some of my projects to show things that gcb can do?
A mp4 file or youtube link address ?
Thanx.
Of Course, for the showcase i.E.
Simply email me.
I will try to do something that looks impressive :)
The post, by Bill, is a great post.
I would like to on the Website and in the Help.
:-)
Thanks Bill.
If I need to program a 328 or other type of Atmel device, I'll find this really useful.
To all,
Before posting this as an article please allow me to add some more info, Specifically concerning the fuses and how to change them.
For example , you may want to use the internal OSC on an UNO or a bare m328p. This will free up the 2 IO pins required for the crystal. I have this running on a bare m328p on a breadboard right now all programmed with GCB and a Pickit 2. The internal OSC is not a accurate as a PIC but it can be after it is tuned. I am working on the tuning process as I write this.
Another thing to note is that the AVR processor operating at 8MHz executes instrucions as fast as a PIC operating at 16mhz. This reduces power requirements and is excellent for battery operated projects and extended battery life.
One other thing to note is that the Pickit2 programmer like many others cannot do HV Parallel programing, meaning that if you "brick" an AVR by setting the fuses incorrectly it cannot recover the microcontroller. I bricked one already in experimenting with all of this as I am not an AVR expert. However I made a cheap HV Recovery Programmer with an UNO and a few resistors and a single NPN transistor and was able to successfully recover the chip. I wil also provide the info on how to do this as time allows.
William
Last edit: William Roth 2020-02-14
don't break a leg!
Take time. Again thanks. Gcb is open source and people like you William put much into it.
Respect to all contributors to Gcb. The hardware device libs are so useful.
I wouldn't know where to start otherwise.
Little gems like your info are like gold. I've spent ages looking up past posts...not fun.
And do I need to go to github for latest gcb stuff? ...not moaning.
Thumbs up!
Yes, I will wait, as I do not time for it next week anyway
It must take effort to make a web page for gcb.
It is appreciated.
Whatever your projects...may the force be with you.
I read a 328p does an instruction every clock cycle but pics do an instruction every 4 clock cycles
so #chip 328p,16 will be as fast as #chip 18f25k22,64. I probably got it wrong as usual.
I like the usb uno/nano cos you can use the gcb teminal easy to serprint data.
not tried with uchip usb boards.
Using just a chip is not so easy I guess.
Using just a chip on a breadboard is mostly all I do. It is not hard at all if you follow the datasheet and get the connections right. Even with an AVR.
For a Mega328p I connect a 16MHz crystal & the caps to the XTAL pins, put a 10K pullup on the reset pin, and connect the PK2 to the proper SPI pins and to the reset pin. Then good to go.
Diagram is attached
William
The circuit is saved. Thank you William.