0
Offline
Newbie
Karma: 0
Posts: 30
Arduino rocks
|
 |
« on: April 30, 2011, 04:35:08 pm » |
I've been trying to get a super-minimal arduino going. I followed instructions in the following: http://arduino.cc/en/Tutorial/ArduinoToBreadboardhttp://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1290457012http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1290457012http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1163418637I've got the "ATmega328 on a breadboard (8 MHz internal clock)" board available, which, after some fiddling about contains this: atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)
atmega328bb.upload.protocol=stk500 atmega328bb.upload.maximum_size=30720 atmega328bb.upload.speed=57600
# internal osc: E2 / D9 / 07 # external: FF / DA / 05 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.file=ATmegaBOOT_168_atmega328.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
This seems to install correctly, the LED on pin 13 blinks after burning. The thing is, after doing that, I can't upload my sketch to the chip. I keep getting: avrdude: stk500_recv(): programmer is not responding I'm doing all of this on a duemilanove board, with an atmega328 (arduino-0018 on linux), and burning bootloaders with a USBtinyISP. I think it's possible the chip does start working with the 8Mhz oscillator, but programming doesn't work because there's a serial port speed problem. So my question is... has anyone ever got this going, and what boards.txt settings do I need?
|
|
|
|
|
Logged
|
|
|
|
|
Scotland
Offline
God Member
Karma: 3
Posts: 513
Have you had your Arduino fix today?
|
 |
« Reply #1 on: April 30, 2011, 05:52:41 pm » |
Try this :
Press Upload Wait for sketch size Tap RESET
Hope this solves your issues
Drew.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 30
Arduino rocks
|
 |
« Reply #2 on: May 01, 2011, 03:08:43 am » |
Thanks for the tip, but that doesn't work either. It looks like the board is automatically resetting on upload anyway, but even throwing in a manual one doesn't seem to work.
I've seen notes about calibrating the resonator for serial, which I'd really like to avoid if possible. However, I've tried setting the upload baud rate to other values (down to 9600) which didn't seem to work either. Is it possible that the speed negotiation is failing because it's miscalibrated at the chip end? Is there a way to burn a bootloader that only listens at 9600 or something?
|
|
|
|
|
Logged
|
|
|
|
|
Lancashire, UK
Offline
Edison Member
Karma: 8
Posts: 1988
|
 |
« Reply #3 on: May 01, 2011, 03:13:43 am » |
Herein lies the reason I gave up to running a homebrew arduino at anything other than 16 Mhz.
The addition of a cheap 16 Mhz resonator saves acres of grief......
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 30
Arduino rocks
|
 |
« Reply #4 on: May 01, 2011, 06:07:27 am » |
One thought... is it possible to upload a program to the chip using my USBtinyISP burner? If I could do that, I could probably just do that to get my code onto the chip and avoid the serial port altogether (although I guess it would probably work at 9600, if I needed it for debug). This probably isn't a decent solution for everyone though...
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 15
Arduino rocks
|
 |
« Reply #5 on: May 03, 2011, 02:29:34 pm » |
Gotta say...tapping reset at just the right moment never worked for me. I agree with the poster who says to just use the caps and oscillator and use the chip that way. It isn't that big a deal to include them in the circuit and saves some grief. I did however resort to uploading the program using an arduino, popping the chip out and sticking it into my breadboard- it worked. Never did resolve the uploading directly to the breadboarded chip issue.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 30
Arduino rocks
|
 |
« Reply #6 on: May 03, 2011, 03:10:20 pm » |
This appears to be pointing to "use a crystal", but that's a shame because it seems silly to put in a 16Mhz crystal and scale it down to 8Mhz (or less), especially as there's an 8Mhz oscillator right there in the chip, which would save a few (admittedly cheap) components. That said, any advantage is lost if it doesn't work!!
On the matter of tapping reset, I have made this work successfully on a breadboard (so long as I have a nice 16Mhz crystal!). I'm not sure if it's the secret of my success, but a pull-up resistor on the reset pin seems to be useful, and then just tap it with a grounded wire.
All that said, getting the program onto the chip by USBtinyISP could solve a few other problems, so it's still something I'd like to do (regardless of what clocking I end up with).
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 118
Posts: 10158
|
 |
« Reply #7 on: May 03, 2011, 04:31:44 pm » |
It does work. But it requires some effort from you.
The internal oscillator is tuned to ±10% from the factory. At about ±4.5% serial communications stops working reliably. The oscillator can be easily tuned ±1%. To get your Sketch running at the calibrated value is trivial. This single line of code is all that needs to be added to setup...
OSCCAL = TuningValueForThisProcessor;
The problem is that the bootloader needs to do the same thing; set the OSCCAL register.
|
|
|
|
|
Logged
|
|
|
|
|
"The old Europe"
Offline
Edison Member
Karma: 0
Posts: 2003
Bootloaders suck!
|
 |
