Go Down

Topic: Program Ardunino Uno board via ISP connector. (Read 1 time) previous topic - next topic

eightbits2012

Hello, I just purchased the book by Simon Monk
Quote
"Programing Ardunino - Getting started with Sketches".

I have installed the Arduino application on a Linux (Ubuntu 12.04) PC and it seems to be working. But, I don't have a Arduino board yet. :(

One thing I am not clear on is the ISP connector located on the UNO board.
I am thinking that allows me to program the Mega328 device with a programmer that supports the AVR devices. I already have a Atmel STK-500 and have used it many times
to program several different AVR devices.
I think I can use my STK-500 ISP to program the Uno board with a non-Arduino file ?
In other words, a hex file generated from a my C compiler (ICCAVR).
If I can, I am sure that would delete the bootloader on the chip. But, I think I can use
the ISP to reload the boot loader via the  ISP?

Looking forward to getting a Arduino board to experiment with. One thing I do like is if
I can use my C compiler and the Ardunino boards, then that makes prototype work easier
by using the various shields that exist. Also, most projects (hobby) can be implemented
using the Arduino application.

Thanks in advance for any suggestions or comments.



As you are describing things, you just programming a AVR on a Arduino board.  It all works the same.


Above and to the right of the Atmega328 is the ICSP/SPI headers (2x3 male pins):

Pin 1  -   2
MISO  -  Vcc
SCK   -  MOSI
RST   -  Gnd

If you upload via Programmer, you will wipe the bootloader and only the sketch will be written.
http://www.spcomputing.com

CrossRoads

Yes and yes.
You can load a  hex file via ICSP with no bootloader.
You can load a bootloader at a later time via the ICSP.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Osgeld

I have never really looked, but doesn't the lock bits prevent overwriting the bootloader area when using external programming?
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL


I have never really looked, but doesn't the lock bits prevent overwriting the bootloader area when using external programming?


You forget the "Unlock Bits" ;)

Sorry, I had to...
http://www.spcomputing.com

eightbits2012

CrossRoads:
Quote
You can load a  hex file via ICSP with no bootloader.
You can load a bootloader at a later time via the ICSP.

Thanks for that clarification.

So, how would I load the Arduino boot loader into a a new M328 without a UNO board?
I see there is a drop down menu that accomplishes that but from within the Arduino application. I was thinking that I can program the boot loader via the ISP but not sure
the best way to do that without an actual Arduino board.

I was hoping that I could use a serial port and a Atmel programmer. If that is the case, is the bootloader available as a standard hex file that can program the chip via Studio and one of the Atmel devices as mentioned previously.Not sure if there is an actual hex file for the boot loader that I can program the device by using Studio. I do have the STK-500 and a Dragon as well. Once I receive a UNO board then it may be a little easier to answer these myself. :)
Once again, thanksto all  for the responses.





CrossRoads

What I normally do:
Connect Atmel AVR ISP MKii to the the SCK, MOSI, MISO, Reset, Gnd, +5 pins
(+5 supplied from elsewhere, other AVR ISPs can supply power, such as
http://www.mdfly.com/index.php?main_page=product_info&cPath=5&products_id=415
I've got at least 2 other AVR ISPs also but have never tried them)

Within the Arduino IDE:
Tools:Select Board: Uno (note: 5V with '328P)
Tools: Select programmer:AVR ISP MKii  (or MDFLY for example)
Tools: Burn Bootloader  -- this sets the fuses for Uno-compatible operation: 16 MHz ext crystal, whatever else it does

File: Upload using Programmer -  to load the sketch you have opened up with no bootloader

Can't get much easier than that.

Sketch then runs and assumes you have 16 MHz xtal, 22 pf caps, (or a 16 Mz resonator), 10K reset pullup resistor, 100nF caps on Vcc/AVcc to Gnd (and on Aref if using ADC)
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Scott Baker

When you do an upload (not using a programmer) does that include the bootloader? Or is that section of the flash just not written when you upload?

eightbits2012

OK. Is there a way to program the boot loader using Atmel Studio and theSTK-500 or Dragon?
I think I would have to have the boot loader hex file in order to do that without using the Arduino application(?).

Within the Arduino software, is the AVR ISP MKii the only programmer that supports the
ICSP programming for a non-Arduino board? All I have is the ST-500 and the Dragon.


If I can load the boot loader directly as a hex file no Arduino software, then where can I
get the hex file for the boot loader.

Sorry for the excessive questions.

CrossRoads

@scottbaker, Bootloader controlled Upload via USB/serial port does not rewrite the bootloader, only the sketch memory.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

@eightbits2012,
"OK. Is there a way to program the boot loader using Atmel Studio and theSTK-500 or Dragon?"
I don't know. I have loaded bootloader using MKii programmer, as that is what I  have.

"Within the Arduino software, is the AVR ISP MKii the only programmer that supports the
ICSP programming for a non-Arduino board?"
Umm, what is meant by non-Arduino board?
For example, I bootload ATMega1284 boards within the IDE using MKii and my bootloade, then download sketch method. That's technically a non-arduino board.
All the clones I make are technically non-Arduino boards, altho I program  them with Uno bootloader to capture the fuse configuration and then load my sketch, sometimes using USB/serial interface and sometimes using the ICSP interface.
For '328s, other programmers will work also, such as
http://www.mdfly.com/index.php?main_page=product_info&cPath=5&products_id=415

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

eightbits2012

OK. So, is there a boot loader hex file I can can use to program the boot loader
using a Dragon or the STK-500 ICSP feature? Not sure where to locate the actual boot
loader file .

Thanks

Osgeld

arduino-1.x\hardware\arduino\bootloaders
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

Go Up