115200 baud possible?

Support forum for the mightyohm.com Geiger Counter.
http://mightyohm.com/geiger
Post Reply
flop
Posts: 4
Joined: Mon May 07, 2012 5:26 pm

115200 baud possible?

Post by flop »

Hello,

I tried to set the serial speed to 115200 baud, but I got lots of nonsense over my serial line. Is it possible to set the speed to 115200 baud witout adding an external crystal oscillator? I'm pretty new to the topic of avr-programming and I want to hook up my geiger counter direclty to a seagate dockstar, which only communicates at 115200 baud...
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: 115200 baud possible?

Post by mightyohm »

Hello flop,

How did you change the baud rate to 115200?
flop
Posts: 4
Joined: Mon May 07, 2012 5:26 pm

Re: 115200 baud possible?

Post by flop »

Hi Jeff,

I just changed the define-value in your geiger.c

Code: Select all

[...]
// Defines
#define VERSION			"1.00"
#define URL				 "http://mightyohm.com/geiger"

#define	F_CPU			8000000	// AVR clock speed in Hz
#define	BAUD			 115200	 // Serial BAUD rate
#define SER_BUFF_LEN	 11		  // Serial buffer length
#define THRESHOLD		 1000	   // CPM threshold for fast avg mode
#define LONG_PERIOD	  60		  // # of samples to keep in memory in slow avg mode
#define SHORT_PERIOD	 5		   // # or samples for fast avg mode
#define SCALE_FACTOR	 57		  //	CPM to uSv/hr conversion factor (x10,000 to avoid float)
#define PULSEWIDTH	   100		 // width of the PULSE output (in microseconds)
[...]
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: 115200 baud possible?

Post by mightyohm »

Ok, while in theory that change should do it, according to this calculator, 115200 baud won't work with an 8MHz clock (resonator or crystal):

http://www.wormfood.net/avrbaudcalc.php

You'll need to change the external resonator to 9.216MHz or one of the other frequencies shown that lists 115200 in green. A crystal might be required if the resonator isn't accurate enough. Since crystals require shunt capacitors, you would need to solder those to the back of the board (usually around 20pF per leg).

Changing the clock frequency of the AVR has other implications, too - the settings for the timers will need to be adjusted and there is a maximum clock frequency rating that depends on battery voltage. I think 12MHz is the max at 3V.
flop
Posts: 4
Joined: Mon May 07, 2012 5:26 pm

Re: 115200 baud possible?

Post by flop »

Hi Jeff,

So something like this should do the job?
Image
(You see, I'm a real newbie to this topic)
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: 115200 baud possible?

Post by mightyohm »

The capacitors should go from either side of the crystal to ground.

Out of curiosity, why do you need the geiger counter to operate at 115200 baud? It might be easier to change the other end of the link to 9600...
flop
Posts: 4
Joined: Mon May 07, 2012 5:26 pm

Re: 115200 baud possible?

Post by flop »

The Seagate Dockstar has serial pins on the board, but only communicates at 115200 baud. Although I can see two serial devices (/dev/ttyu0 and /dev/ttyu1) I can only see one TX and one RX pin. Unfortunately this devices are pretty undocumented and /dev/ttyu0 is mostly used as remote serial console for the Dockstar itself. I think I just have to get another ca-42-cable for usb-to-serial-communication and forget about using the on-board port...
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: 115200 baud possible?

Post by mightyohm »

I think a usb-serial adapter is the way to go, otherwise you might have problems with console messages interfering with your serial comms.. I ran into this when I was hacking the WL-520gU router for my wifi radio project.
Post Reply