« Reply #8 on: May 03, 2011, 04:53:53 pm » |
I have several projects with 'bare' ATmega168 chips that happily run on the internal RC oscillator and 'optiboot_pro_8MHz.hex' works quite ok with these. There are some chips that don't accept uploads on the first try though. Warming them up a bit seems to help. Changing the OSCAL registers might help, but it changes with temperature anyway.
If you need async (uart) inter-board communication, better use a quartz.
|
|
|
|
|
Logged
|
• Upload doesn't work? Do a loop-back test. • There's absolutely NO excuse for not having an ISP! • Your AVR needs a brain surgery? Use the online FUSE calculator. • My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets... • Microsoft is not the answer. It is the question, and the answer is NO!
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 30
Arduino rocks
|
 |
« Reply #9 on: May 04, 2011, 02:50:57 am » |
Thanks for the info guys. I'll hack about a bit more (mostly for curiosity). I think the answer seems to be that for "safety"/simplicity having a crystal seems to be the best thing to do. Whilst I probably only need serial at 9600 (and even then only rarely), I don't want to have to wait for the chip to warm up before programming or whatever.
Thanks everyone for your inputs - it's been really useful.
|
|
|
|
|
Logged
|
|
|
|
|
France
Offline
Sr. Member
Karma: 5
Posts: 367
|
 |
« Reply #10 on: May 04, 2011, 12:09:23 pm » |
Isn't the bootloader you're using compiled to run at 16MHz? I only have experience with Optiboot, but it looks like there's an 8MHz version of ATmegaBOOT supplied with IDE v0022. Try changing these two lines in boards.txt:
atmega328bb.bootloader.high_fuses=0xDA atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 30
Arduino rocks
|
 |
« Reply #11 on: May 04, 2011, 02:36:09 pm » |
Not sure how I missed that one, but either way, it doesn't seem to work either. Looks like I'm out of luck :-(
|
|
|
|
|
Logged
|
|
|
|
|
Around St. Louis
Offline
Jr. Member
Karma: 0
Posts: 72
|
 |
« Reply #12 on: May 20, 2011, 05:15:01 pm » |
Anyone figure this out fully?
I ask because I'm working on trying to make a 1inx1in arduino circuit using the 328p (smd), and while I have all 20 output pins, and it could be programmed through ftdi and a breadboard, I forgot to put in a crystal, and after diodes, voltage regulator and capacitors for the vreg, I'm out of space. Using the internal 8mhz would be amazing. Unfortunately, I have absolutely no place left for the crystal, as it was tricky just getting all 20 pins, 4 grounds, and the input voltage/ground on the circuit with the limitations of the pcb process sizes (I use 8mil spacing to be safe)
|
|
|
|
|
Logged
|
|
|
|
|
"The old Europe"
Offline
Edison Member
Karma: 0
Posts: 2003
Bootloaders suck!
|
 |
« Reply #13 on: May 20, 2011, 05:41:48 pm » |
What is the problem ;-) I do this on a regular basis with ATmega168 chips using the 8MHz optiboot running at 115200. And it even works most of the time. RGBLedRing2.name=RGB LED RING - ATmega168 / 8MHz RC OSC / optiboot Bootloader RGBLedRing2.upload.protocol=stk500 RGBLedRing2.upload.maximum_size=15872 RGBLedRing2.upload.speed=115200 RGBLedRing2.bootloader.low_fuses=0xE2 RGBLedRing2.bootloader.high_fuses=0xDD RGBLedRing2.bootloader.extended_fuses=0x04 RGBLedRing2.bootloader.path=optiboot RGBLedRing2.bootloader.file=optiboot_pro_8MHz.hex RGBLedRing2.bootloader.unlock_bits=0x3F RGBLedRing2.bootloader.lock_bits=0x0F RGBLedRing2.build.mcu=atmega168 RGBLedRing2.build.f_cpu=8000000L RGBLedRing2.build.core=arduino
You'll have to adjust the fuse-settings, target and maximum_size. And don't forget the 100nF capacitor and 10k pull-up on the reset line to make the auto-reset work.
|
|
|
|
« Last Edit: May 20, 2011, 05:43:44 pm by madworm »
|
Logged
|
• Upload doesn't work? Do a loop-back test. • There's absolutely NO excuse for not having an ISP! • Your AVR needs a brain surgery? Use the online FUSE calculator. • My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets... • Microsoft is not the answer. It is the question, and the answer is NO!
|
|
|
|
|