Pages: [1]   Go Down
Author Topic: Arduino and other Development Boards  (Read 1532 times)
0 Members and 1 Guest are viewing this topic.
Hurley, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an Olimex AVR-P28 board ($14 from Sparkfun.com) into which I inserted a spare Atmega8 that I programmed using the parallel port programmer.  Getting this to speak through the Olimex board's Max232 serial chip wasn't easy, since its pins are not connected to the Atmega at all - you have to do that yourself and the labels on the board appear to be reversed (or perhaps we're in weird Null-modem land).  I had to look up the Max232 schematic for guidance.  Pin 3 of the Atmega8 goes to pin 10 of the Max232 and (I think) pin 2 of the Atmega8 goes to pin 12 of the Max232.

With this setup, it is possible to read the serial output of a Atmega8 running a known program that outputs to the serial port.  What is strange, though, is that I have to set my terminal program to half the baud rate of the serial setting in the Arduino program (in other words, a Serial.begin(2400) results in 1200 baud communications).

I have not been able to upload a new program to the Atmega while it's on the Olimex board.  Perhaps the RX wire is going to the wrong pin of the Max232 or the baud-halving issue is throwing a monkey wrench into the process.  Does anyone have any ideas?  I like the Olimex board because of all the board real estate, which is good for a project that has already been completely debugged.
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm guessing the ATmega8 on the Olimex is running at 8 MHz (either with an external clock or the internal one).  You can tell Arduino the clock speed of your board in the preferences file (http://www.arduino.cc/en/Main/Preferences): search for "cpu".  This will fix your sketches (e.g. the problem you mentioned of Serial.begin(2400) resulting in 1200 baud communication).

You could burn the Arduino bootloader to the chip to upload new sketches while it's on the board.  Don't use the Arduino "burn bootloader" command if your board is running on an internal clock; it will set the fuses to expect an external oscillator and the chip won't work without one.  If you're using the internal clock, you'll need to modify the fuses in your Arduino preferences file before burning the bootloader.

The bootloader was compiled with the assumption that your board is running at 16 MHz.  If you have a board that's actually running at 8 MHz, you'll need to either recompile the bootloader (with the correct cpu speed defined), or change your serial.download_rate in the preferences file from 19200 to 9600.  
Logged

Hurley, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow, you totally called it!  Sure enough, the Olimex had an 8MHz crystal.  Just to keep things easier when dealing with real Arduino boards, I decided to fix the problem by replacing the 8MHz crystal with a 16 MHz one.  I looked around my cluttered laboratory and found a four pin 16 MHz module (from an old experimental NCUBE multiprocessor ISA board).   (For the record, those modules have osc_out at pin 3, ground at pin 2, and VCC at pin 4.) I desoldered the old 8MHz crystal out of the Olimex and connected the osc_out pin from the module to pin 9 of the Atmega8.  Right away, I noted it booted up in half the time!  And then I could reprogram it over a serial line using the usual Arduino IDE.  This setup makes it possible to develop stand-alone Arduino gear for just the price of the Atmega and the Olimex board, and you get lots of board real estate as a bonus!
Logged

Pages: [1]   Go Up
Jump to: