Arduino at 11.0592MHz. Modify Timer0, delayMicroseconds()

我们两清 提交于 2019-12-02 07:43:56

The Arduino way would be to make a custom PLATFORM for your board with that of the new F_CPU speed. The core libraries should carry this F_CPU through.

This is easy enough, by making a boards.txt file with your differences. Where the location of the file (same between the two) is different between the two current IDE's. In the case of Arduino IDE 1.0.5:

C:\Users\mflaga\Documents\Arduino\hardware\myArduino11MgHz\boards.txt

and in the case of 1.5.5:

C:\Users\mflaga\Documents\Arduino\hardware\myArduino11MgHz\avr\boards.txt

Where in your case the sketch directory would be different.

# See: http://code.google.com/p/arduino/wiki/Platforms

##############################################################

myArduino11MgHz.name=Arduino 11MgHz

myArduino11MgHz.vid.0=0x2341
myArduino11MgHz.pid.0=0x0043
myArduino11MgHz.vid.1=0x2341
myArduino11MgHz.pid.1=0x0001

myArduino11MgHz.upload.tool=avrdude
myArduino11MgHz.upload.protocol=arduino
myArduino11MgHz.upload.maximum_size=32256
myArduino11MgHz.upload.maximum_data_size=2048
myArduino11MgHz.upload.speed=115200

myArduino11MgHz.bootloader.tool=avrdude
myArduino11MgHz.bootloader.low_fuses=0xFF
myArduino11MgHz.bootloader.high_fuses=0xDE
myArduino11MgHz.bootloader.extended_fuses=0x05
myArduino11MgHz.bootloader.unlock_bits=0x3F
myArduino11MgHz.bootloader.lock_bits=0x0F
myArduino11MgHz.bootloader.file=optiboot/optiboot_atmega328.hex

myArduino11MgHz.build.mcu=atmega328p
myArduino11MgHz.build.f_cpu=11059200L
myArduino11MgHz.build.board=AVR_myArduino11MgHz
myArduino11MgHz.build.core=arduino:arduino
myArduino11MgHz.build.variant=arduino:standard

##############################################################

Here is a 3rd party GUI Editor of the board.txt.

Disclaimer. The above does compile and should work fine. Where I have not actually tested and loaded into a unit.


That said, I would expect the bootloader's F_CPU not to match. There are three possible solutions to this.

First; the optiboot loader should have a corresponding target with the below deviation:

\arduino-1.5.5\hardware\arduino\avr\bootloaders\optiboot\Makefile

myArduino11MgHz: AVR_FREQ = 11059200L

Second; Change the boards.txt upload speed to match the change of =115200*(11059200/16000000).

myArduino11MgHz.upload.speed=79626

This being a non typical baud rate, either avrdude or the serial port may support it.

Third; Don't use the bootload, by uploading via the ISP programmer.


I have likewise planned to make a board with a different F_CPU, but only actually made custom boards, with the same speed. I would be curious to know if the above actually works, in your case.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!