Pages: 1 ... 3 4 [5]   Go Down
Author Topic: ArduinoISP Arduino uno & blank atmega8 bootloader burn trouble  (Read 6997 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18722
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For a minute there I thought "oh yeah, PBCAK" but then I got exactly the same error! Blech.

I recently improved the sketch to support Atmega8 or something and in the process some extraneous trailing 0xFF crept in. Now unfortunately some bootloaders don't upload correctly if you have a run of 0xFF in the sketch. I've removed then (the memory is initialized to 0xFF anyway) and now it uploads.

New version:

https://github.com/nickgammon/arduino_sketches

Short version: Now you should be able to upload Atmega_Board_Programmer.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Perfect - Thanks!  Working fine now
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Nick Gammon,

I tried using your bootloader programmer sketch for an Atmega8A device.  It did not work.  After some investigation I discovered that your sketch sends the Poll RDY/BSY* instruction in the pollUntilReady() function.  This instruction is not supported by the Atmega8A.   As a quick-and-dirty patch, I re-wrote pollUntilReady as follows:

Code:
// poll the target device until it is ready to be programmed
void pollUntilReady ()
{
  if (signatures[foundSig].pageSize < 128) {
    delay(12);
  } else while ((program (pollReady) & 1) == 1) {
    ;
  }
}  // end of pollUntilReady

With this change I was able to successfully program the Atmega8A.  Note that the delay value of 12ms is more than enough to cover the longest wait time specified in the datasheet.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18722
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well spotted! I thought they would all support that (it seems such an obvious thing) but obviously not.

I'll adjust the original sketch shortly.
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18722
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well the whole thing turned out to be more complex than I expected. You must have been lucky. smiley

With the fuses set for a 1 MHz internal oscillator I couldn't program it reliably at all. The amendments below not only add in the timed writes (as you suggested) but also fixes up the low fuse to make it use the 8 MHz oscillator, drops programming mode (to latch the change) and then presses on. It now seems to program OK.

https://github.com/nickgammon/arduino_sketches/commit/0467152985d

Logged


Pages: 1 ... 3 4 [5]   Go Up
Jump to: