Pages: [1]   Go Down
Author Topic: Arduino with 8MHz crystal  (Read 3753 times)
0 Members and 1 Guest are viewing this topic.
Durham UK
Offline Offline
Full Member
***
Karma: 1
Posts: 167
aka Craig Turner
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: April 12, 2012, 08:25:28 am by trendski » Logged

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)

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 203
Posts: 8722
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Durham UK
Offline Offline
Full Member
***
Karma: 1
Posts: 167
aka Craig Turner
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

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)

Durham UK
Offline Offline
Full Member
***
Karma: 1
Posts: 167
aka Craig Turner
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
##############################################################

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
« Last Edit: April 14, 2012, 09:08:17 am by trendski » Logged

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)

Offline Offline
Full Member
***
Karma: 0
Posts: 182
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Non possiamo pretendere che le cose cambino, se continuiamo a fare le stesse cose(albert Einstein )

0
Offline Offline
Edison Member
*
Karma: 8
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you burn the bootloader?
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 93
Posts: 3981
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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

* optiboot_atmega328_pro_8MHz.hex (1.43 KB - downloaded 60 times.)
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Durham UK
Offline Offline
Full Member
***
Karma: 1
Posts: 167
aka Craig Turner
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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


* xino.gif (36.09 KB, 300x300 - viewed 62 times.)
« Last Edit: April 17, 2012, 03:59:15 am by trendski » Logged

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)

Pages: [1]   Go Up
Jump to: