Go Down

Topic: Another bootloader @ 3.3v & internal 8MHz clock w/SD card... (Read 2701 times) previous topic - next topic

xl97

Jan 04, 2013, 06:21 pm Last Edit: Jan 10, 2013, 07:39 am by xl97 Reason: 1
I am getting ready to start working on a project that will require the least parts (minimal circuit design).. and have very little room. (everything is SMD components)

that being said.. the choice of using a coin cell battery to directly power an Arduino board with bootloader for 3.3v and internal 8MHz clock was made.

I've played around with the schematic and pcb design a bit in Eagle... and getting closer to a finished/acceptable layout.

before I posted things for a review.. and sent out for a PCB'/parts..etc..

I order some breadboard equivalent parts  (328P dip.. resistors, caps, leds..etc).. everything to mimic the projects SD parts on a breadboard for prototyping..

and mainly because I have never built a standalone Arduino using 3.3v and internal 8MHz clock..

(breadboard Arduinos using 5v & 16MHz crystals I 'have' done though)..

I have read so many different tuts and post on this.. Im confused..

first.. I read that the ATMega 328P chips can be run down to 1.8v-5v in the datasheet...
Does this mean a coin cell battery that only has 3.0v will work.. if I have an Arduino set-up for 3.3v @ 8MHz?

Since the battery source I plan on using is well within the 1.8v-5v threshold...  (and room is so tight).. there is no vReg on board..I'll have some caps to couple it.. but other than that.. just battery 3.0v to chip.  (I believe most coin cells are 3.0v thats all.. I think they 'do' make 3.3/3.6v ones though if it is NEEDED)



So Im here to get some concrete info on the best way..

1.) Using Arduino Duemilanove 2009 board
2.) Using Arduino IDE (v.23..but I have 1.0 installed)



is it best to try and use the IDE? Arduino as ISP?  ...or does Optiloader sketch 'also' do 3.3v @ internal 8MHz clock set-up?
** I have used Optiloader sketch in the past to loaded to my Arduino 2009 board..  wire up my custom boards.. and Optiloader just 'does its thang'.... when I see fuse settings set back.. I know done/ok..

I have NO CLUE how to go about to any sort of settings or special bootloader 'choices' with Optiloader? (if its even possible)


I have read that 328P chips come set-up as 3.3v & 8MHz ready from factory?  but then have read all sorts of threads where things didnt/dont work as planned (or ever...sometimes they manage a bootloader..but cant upload sketches?)  LOL  I plan on using an 'FTDI' cable (RX/TX) to upload my sketches in the end.

* Do both the DIP and TQFP chips come this way?
* Do I need to have a crystal setup/installed INITIALLY to burn a bootloader? (3.3v/8MHz bootloader is target)
* Do I need to power the chip from the Arduino 2009 board from the 5v? or the 3.3v? when flashing bootloader?

Layout is minimal deisgn, with RESET/DTR pins broken out along with ICSP and SERIAL pads broken out only...
resistor on reset pin,
cap on DTR..
and caps on the VCC1, VCC2, AVCC & AREF pins..
cap on +3v & GND lines for the micro SD socket..
couple small SMD leds with matching resistors

all of this on a small breadboard to mimic the final set-up..

in the end the tiny pcbs will be assembled and the bootloader flashed.. and the sketch uploaded all done on the finished pcb..etc

so Im trying to walk myself through any hiccups or things i need to know ahead of time.




Approach A:  (Arduino IDE/Arduino as ISP)

* Open IDE
* Tools >> Board >> Arduino Duemilanove 2009
* Tools >> Serial Port  >>  (choose correct one)
* Upload the ArduinoISP sketch  (Files >> Examples >> Arduino ISP)
* Wire up my 'target' board that is just what is outlined above.. (no vReg, no Crystal/caps..just a few coupling caps on some pins and the battery input lines..)


* This step Im a bit confused..  I have read I am to go to:  Tools >> Board >> and choose ""ATmega328 on a breadboard (8 MHz internal clock)"..   but I dont see that anywhere in my list of choices..  I have also ready soem reccommend use Lilypad?  (but im not clear if thats 3.3v & INTENRAL 8MHz clock? or what)..


