Brebu
Offline
Full Member
Karma: 1
Posts: 244
New to Arduino
|
 |
« on: December 17, 2012, 03:20:36 pm » |
Hello, I'm trying to make my UNO run at 20MHz. I've made some research and i made a modified optiboot (see attachament) In the makefile i've put the following atmega328_20MHz: TARGET = atmega328__20MHz atmega328_20MHz: MCU_TARGET = atmega328p atmega328_20MHz: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' atmega328_20MHz: AVR_FREQ = 20000000L atmega328_20MHz: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe atmega328_20MHz: $(PROGRAM)_atmega328__20MHz.hex atmega328_20MHz: $(PROGRAM)_atmega328__20MHz.lst
atmega328_20MHz_isp: atmega328_20MHz atmega328_20MHz_isp: TARGET = atmega328__20MHz atmega328_20MHz_isp: MCU_TARGET = atmega328p # 512 byte boot, SPIEN atmega328_20MHz_isp: HFUSE = DE # Low power xtal (16MHz) 16KCK/14CK+65ms atmega328_20MHz_isp: LFUSE = FF # 2.7V brownout atmega328_20MHz_isp: EFUSE = 05 atmega328_20MHz_isp: isp and i generate the optiboot_atmega328__20MHz.hex file Till now i didn't have the chance to test it and i will ask your opinion on the bootloader. Will it work? Another problem is the timing functions. so far i've found out that: 1. delayMicroseconds - wiring.c - works at 20MHz 2. Softwareserial - implemented in library and work at 20MHz But i can't figure it out if millis(), micros() and delay() will work without any modifications. I use arduino 1.0.2
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 59
|
 |
« Reply #1 on: December 17, 2012, 05:40:55 pm » |
Hi why would you want to put the arduino at 20mhz, just wondering. I have no clue really what your talking about any way.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 282
Posts: 15443
Measurement changes behavior
|
 |
« Reply #2 on: December 17, 2012, 05:44:09 pm » |
Hi why would you want to put the arduino at 20mhz, just wondering. I have no clue really what your talking about any way.
Running the chip at 20Mhz would allow the code to run 25% faster then it runs at 16Mhz. Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 59
|
 |
« Reply #3 on: December 17, 2012, 05:47:13 pm » |
Oh. If you figure it out tell me how you did it, maybe Ill do it too 
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 282
Posts: 15443
Measurement changes behavior
|
 |
« Reply #4 on: December 17, 2012, 05:48:53 pm » |
But i can't figure it out if millis(), micros() and delay() will work without any modifications.
As long you create a new 'board' entry in the arduino boards.txt file showing the 20Mhz Fclock value the time based functions should work fine as they use the Fclock value defined in that board selection to setup the proper timing value for timer0. Same with the hardware serial baud rate calculations used in serial.begin function. Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Brebu
Offline
Full Member
Karma: 1
Posts: 244
New to Arduino
|
 |
« Reply #5 on: December 17, 2012, 06:00:20 pm » |
oh..i forgot to post the board entry here it is gvi.name=GVI High Speed (5V, 20 MHz) gvi.upload.protocol=arduino gvi.upload.maximum_size=32256 gvi.upload.speed=115200 gvi.bootloader.low_fuses=0xff gvi.bootloader.high_fuses=0xde gvi.bootloader.extended_fuses=0x05 gvi.bootloader.path=optiboot gvi.bootloader.file=optiboot_atmega328__20MHz.hex gvi.bootloader.unlock_bits=0x3F gvi.bootloader.lock_bits=0x0F gvi.build.mcu=atmega328p gvi.build.f_cpu=20000000L gvi.build.core=arduino gvi.build.variant=standard in my code i use a lot micros and millis, so my main interest is on these two functions. I also communicate with a touch shield slide (i intend to put this one on 20MHz for faster GUI) so I'm glad that serial communication is fixed for 20MHz basically all i need is to inset a new board definition? No need for a new bootloader?
|
|
|
|
« Last Edit: December 17, 2012, 06:12:00 pm by gvi70000 »
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Online
Shannon Member
Karma: 129
Posts: 10377
|
 |
« Reply #6 on: December 17, 2012, 11:04:15 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Brebu
Offline
Full Member
Karma: 1
Posts: 244
New to Arduino
|
 |
« Reply #7 on: December 18, 2012, 01:00:38 am » |
OK, millis solved to. Just micros and delay left in the dark.
But now a little bit confused, is it pr not necessary to make changes in IDE for 20MHz?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Online
Shannon Member
Karma: 129
Posts: 10377
|
 |
« Reply #8 on: December 18, 2012, 01:04:44 am » |
The IDE itself does not need to be changed. The core and boards.txt do need to be changed.
|
|
|
|
|
Logged
|
|
|
|
|
Brebu
Offline
Full Member
Karma: 1
Posts: 244
New to Arduino
|
 |
