I am trying to make an arduino using mega8 mcu. After so much struggling with sync/response/signature problems and reading the previous questions, finally managed to do it (almost). However I still have some weird problems.
I uploaded the arduinoISP sketch to an Uno for programming the chips: AtMega8A-PU and AtMega8L-8PI (I had a couple of L version from years ago).
For bootloader selected the Mega8 from NG board in IDE 1.8.5 then uploaded to Mega8A-PU for the L version cloned the ng part in boards.txt and reduced the F_CPU to 8MHz, (same bootloader code) and uploaded to 8l
Now, I'm able to upload sketches to both using a usb-serial breakout board/ avrisp mkII.
my first problem is when I disconnect the converter board neither of the MCUs can start unless I pull up or pull down the RxD pin (#2) which i find accidentally. it seems they both stuck in bootloader part. even if i leave the reset pin floating (using internal pullup) and tie the rxd pin they work fine up on applying power (with like an annoying 15~16s delay). the resistor value I tried 1K and 10K but no difference in operation and delay time. it wont start with rxd open. I couldn't find why?
another question is running the code on mega 8L as reliable as on 8A? (need it for lower V)
More clarification: they both run with Xtals and 22pf caps on breadboard. the 8l also works fine with 16MHz Xtal at 5v.
sketch (I know it's not much of help):
void setup() {
Serial.begin(19200);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
tone(10,3520);
}
volatile unsigned int i, var = 1;
void loop() {
digitalWrite(9, HIGH);
for(i = 0; i < 1500; i++)
var += ((var * 3) / 2);
// do something (if compiler not wipe it for optimizing :D )
digitalWrite(9, LOW);
Serial.println(millis());
}
sample of 8A and (similarly) uno output:
7 11 15 19 23 27 31 35 39 44 48 52 56 60 64 68 72 76 80 84 89 93 97 101 106 110
8L output @ 3.3v @8MHz:
16 24 32 40 51 59 67 75 86 94 102 110
tone() output is the same for all
Appreciate your help
1 Answer 1
I found here: https://www.arduino.cc/en/Hacking/Bootloader?from=Tutorial.Bootloader
that NG / mega8 bootloader doesn't enable the rx pin internal pullup nor it gets out of the bootloader even if receiving junk data on rx (which was my case due to leaving it open thus floating). It also has a delay of 6 to 8 seconds intentionally.
Probably I'll use another bootloader since the link to source code on the page was broken or just program the L version without any bootloader and better fuse options.