* Tools > Burn Bootloader > w/ Arduino as ISP





Approach B:  (Optiloader?)

no clue if possible or how to go about doing it if it is..


thanks!!!




johnwasser

> I have read that 328P chips come set-up as 3.3v & 8MHz ready from factory?

It comes set to use the internal 8MHz oscillator and a pre-scaler of 8 so the factory operating frequency is 1 MHz.

The "Speed Grade" chart in the datasheet shows three data points:
   4 MHz and 1.8V
   10 MHz at 2.7V
   20 MHz at 4.5V

"Maximum Frequency vs. VCC curve is linear between 1.8V < VCC < 2.7V and between 2.7V < VCC < 4.5V."

3.0V is plenty to run at 8 MHz since 2.7V is enough for 10 MHz.

You will either need an 8 MHz bootloader or you will need to run a 16 MHz bootloader at half the baud rate.

You should probably include an ICSP header, unless you plan to program the bootloader BEFORE you solder the SMD processor in place.  If you have an ICSP header and an ISP device you don't really need a bootloader.  You can get a nice USBasp ISP device for less than $5 via eBay.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

xl97

That was part of the question..

what bootloader to use that is FOR SURE 3.3v "&" internal 8MHz clock...

Lillypad?  (doesnt say internal 8MHZ clock)..

I found the breadboard.txt file (finally)...

so Im going to now assume that is the only/correct one to use..

In the end I will attempt to put some ICSP 'pads' on the pcb.. no headers.. no through holes..  (not enough room)..

I 'want' to use a bootloader...  I do not want to fool around with any AVRDude.. or other ways of flashing/uploading....etc

I want to keep it simple and user freindly..

that means regular USB/Arduino IDE...

and for bootloader.. my simple FTDI USB >> TTL cable

:)

what I have and what has worked for me so far.. ;)



I still am not clear on my questions though..

I have read many threads with conflicting info..


1.) DO YOU or DO YOU NOT need to have a 16MHz crystal/caps set-up to burn a 3.3v/8MHz bootloader?  (just yesterday someone was posting on this..and he could only do it with full set-up/parts... otherwise errors?)

This will NOT be possible.. unless I flash all chips before using them assembly.. (not very practical.. to flash or test after for 328TQFP chips)

2.) DO I need to power the board with +5v or with +3.3v to flash bootloader?


etc..etc..


thanks!


man,.. I didnt even get this porject last night.. as Im 'STUCK' on this nightmare of a PROBLEM here:
http://arduino.cc/forum/index.php/topic,140502.msg1057856.html#msg1057856

both schematic and brd layout posted..

powered by FTDI board works.. powered by battery +/- pads (and hence through the +5v regulator)..   power led and pin 13 led blinks like crazy!  together.. in tandem!

=(



johnwasser

> 1.) DO YOU or DO YOU NOT need to have a 16MHz crystal/caps set-up to burn a 3.3v/8MHz bootloader?

IF your processor is factory fresh you DO NOT need a 16 MHz crystal to (continue to) use the internal 8 MHz clock.

IF your processor HAS ALREADY been set to use a crystal clock (typically done when an Arduino bootloader is installed) you DO need to provide a clock:
     Crystal and load capacitors
     Ceramic resonator
     External clock injected through the X1 pin.

The serial programming hardware uses the system clock.  If the fuses are set to expect a crystal then the system clock won't run without a crystal or equivalent.  The clock doesn't have to be 16 MHz. Several people have made versions of ArduinoISP that provide an 8 MHz clock on Pin 9.  This can be connected to the X1 pin of the target processor the clock the target in the absence of a crystal.

This will NOT be possible.. unless I flash all chips before using them assembly.. (not very practical.. to flash or test after for 328TQFP chips)

> 2.) DO I need to power the board with +5v or with +3.3v to flash bootloader?

No.  Any voltage valid for the clock speed should work.  If you are clocking your target processor at 4 MHz you can program it at 1.8V.

