Go Down

Topic: Arduino with 8MHz crystal (Read 4385 times) previous topic - next topic

trendski

Apr 12, 2012, 02:08 pm Last Edit: Apr 12, 2012, 03:25 pm by trendski Reason: 1
Hi,

I built a barebones board which I want to program using an FTDI cable in the Arduino environment. When I try to upload programs the IDE fives a sync error message. Is that due to the 8MHz crystal ? Do I need to change some settings somewhere to take account of the different crystal ?

I had a look on playground and there was an article which said change preference.txt, but I couldn't find the crystal freq in that file.

Thanks
Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

johnwasser

What board do you have selected under Tools->Boards?  You should select an 8 MHz board.  If none of the existing 8 MHz boards matches your breadboard you should write your own boards.txt file to add your breadboard.  Maybe something like this but with setting for a crystal:


##############################################################

atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)

atmega328bb.upload.protocol=stk500
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.speed=57600

atmega328bb.bootloader.low_fuses=0xE2
atmega328bb.bootloader.high_fuses=0xD9
atmega328bb.bootloader.extended_fuses=0x07
atmega328bb.bootloader.path=arduino:atmega
atmega328bb.bootloader.file=ATmegaBOOT_168_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F

atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino:arduino
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

trendski

Hi,

I'm using atmega328PU with a 8MHz crystal. IDE Arduino 0022 and none of the boards on list match. I'll try a custom board definition as you suggest.

Many Thanks

Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

trendski

#3
Apr 14, 2012, 01:25 pm Last Edit: Apr 14, 2012, 04:08 pm by trendski Reason: 1
Hi, I had  a stab at doing a custom board in boards.txt.

Although My board has an external crystal I decided to try (for now) 8MHz internal clock. I used ADABoot (I think it uses internal clock 8MHz - but this could be wrong)
I have set the fuses for 8MHz internal clock using AVRstudio 4. I then tried this board in boards .txt

I put the ADABoot_328 HEX file in the file path: /atmega328.bootloader.path=atmega. I used a low baud rate for safety (9600). Set Baud for cable at 9600 also.

Code: [Select]
##############################################################

atmega328x.name=Arduino Xino w/ATmega328-PU 8MHz internal clock

atmega328x.upload.protocol=stk500
atmega328x.upload.maximum_size=30720
atmega328x.upload.speed=9600

atmega328x.bootloader.low_fuses=0xFF
atmega328x.bootloader.high_fuses=0xDA
atmega328x.bootloader.extended_fuses=0x05
atmega328x.bootloader.path=atmega
atmega328x.bootloader.file=ADABoot_328
atmega328x.bootloader.unlock_bits=0x3F
atmega328x.bootloader.lock_bits=0x0F

atmega328x.build.mcu=atmega328p
atmega328x.build.f_cpu=8000000L
atmega328x.build.core=arduino

##############################################################


It still doesn't work with cable. Still getting sync error in IDE.

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

Am I on the right track?

Thanks
Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

nikone


What board do you have selected under Tools->Boards?  You should select an 8 MHz board.  If none of the existing 8 MHz boards matches your breadboard you should write your own boards.txt file to add your breadboard.  Maybe something like this but with setting for a crystal:


##############################################################

atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)

atmega328bb.upload.protocol=stk500
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.speed=57600

atmega328bb.bootloader.low_fuses=0xE2
atmega328bb.bootloader.high_fuses=0xD9
atmega328bb.bootloader.extended_fuses=0x07
atmega328bb.bootloader.path=arduino:atmega
atmega328bb.bootloader.file=ATmegaBOOT_168_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F

atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino:arduino


copy this in your boards.txt file and you'll have the new board in the board menĂ¹
hi nk
Non possiamo pretendere che le cose cambino, se continuiamo a fare le stesse cose(albert Einstein )

florinc

Did you burn the bootloader?

Jack Christensen

I've been using the attached 8MHz version of Optiboot.  I modified the boards.txt entry for the 8MHz Pro Mini as follows. Also see similar thread here.

Code: [Select]
pro328.name=Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328

pro328.upload.protocol=stk500
pro328.upload.maximum_size=32256
pro328.upload.speed=57600

pro328.bootloader.low_fuses=0xFF
pro328.bootloader.high_fuses=0xDE
pro328.bootloader.extended_fuses=0x05
pro328.bootloader.path=optiboot
pro328.bootloader.file=optiboot_atmega328_pro_8MHz.hex
#pro328.bootloader.path=atmega
#pro328.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
pro328.bootloader.unlock_bits=0x3F
pro328.bootloader.lock_bits=0x0F

pro328.build.mcu=atmega328p
pro328.build.f_cpu=8000000L
pro328.build.core=arduino
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

trendski

#7
Apr 17, 2012, 10:55 am Last Edit: Apr 17, 2012, 10:59 am by trendski Reason: 1
Many thanks to all for the input. The following board settings worked with the bootloader suggested by Jack.
http://proto-pic.co.uk/xino-basic-for-the-atmel-atmega-series-and-arduino/

Code: [Select]
xino328.name=Arduino xino (3.3V, 8 MHz) w/ ATmega328

xino328.upload.protocol=stk500
xino328.upload.maximum_size=32256
xino328.upload.speed=57600

xino328.bootloader.low_fuses=0xFF
xino28.bootloader.high_fuses=0xDE
xino328.bootloader.extended_fuses=0x05
xino328.bootloader.path=optiboot
pro328.bootloader.file=optiboot_atmega328_pro_8MHz.hex
xino328.bootloader.path=atmega
xino328.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
xino328.bootloader.unlock_bits=0x3F
xino328.bootloader.lock_bits=0x0F

xino328.build.mcu=atmega328p
xino328.build.f_cpu=8000000L
xino328.build.core=arduino


cheers
Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

Go Up