Arduino Single-Sided Serial Board (version 3)

I built my own Arduino Single-Sided Serial Board (version 3) using an Atmega8-16 Pcb is powered via 13vdc wall wart. C9 is suppose to be a 10uF electrolytic non-polarized. I made my own by connecting two 22uF electrolytics neg to neg then the postive ends going to the two connections for C9. Old timer's trick. All voltages look good. I loaded arduino12's bootloader for the Atmega8 via ISP using AVRISP II USB clone with AVR Studio4. When I reset the arduino, led on pin 13 blinks 8 times and pauses for awhile then blinks 8 times and just continues to cycle this way. I assuming the bootloader worked. However, when I try to connect via com port 1(set at 19200 8,N,1 and upload to i/o board with the blink script I get :

avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

And it says "Problem uploading to board".

There is never any TX or RX led activity. I have the jumper set for "serial enable" And tried with and without jumper for " auto reset".

Any help would be appreciated.

Try to upload the sketch through ISP (upload without bootloader procedure). If it works, the problem can be: - com port - serial cable (it is necessary at least pins 2, 3, 4 and 5 on DE-9 cable connected) - serial to ttl converter circuit (you can use a 10uF polarized cap, with + to the gnd instead of a polarized one or your 2x22uF inverted series trick) - and check all other components and soldering.

Adilson, I'll give it a try. I will replace the cap with a 10uf polarized as you said. I will let you know how it does.

Thank you for your response.

Okay, replaced C9. Removed serial enable jumper and auto reset jumper. Open, verify/complied, "blink" sketch. Reset arduino, i/o upload. Error I receive is still: Binary sketch size: 894 bytes (of a 7168 byte maximum)

avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Atmega8-16 bootloader still on and flashes pin 13 led 8 times.

Tried another reset to see if "blink" would work. It just stays in bootload mode cycling 8 flashes,pauses for awhile, and repeats.

Could I have a driver problem?

I have AVRStudio 4 installed along with arduino12 which has avrdude.

Please advise.

Also, did you see my post at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1228934474

?

Have you reloaded the bootloader?

Also I would try a simple Serial example with: Serial.begin(9600); Serial.println("Hello world") ;

etc. And load the generated hex file via isp and see what happens.

Also, do any other devices work with com1?

Check if you selected the righ port -> go to serial monitor and send some text (whatever) to arduino. You shuold see a led blink, if recieve works.

Have you tryed it without auto-reset? remove the jumper, click Upload to i/o board, wait for two seconds and press reset button. Works for me, as auto reset feature works so-so :-[

Bosco,

do not remove the serial enable jumper, if you upload using serial connection.

Did you try uploading the sketch using the ISP connection?

And thanks for the corrections.

Serial port Okay, I discovered that the npn and pnp transistors I used(2n4124+2n4126) were in backwards. Their pinouts are the exact opposite of the ones called for. EBC instead of CBE Put in two new ones. I was getting -9v and -2v now I am getting -10v -4.5v.(measured at r1 and r2) That -2v was in the noise range for rs232 standard. Coml port 1 set to 9600 8,1,n So now I can see the rx led faintly blink when sending a sketch to the pcb. Verified all components for correct orientation and value. However, I still can't load a bootloader or sketch to the atmega8. Same error as before. Serial jumper installed and never removed. Also, trying to use clone avrispII to load anything from arduino12 doesn't work. My avrisp uses a prolific driver for usb.

The only thing I can do is startup avrstudio 4 using my avrisp (com 3 prolific usb drivers)plugged into the arduino sssb(serial jumper removed) and program the atmega8 with the bootloader hex file that is in ardunio12 folder. Not sure what fuses to set, but after programing my arduino it starts flashing 8 times as if the bootloader is working.

I also have a usb seedunio that works fine on com 4 using ftdi drivers.

Also,

The serial cable has all 9 pins wired and is a known good cable. Com1 on pc known to be working fine.

Did you try using manual reset instead of autoreset, like Odisej said?

Yes I did.

Okay, solved my problem. If you do not burn the bootloader with the right fuses and timing, it will give you a problem with using the serial port. Particularly with crystal setting. I found the info I needed here http://www.arduino.cc/playground/Learning/Burn168

Fuse settings for the Atmega8 and Atmega168. A lot of these questions could have been avoided, if this was made clearer in the beginning. It would be nice to put it in the text of the code of the bootloader. It would be less confusing if all of the codes written have this implemented. As I am new to the programming world, I did learn a lot about building and installing the software.

Thanks to everyone for helping me.

Adilson, after I replaced the transistors, I went back and replaced C9 with my homemade non-polarized cap. With the correct fuses bootloader, serial port works great. I am now seeing both TX and RX leds flash. Thanks for your help

Well, I didn´t know you set the fuses manually. I thought you just burn the bootloader. This (changes in fuse settings) caused difficulties in help you. I' m happy you found the problem. Good Luck in your projects.

The "burn bootloader" function in arduino does set the fuses appropriately for the standard arduino design. From the comments made, I suspect he may have deviated from the design and used something other than a 16MHz crystal...

-j

I am using a 16mhz crystal.

Also,

"I loaded arduino12's bootloader for the Atmega8 via ISP using AVRISP II USB clone with AVR Studio4."

I did this because at the time the serial port wasn't working with Arduino 12.

I did not realize that the hex file would set the fuses correctly.

Is this always the case?

But wouldn't it be advantageous to comment this in the code? pde , c, files?

Just burning the bootloader won't necessarily set the fuses at all if you burn it manually (e.g. with avrdude) If you use the arduino IDE to burn it, it sets the fuses appropriately at the same time. You can decipher the settings in the hardware/bootloaders/XYZ/Makefile if you're not using the IDE.

-j

Okay, I am looking at the makefile for the Atmega8.

I can tell the obvious:

Program name = ATmegaBOOT
Programmer = ISP STK500
(not sure what the dspeed 115200 is for)
Product = ATMEGA8
Serial Port Baud rate = 19200
ATMEGA8 speed = 16mhz

The rest is to cryptic for me to understand.
Where is the info for:

FUSES:
RSTDISBL (I no this needs to be off)
WTDON?
EESAVE?
BOOTSZ?
CKOPT?
BODLEVEL?
BODEN?
SUT_CKSEL?

LOCK BITS:
LB = (NO MEMORY LOCK FEATURES ENABLED)???
BLB0= (NO LOCK ON SPM AND LPM IN APPLICATION SECTION)???
BLB1= (LPM AND SPM PROHIBITED IN BOOT SECTION)

Makefile for ATmegaBOOT

E.Lins, 2004-10-14

program name should not be changed…

PROGRAM = ATmegaBOOT

PRODUCT=atmega8

enter the parameters for the UISP isp tool

ISPPARAMS = -dprog=stk500 -dserial=$(SERIAL) -dspeed=115200

#DIRAVR = /usr/local/avr
DIRAVRBIN = $(DIRAVR)/bin
DIRAVRUTILS = $(DIRAVR)/utils/bin
DIRINC = $(DIRAVR)/include
DIRLIB = $(DIRAVR)/avr/lib

MCU_TARGET = atmega8
LDSECTION = --section-start=.text=0x1c00
FUSE_L = 0xdf
FUSE_H = 0xca
ISPFUSES = $(DIRAVRBIN)/uisp -dpart=ATmega8 $(ISPPARAMS) --wr_fuse_l=$(FUSE_L) --wr_fuse_h=$(FUSE_H)
ISPFLASH = $(DIRAVRBIN)/uisp -dpart=ATmega8 $(ISPPARAMS) --erase --upload if=$(PROGRAM).hex -v

OBJ = $(PROGRAM).o
OPTIMIZE = -Os

DEFS = -DF_CPU=16000000 -DBAUD_RATE=19200
LIBS =

CC = $(DIRAVRBIN)/avr-gcc

Override is only needed by avr-lib build system.

override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -D$(PRODUCT) $(DEFS) -I$(DIRINC)
override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION)

OBJCOPY = $(DIRAVRBIN)/avr-objcopy
OBJDUMP = $(DIRAVRBIN)/avr-objdump
SIZE = $(DIRAVRBIN)/avr-size

all: $(PROGRAM).elf lst text asm size

isp: $(PROGRAM).hex
$(ISPFUSES)
$(ISPFLASH)

$(PROGRAM).elf: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

clean:
rm -rf *.s
rm -rf *.o *.elf
rm -rf *.lst *.map

asm: $(PROGRAM).s

%.s: %.c
$(CC) -S $(CFLAGS) -g1 $^

lst: $(PROGRAM).lst

%.lst: %.elf
$(OBJDUMP) -h -S $< > $@

size: $(PROGRAM).hex
$(SIZE) $^

Rules for building the .text rom images

text: hex bin srec

hex: $(PROGRAM).hex
bin: $(PROGRAM).bin
srec: $(PROGRAM).srec

%.hex: %.elf
$(OBJCOPY) -j .text -j .data -O ihex $< $@

%.srec: %.elf
$(OBJCOPY) -j .text -j .data -O srec $< $@

%.bin: %.elf
$(OBJCOPY) -j .text -j .data -O binary $< $@

Where is the info for: FUSES:

it's right here:

FUSE_L = 0xdf FUSE_H = 0xca

As for the meaning of individual bits, this online fuse calculator may help.

-j