« Reply #9 on: December 18, 2012, 02:43:10 am » |
thanks for reply. friday i will get the cristals so i will be abel
to test it. what do you think about botloader, will it work?
|
|
|
|
« Last Edit: December 18, 2012, 02:45:24 am by gvi70000 »
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Online
Shannon Member
Karma: 129
Posts: 10377
|
 |
« Reply #10 on: December 18, 2012, 03:51:47 am » |
Four things... 1. I would add Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0] to the fuses... atmega328_20MHz_isp: HFUSE = D62. You probably should bump the brown-out detector to 4.3V. 3. As long as I was rebuilding the bootloader, I would use a higher baud rate... http://zygomorphic.com/arduino-tiny/?page_id=2494. Eyeballing, I can't find any problems with the makefile.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 15
Posts: 463
|
 |
« Reply #11 on: December 18, 2012, 03:59:25 am » |
Hello,
I'm trying to make my UNO run at 20MHz. I've made some research and i made a modified optiboot (see attachament)
I used a clone Duemilanove bare board and put in a 25.0 MHz crystal. It works just fine. I did have to add an entry in my "boards.txt" file and define "build.f_cpu=25000000UL" so that delays, tone and such were correct. I didn't change Optiboot at all and it worked fine. To do it right, I think a special Optiboot with F_CPU set to 25 MHz (or 20 in your case) would be better, but it's probably not necessary since my board works just fine with the "stock" 16 MHz bootloader. One thing I do, however, is set the low fuse from 0xFF to 0xF7 (changes "low power crystal" to "full swing crystal"). I prefer a nice solid oscillator, and the extra 1 milliamp it draws means nothing.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 15
Posts: 463
|
 |
« Reply #12 on: December 18, 2012, 04:05:20 am » |
Four things... 1. I would add Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0] to the fuses... atmega328_20MHz_isp: HFUSE = D62. You probably should bump the brown-out detector to 4.3V3. As long as I was rebuilding the bootloader, I would use a higher baud rate... http://zygomorphic.com/arduino-tiny/?page_id=2494. Eyeballing, I can't find any problems with the makefile. I agree with all of your suggestions except for the B.O.D. setting. I once tried the 4.3V setting and the board would not reliably power up (the USB supply was a touch below 5.0v). Setting the BOD to 2.7 worked 100% stable. I especially had problems at 4.3V when trying to use my AVRISPMKII. The ISP doesn't normally supply VCC on the ISP port, so I hacked mine with a 1N4001 to send USB power to the ISP port. Of course, 5.0 - 0.7 of the diode = 4.3v! The board won't program with BOD set to 4.3.
|
|
|
|
|
Logged
|
|
|
|
|
Brebu
Offline
Full Member
Karma: 1
Posts: 244
New to Arduino
|
 |
« Reply #13 on: December 18, 2012, 05:39:04 am » |
interesting facts. i just can't wait to test them. maybe i will also try 24mhz for the 328 chip can 2650 be overclocked to 20mhz, the data sheet says 16mhz max ?
|
|
|
|
« Last Edit: December 18, 2012, 05:39:57 pm by gvi70000 »
|
Logged
|
|
|
|
|
Brebu
Offline
Full Member
Karma: 1
Posts: 244
New to Arduino
|
 |
« Reply #14 on: December 22, 2012, 01:58:03 pm » |
Hello I have great news, I've manage to test Duemilanove (moddet to a Uno) with the attached bootloaders at 20MHz and also at 24MHz and is working FINE. the results are presented below and i also attache the bootloaders, changes to boars.txt and the test sketch. ##############################################################
gvi24.name=GVI High Speed (5V-24MHz-500k Baud) gvi24.upload.protocol=arduino gvi24.upload.maximum_size=32256 gvi24.upload.speed=500000 gvi24.bootloader.low_fuses=0xf7 gvi24.bootloader.high_fuses=0xd6 gvi24.bootloader.extended_fuses=0x05 gvi24.bootloader.path=optiboot gvi24.bootloader.file=optiboot_atmega328__24MHz.hex gvi24.bootloader.unlock_bits=0x3F gvi24.bootloader.lock_bits=0x0F gvi24.build.mcu=atmega328p gvi24.build.f_cpu=24000000L gvi24.build.core=arduino gvi24.build.variant=standard
##############################################################
gvi20.name=GVI High Speed (5V-20MHz-250k Baud) gvi20.upload.protocol=arduino gvi20.upload.maximum_size=32256 gvi20.upload.speed=250000 gvi20.bootloader.low_fuses=0xf7 gvi20.bootloader.high_fuses=0xd6 gvi20.bootloader.extended_fuses=0x05 gvi20.bootloader.path=optiboot gvi20.bootloader.file=optiboot_atmega328__20MHz.hex gvi20.bootloader.unlock_bits=0x3F gvi20.bootloader.lock_bits=0x0F gvi20.build.mcu=atmega328p gvi20.build.f_cpu=20000000L gvi20.build.core=arduino gvi20.build.variant=standard
############################################################## Now one more thing, do you think is possible to use the mega2650 at 20Mhz? any one try it?
|
|
|
|
|
Logged
|
|
|
|
|
|