NOTES: The bootloader doesn't care at all what voltage the processor is getting.  Neither does it care if the clock is crystal or internal.  Any "8 MHz" bootloader should run fine with the internal 8MHz system clock.  The "16 MHz" bootloaders will also work with the internal 8MHz system clock but the serial port baud rate calculations will be assuming a 16 MHz clock so the actual baud rate will be half the specified baud rate.  If you use the default bootloader for the UNO (optiboot_atmega328.hex) you will need a boards.txt entry that specifies "myboard.upload.speed=57600" instead of "uno.upload.speed=115200".
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

xl97

#4
Jan 10, 2013, 05:50 am Last Edit: Jan 10, 2013, 06:13 am by xl97 Reason: 1
Well I got some spare time tonight to try this out..

(re: 3.3v chip running @ internal 8MHz clock)..

and I pretty much got the same results I had read about.. although many maintain this 'should' work..

so maybe Im missing something? or overlooking something?..etc..

1.) brand new, ATmega 328P (DIP) chip form digikey (never been touched, no bootloader, factory should be 3.3v @ 8MHz internal clock)  (this is a test in a DIP to walk through the process..in the end this will be done on a SMD TQFP ATmega 328P chip)

2.) no crystal/no 22pF caps

3.) Arduino board pin   >>>  Target board pin
              D10       >>>>           RESET
              D11       >>>>           D11
              D12       >>>>           D12
              D13       >>>>           D13
              GND      >>>>           GND
              +3.3v     >>>>           VIN on breadboard...

(I have also tried to use the +5v output on the Arduino Duemilnove board to power the target board.. still no luck on burning a bootloader:

I get this message:  avrdude: stk500_getsync(): not in sync: resp=0x15

I read about shorting the REST on the MAIN Arduino board.. by using a 100Ohm resistor between RESET & GND..  did that.. still didnt work..

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



as 'anyone' really burned a +3.3v @ 8MHz (internal clock) bootloader to a blank/new chip.. using the Arduino IDE before?  and NOT have to install crystal/caps (even temporarily) to get it to work??


to recap the project.. her are some notes:

1.) the pcb's will be all assembled (SMD TQFP main chip).. before any bootloading and sketch uploading 'happen'  (why Im trying to walk though the process now and work out any kinks)
2.) the Arduino circuit is supposed to be 'minimum'.. I have several couplign caps on each VCC/AVCC/AREF lines..  (but Im too crowded.. I need to loose as many caps as I can)

Caps to keep:
* caps on VIN/GND...
* the 1 cap on the micro SD socket VCC/GND lines
* DTR cap
* RESET resistor

other coupling caps and the cap for the speaker line.. are under scrutiny currently.. as I need space to place some more solder pads..
what of the remaining caps is safest to get rid of and in what order?  


3.) has micro SD card on-board...  really only other component than minimal Arduino circuit.. idea is to run chip @ +3.3v/8MHz (INTERNAL CLOCK) .. so I dont need any lever shifting or voltage divider to use SD card.. (minimal components)


Here is a quick schematic of my circuit:


ANY ideas on what is causing problems for me NOT to be able to burn a bootloader to my new chips?


Im not even sure what else I can trouble shoot?

thanks!



update:
I read it wrong..

this:
I read about shorting the RESET on the MAIN Arduino board.. by using a 100Ohm resistor between RESET & GND..  did that.. still didnt work..

is supposed to be this:

I read about shorting the RESET on the MAIN Arduino board.. by using a 100-120Ohm resistor between RESET & +5v.. .. NOT GND!!!!!!!


follow the outlined steps above..and use the resistor in the CORRECT placement and you wont any trouble like I did!


thanks!






retrolefty

