login

Author Topic: Programming directly with ISP  (Read 2877 times)

0 Members and 1 Guest are viewing this topic.

yombo

Programming directly with ISP
« on: December 10, 2011, 03:02:49 PM »
Hi there!

I'm the guy that made the wiki article about bootloading a 1284.

Is it possible to upload a sketch to a micro directly with ISP? I mean to upload a sketch to a board using another board (Duemilanove) and the Wiring ISP sketch. For now I've been only able to upload bootloaders..

If not, what other ways are there to do it?

When my robot is started, it moves its wheels while the bootloader is running (about 2 seconds) before my sketch gets the control of the wheels. That's why I want to program with ISP and get rid of the bootloader.

Thanks

bhagman

Re: Programming directly with ISP
« Reply #1 on: December 10, 2011, 04:08:35 PM »
There is a way to program via avrdude through WiringISP, but it's not available in the IDE yet (other than uploading the bootloader).  In the next version of the IDE, we hope to have a way to select the upload method.

You could modify the bootloader to stop moving the motors (whatever control you're using - e.g. if it's an H-Bridge enable control, just define those outputs in the bootloader such that they disable the H-Bridge).

yombo

Re: Programming directly with ISP
« Reply #2 on: December 10, 2011, 08:43:35 PM »
I only have the .hex of the bootloader, where can I find the sources? And, can I compile them with Wiring?

Thanks

bhagman

Re: Programming directly with ISP
« Reply #3 on: December 10, 2011, 11:29:29 PM »
You can find the bootloader source under hardware/Wiring/bootloaders.

You can't compile it within the IDE (yet?).  You'll need to compile it from the command line using "make".

yombo

Re: Programming directly with ISP
« Reply #4 on: December 12, 2011, 08:10:09 PM »
I've executed 'make' in hardware/Wiring/bootloaders/build

It has generated some files, and a .hex named WiringBoot_arduino-328p-16MHz.hex

Okay, but I'm using a bare atmega 1284 on a breadboard :)

So i need to generate the WiringBoot_ATmega1284_16MHz.hex, how can I tell it to do that?

(I suppose that the file then needs to be copied to hardware/Atmel/bootloaders/, is that right?)

Thanks.

yombo

Re: Programming directly with ISP
« Reply #5 on: December 20, 2011, 04:22:04 PM »

The make tool compiled the bootloader ok, but how can I tell it to build the atmega 1284 bootloader?

Thanks

bhagman

Re: Programming directly with ISP
« Reply #6 on: December 22, 2011, 12:00:28 AM »
Did you use this to make the bootloader?

Code: [Select]
make atmel-1284-16MHz
If so, then you should have a file in the build folder named WiringBoot_ATmega1284_16MHz.hex

yombo

Re: Programming directly with ISP
« Reply #7 on: December 22, 2011, 04:52:39 PM »
It worked perfectly!

About the H-bridge, it has 2 PWM inputs and 2 'direction' inputs (it is made with 4 TC4422/21 MOSFET drivers, a 74LS04 and a 74LS08), so I put all the four signals to 0 with these lines in the main method:

Code: [Select]
  *(PORT_TO_DDR(PORTB)) |= 0x1E;

  PORTB &= 0xE1;

(the signals are tied to PORTB1..4, pins 2..5)

Thanks

bhagman

Re: Programming directly with ISP
« Reply #8 on: December 22, 2011, 10:54:02 PM »
Yep, sounds good.  I did the same with our Rogue Robotics rEDI board with LCHB (H-Bridge board).  The bootloader keeps the enable pins low to disable the H-Bridge during upload.

blog

Re: Programming directly with ISP
« Reply #9 on: February 24, 2015, 04:11:15 AM »
It has generated some files, and a .hex named WiringBoot_arduino-328p-16MHz.hex

Okay, but I'm using a bare atmega 1284 on a breadboard :)

So i need to generate the WiringBoot_ATmega1284_16MHz.hex, how can I tell it to do that?