Posted by Chris Anderson on September 28, 2008 at 12:30pm
Nothing every works exactly the way you'd hoped. We're testing the new ArduPilot boards and it's looks like we'll need to tweak a few more things. One stems from our decision to run the CPU at its top speed, 20Mhz. That's the best way to get maximum performance (it gives us 20 MIPS), but it introduces some incompatibility with the standard Arduino bootloader and libraries, which for legacy reasons run at 16Mhz or 8Mhz.
The usual solution is to recompile the bootloader for 20Mhz and ship the boards with that already loaded (and tweak the way we use clock-dependent libraries), but because this is an open source project that we expect people to modify, this would force DIYers to jump through some pretty gnarly hoops if they want to use libraries affected by clock speed. We could do it anyway and just advise people on what to watch out for, but I worry that it's not user friendly enough (to say nothing of the support and documentation nightmare).
So we're thinking about switching the resonator on the board to 16Mhz to make it 100% Arduino compatible. That's a 20% decrease in computational power, but our code is pretty efficient and will still run fine. Still, it's slightly painful to declock your board, and I suspect that we'll be switching back to 20Mhz as soon as Arduino supports that natively.
(Needless to say, we'll continue to advance ArduPilot at the pace of Arduino overall, which means switching to a 32-bit processor as soon as that''s supported. Arduino is very much designed to evolve with computer technology, so by hooking our wagon to that horse, we're hoping to future-proof ArduPilot.)
Chris I think it is a good idea to keep it arduino compatible. It pretty much makes the development environment available with no additional work on our part. When Arduino gets an upgrade, so will the ArduPiot, or ArduPilotPro.
The other alternative is to make your port of the arduino ide... totally permissible, it started as processing, got extended to become wiring, and extended again to arduino. If you are really fixed on running 20mhz, it is an option. The only thing you will really need to change are the fuses, and the word Arduino.. and maybe the color ;)
Thanks for trying to keep the ArduPilot board compatible with Arudino/Boarduino. I've purchased the other parts already and am looking forward to the completed pilot board. You're thinking along very clear and "user-friendly" lines, keep it up Chris! :)
I think that what's happened is that it's looking for a different kind of external crystal/resonator than you've got. If you can remember which setting you chose, you can probably wire up the right crystal with wires that you can put on the right pins long enough to program it back to the internal oscillator.
Failing that, a new chip will do the trick. In the future, just do all the testing and prototyping on the internal oscillator (ie, leave the fuse as it is). It's just 50% of normal power, but that's sufficient for our code.
What speed is the external crystal (actually a resonator)? If it's 16Mhz, it should be okay (although you need to set the right fuse). If it's 20Mhz, it's more complicated.
Comments
The other alternative is to make your port of the arduino ide... totally permissible, it started as processing, got extended to become wiring, and extended again to arduino. If you are really fixed on running 20mhz, it is an option. The only thing you will really need to change are the fuses, and the word Arduino.. and maybe the color ;)
DIY-Guy
Failing that, a new chip will do the trick. In the future, just do all the testing and prototyping on the internal oscillator (ie, leave the fuse as it is). It's just 50% of normal power, but that's sufficient for our code.