Go Down

Topic: requirements and limits of 8Mhz 3.3v (Read 12314 times) previous topic - next topic

winner10920

Im planning on a project where I need the 328 with 3.3v and 8Mhz, im unsure on the requirements other than setting the ide to communicate with it
Can I run it directly off a 3.7v lipo? (4.1-2 fully charged and 3.5 when dead)
I know the fuses need to be changed for 8Mhz, but what selects the voltage,Or just as long as its slow enough to work at that voltage?

can I have the optibootloader work with it still or do I need to use isp everytime?
will usbasp work still even though its the old version and I can't change the sck period?
anything else I need to know?

johnwasser

If you burn an 8MHz bootloader on the chip you can upload sketches just like any other Arduino.  The voltage doesn't matter as long as it is high enough for 8 MHz operation.  You can run at 10 MHz on 2.7 V but 1.8V is only good for 4 MHz so something like 2.4V for 8 MHz?  Anything between 2.4 V and 6.0 V should work.

Arduino 1.0 doesn't seem to come with an 8 MHz version of the optiboot bootloader.  You may have to re-compile the optiboot bootloader for 8 MHz if you really need that.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp
See who has no social life: https://forum.arduino.cc/index.php?action=stats :)

winner10920

Would the sparkfun 8Mhz pro mini bootloader work?

JChristensen


Would the sparkfun 8Mhz pro mini bootloader work?


Yes it should. John is correct, though, an 8MHz version of Optiboot doesn't come with the IDE. I did recently recompile it for 8MHz, I've attached it in case you're interested.

winner10920

Awesome! Thank you, that saves me alot of time as im still just getting the hang of compiling and that whole process

winner10920

I changed the fuses to 8Mhz and uploaded that bootloader however the ide isn't talking to it... the board just doesn't respond
checking my fuses, I just did what the fuse calculator on the atmel page said for 8Mhz int osc reset enabled,  serial programming enabled
what can it be?
and btw how much slower does 8Mhz make millis? I have delay(250) and its like 16'hz delay(1000)

JChristensen

#6
Apr 13, 2012, 02:11 am Last Edit: Apr 13, 2012, 02:14 am by Jack Christensen Reason: 1
millis() should work the same for 8MHz or 16MHz boards. Post your fuses!

EDIT: What upload speed is in boards.txt? I use 57600. Couldn't get 115200 to work. The system clock is the 8MHz internal oscillator? May not be accurate enough for serial comm...

winner10920

Ill try the 57600 when I get home in a few, here's my fuses
Code: [Select]

avrdude -p m328 -c usbasp -U lfuse:w:0x62:m -U hfuse:w:0xd7:m

Delay(1000) seemed so long so I figured if I put it at 250 it'd come out to 500 but it seems to be 1000
millis() runs on a timer which is provided by the clock right? so millis should be 1/2 fast which would be easy to adjust in my programs because I have alot of timed stuff, but if its not 1/2 and some other number it'll be a bit annoying
im uploading the compiled blink sketch with the usbasp since the optiboot isn't working, I tried selecting pro mini and burn bootloader with the ide but it just blinks afterwards and doesn't respong, could be the timing again
If my atmega328 happens to be one of those at the end of +/- 10% off is there a baud rate that will accept that error? Is there a way I can adjust the calibration without a different programmer

JChristensen

#8
Apr 13, 2012, 02:41 am Last Edit: Apr 13, 2012, 02:44 am by Jack Christensen Reason: 1
0x62 is the default value for LFUSE, and has the CKDIV8 bit programmed, so the actual system clock is 1MHz. Try 0xE2 instead. Here's the boards.txt entry I use for 8MHz internal oscillator. millis() will be just fine and your source code should require no adjustments to delays or whatever. The f_cpu value is passed to the compiler, and the proper adjustments are made.

The bootloader could very possibly work. Not sure I've tried it, but I've done a lot of Serial.print debug statements on several 328Ps running on the internal oscillator (at 8MHz and 1MHz!) and have had little or no difficulty. Conclusion: They come pretty well calibrated from the factory! But there is a calibration byte that can be used to trim the internal oscillator to ±1%, it's just a couple sections down from the fuse byte in the datasheet. I haven't tried messing with it, but I believe it does not persist, so your code has to set it after each reset or power-on.

Code: [Select]
m328pi.name=ATmega328P, internal RC osc 8MHz
m328pi.upload.using=arduino:usbtinyisp
m328pi.upload.protocol=stk500
m328pi.upload.maximum_size=32256
m328pi.upload.speed=57600
m328pi.bootloader.low_fuses=0xe2
m328pi.bootloader.high_fuses=0xd6
m328pi.bootloader.extended_fuses=0x05
m328pi.bootloader.path=optiboot
m328pi.bootloader.file=optiboot_atmega328_pro_8MHz.hex
m328pi.bootloader.unlock_bits=0x3F
m328pi.bootloader.lock_bits=0x0F
m328pi.build.mcu=atmega328p
m328pi.build.f_cpu=8000000L
m328pi.build.core=arduino

winner10920

Awesome it was the divide by 8, fixed it and uploaded bootloader and immediatly noticed proper blinking rate at the start
Uploaded blink with the ide(which uses 57600 whe. Pro mini 3.3v is selected)
success! Than you very much for the perfect advice

JChristensen

I was fiddling with ICSP programming anyway this evening, so I burned the 8MHz Optiboot, and set the fuses as above to run on the internal oscillator at 8MHz, and was able to upload sketches successfully. YMMV!

JChristensen

Ha, looks like those last two posts may have crossed on the wire. Glad you got it working! The internal oscillator is handy isn't it!

winner10920

Definetly, im looking into a very mobile project where number of components makes things alot harder, and caps and a crystal would be nearly impossible, and 5v isn't an option, need direct from a lipo
so happy how millis still works the same, that makes my life that much easier
again thanks that made my first voyage under 5v so much quicker, would've taken me a while to spot the divide by 8 thing

JChristensen

Glad to be of some small help, it wasn't much! I'd be interested in some details of your project if you're willing to share. The low voltage/low power capabilities are interesting. I've done a couple projects that run on 2xAA cells, and go into power down mode when they're not in use. I want to try a remote sensor node with an ATmega328P and an XBee configured as an end device. Both will sleep mostly, except to send a reading once every few minutes. Should be interesting to see how long that will run on 2xAA cells. I was planning to use a resonator to ensure accuracy for serial comm with the XBee, now this has me thinking twice, but space wouldn't be at that much of a premium.

winner10920

Well this particular project I just want to light up a few leds in some patterns which normally isn't that hard except I want to do it on my arm lol
my plan is to use that silver conductive ink pen(which I still need to get)and draw traces on my arm for the atmega328 and about 10 smd leds and smd resistors
maybe a soft pot for input to change patterns, and thinking about some button to go in and out of sleep mode,(or just take a leg off the battery
bending the pins out on a 328 wont be too bad and the smd stuff is practically meant for it, but smd caps are quite small and idk how id work with a crystal
I was thinking this kinda thing would be perfect for halloween(or those crazy parties), but I wanna try it out just to see if its possible, I haven't seen much similiar on the net and personally I think that would be the best clone board out there: the (me)duino

Go Up