for my current project, I built my own circuit for the Atmega328 taken from the Arduino UNO.
It runs at 3,3V.
Since the maximum rating for the µC @ 3,3V is about 13MHz, I have to use another oscillator.
Since I want to transmit data at 115200baud, I do not want to use 8MHz, since the mistake rate is quite high.
Instead, I chose 11,0592MHz.
As a result, I will have to manipulate the bootloader in order to make it work correctly.
Did anyone of you already do this or does anyone of you how exactly I have to do this?
I will have to manipulate the bootloader in order to make it work correctly.
Did anyone of you already do this or does anyone of you how exactly I have to do this?
Well, you COULD upload while the 328 is in the Arduino running at 16MHz, and then move it into your 11MHz target system; no bootloader changes would be required.
What host system are you using (windows, mac, linux), and do you have AVR tools installed other than Arduino? (such as WINAVR or CROSSPACK-AVR)
In theory, you modify the makefile in the hardware/arduino/bootloaders/optiboot directory so that you have a target that has AVR_FREQ = 11059200 and compile that target, but with the current distributions you need an AVR development environment installed in order to do the build.
Well my problem is that the baud-rate of the Atmega is relative to the clock speed-so when I choose a lower clock speed, the serial communication will get messed up.
I have AVR Studio installed on my Windows 7 PC, which I guess would do the job.
I tried to change the makefile and recompile it, I did not really know how to proceed and was thereful not successful.
So how exactly do I have to do this?
you open the make file in your text editor and you need to change this settings
# enter the parameters for the avrdude isp tool
ISPTOOL = usbasp
ISPPORT = usb
ISPSPEED =
depending on the programmer your using if you use arduino as isp should look like this
# enter the parameters for the avrdude isp tool
ISPTOOL = stk500
ISPPORT = \\.\COMx #where x its the number of the serial port assigned by windows to your arduino
ISPSPEED = -b19200
after that you need to edit this
atmega328: AVR_FREQ = 16000000L
to
atmega328: AVR_FREQ = 11059200L
and save the file
open command line change directory to where you have the optiboot and type
Thanks for this answer thats exactly what I needed:)
I got two more questions:
Does anybody know the ISP settings for the AT AVR ISP2 USB-programmer?
If not, which programmer can you recommend me?
I took a look at the schematic of the Duemilanove board, and it seems like the FTDI chip does not use an oscillator...so could I just change the oscillator for the atmega328 to 11,0592MHz after I burnt the new bootloader, and will I be able to communicate with/program the µC via the FTDI chip then?
I just tried a compilation with "AVR_FREQ = 11059200L". Although I don't have an 11MHz crystal handy, it does appear that the bootloader sets the baud-rate generator clock correctly.
The odds are excellent that the 328 will run 16MHz at 3.3v, every jeenode in existence does this, and I've run half a dozen chips at 3.3v and 16MHz will excellent results.
Well the problem is that I have to take some really fast and precise mesurements, and as I use a two XBee radios to communicate with the PC, I'm limited to 115200 baud.
At 16 MHz, the mistake rate for the serial communication at 115200 baud is about 3,5%, which is two much for my application since I have to calculate integreals from the values. (I use a gyroscope as well as an accelerometer.)
The problem is that I'm currently still prototyping, and the external components used all run at 3,3V, which unfortunately means that I have to swap the µC between the circuit and the arduino board to program it, which also means I need to use the bootloader.
Thanks for your help everyone, I didn't get WestfW's optimised optiboot to work yet, but I'm working on it, and hopefully I will soon get my ISP programmer back so I can proceed.
Bill has improved the makefile so that it's easier to compile, buy adding the paths to the compiler and other tools and translating forward-slashes into back-slashes where necessary. There are also some bug-fixes and improvements to the code.
Download the source files from Github, put them in the bootloaders directory in the IDE (eg. C:\Users\Tim\Documents\Arduino\ide\v10r1\hardware\arduino\bootloaders\optiboot_v44), and run omake.bat. That's all there is to it.