Quote
(I have also tried to use the +5v output on the Arduino Duemilnove board to power the target board.. still no luck on burning a bootloader:

I get this message:  avrdude: stk500_getsync(): not in sync: resp=0x15


What board selection did you use in the IDE just before you performed the burn bootloader option?

Lefty


xl97


Quote
(I have also tried to use the +5v output on the Arduino Duemilnove board to power the target board.. still no luck on burning a bootloader:

I get this message:  avrdude: stk500_getsync(): not in sync: resp=0x15


What board selection did you use in the IDE just before you performed the burn bootloader option?

Lefty




Hi Lefty-

I was editing my post as you posted...


I fixed/found the problem.. just another noob mistake on my end (do they ever end?)  LOL..

I had the resistors between RESET and GND originally and not RESET AND +5v..

I fixed that and got the breadboard-3.3v/8MHz internal clock bootloader flashed..


thanks!

retrolefty

Quote
I fixed/found the problem.. just another noob mistake on my end (do they ever end?)  LOL..


Take it from an old salt, they never end. At best one can hope for is that the mistakes are new ones rather then just repeating the same mistakes over and over.  ;)

Lefty

xl97

LOL..

I hope I dont get that bad...

but it just one after another..

got bootloader on (finally)..
go to test the micro SD using the SimpleSDAudio lib...

no joy... change to Arduino duemilanove 2009 board..  works fine.. breadboard - 3.3v/8MHz internal clock = no worky:

http://arduino.cc/forum/index.php/board,8.0.html

oh well at least I have been learning.. at the cost of my sanity!  :)


xl97

#9
Jan 10, 2013, 08:07 am Last Edit: Jan 12, 2013, 05:28 am by xl97 Reason: 1
ok..


well I updated the title.. :)

since I have the base +3.3v/8MHz internal clock Arduino going.....

I'll focus now on the two remaining issues at hand for this board:

1.) cant upload any sketches using IDE 1.0+.... I dont believe this is a board 'problem'.. just an IDE 1.0+ problem.. that needs some fixing, however I am not 'clear' on the fixes I read..

Confused on the correct directories I need to be working with..

I have a 'hardware' folder in my MAIN Arduino directory..

*   Arduino_1.0 >>
***   hardware >>
*****   arduino
*****   breadboard
*****   tools

and then I 'also' have a folder called 'hardware' in my sketches folder (that in My Documents >> Arduino)


* seems I need to add either an Arduino.h or a pins_arduino.h file to one of these directories?
* I need to edit my boards.txt file (the one located in the Arduino_1.0 >>> hardware >>> breadboard/boards.txt folder Im assuming?..not in My Documents >>> hardware >> breadboard/boards.txt




2.) (and this is probably the most important currently)  the SD card is NOT working.   :(

I have is set up as so:

SD PIN        >>>     Arduino
DAT2(9)        >>>      NOT USED
CD/CS (1)      >>>     D10
CMD/DI(2)     >>>      D11
VSS1/GND(3)  >>>     GND rail
VDD/V++(4)    >>>     +3.3v rail
CLK/SCK(5)    >>>     D13
VSS2/GND(6)  >>>     GND rail
DAT0/DO(7)   >>>     D12
DAT1(8)        >>>     NOT USED

I have a cap on VSS1 and VDD (+3.3v) pins.


this is an SD card 'adapter'... that I stick my micro SD cards in.. (I have soldered right angle headers on it, to fit in the breadboard.. this has worked before.. with lever shifters/voltage dividers, and Arduinos running @ 16MHz and +5v)

* I have tried many micro SD cards (at least 5)
* I have tried 3 different SD card adapter all with right angle headers that have worked in other non-minimal applications..

you think the software/libs need to be edited to work @ with a 8MHz board?

I was hoping/under the impression that using a bootloader that s native +3.3v & 8MHz internal clock would mean direct/easy interface with microSD?  :(

any ideas?


thanks!!



update:

SdInfo sketch gives this as my error message:

Quote
SdFat version: 20110902

type any character to start

card.init failed
SD errorCode: 0X1
SD errorData: 0X0


basically all sketches fail to init the card.. so Im 'missing' something..  :)

All voltages check out on the meter too.. (rails check out at +3.3v...  pins on chip are +3.3v...... pin on SD card is +3.3v...etc)




thanks for any suggestions on chasing this down!   :)



Go Up