BasicMicro - Forums

www.basicmicro.com
It is currently Sun May 20, 2012 11:15 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: interfacing to 9xtend radio
PostPosted: Sat Apr 25, 2009 9:24 pm 
Offline
Master

Joined: Sun Oct 05, 2008 9:40 am
Posts: 111
I am trying to interface the 9xtend radio modem from Maxstream with the Atom. The manual for the radio states that it can connect directly to a device with a uart. This being the case I connected the radios data out and data in pins to pins 14 and 15 of the Atom.

main:

enablehserial

sethserial H9600

hserout ["test", 13]

pause 1000

goto main

The program works when connected to a converter and a terminal emmulator, but does not work with the radio. The manual for the radio states:

Each data byte consists of a start bit (low), 8 data bits (least significant bit first) and a stop bit(high)

According to the Atom manual:

"normal" data for RS232 uses LOW (negative) for 1 and HIGH (positive) for 0.

If I am not mistaken I need inverted data? Can this be done using the sethserial command or does this need to be done through hardware?


Top
 Profile  
 
 Post subject: Re: interfacing to 9xtend radio
PostPosted: Sun Apr 26, 2009 12:38 am 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Hi. :)
So, it's the old TTL vs RS232 levels bugaboo.
TTL levels are: a LOW is less than 1 Volt, a HIGH is 2V to 5V.
RS232 translates ("converts" in your case?) these levels to RS232 standards, which swing (plus/minus) 3 to 25V. A LOW TTL (less than 1 V) to PLUS 3V to 25V; a HIGH becomes a NEGATIVE 3V to 25V.

The questions are now:
1. Does the radio expect TTL levels, or RS232 levels?
and
2. If TTL, does it want them inverted?
and
3. Does it expect BOTH?

The 3rd is unlikely.
Hardware serial (the internal USART, which uses the HSERx commands) puts out NON-inverted. In a typical serial situation, the processor puts out NON-inverted TTL. This is translated to RS232 levels using a translator IC like the MAX232 (did you use something like this?), whose large voltage swings ensure the signal can travel over long distances without interference from noise. The translator IC at the other end turns this all back into TTL, which goes to whatever is waiting for a TTL signal.

If, in this case, you want TTL that is INVERTED, you have to NEGATE (invert each bit in each character) all the characters first, if using HSERx commands. Otherwise, use the SERx commands and specify inverted transmission. Read the appropriate manual for the version of Atom BASIC you are using, 2211 or 5313, for instructions on how to do this.

Good luck on your project,
kenjj

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: interfacing to 9xtend radio
PostPosted: Sun Apr 26, 2009 4:58 pm 
Offline
Master

Joined: Sun Oct 05, 2008 9:40 am
Posts: 111
Here is what I have tried. First I used the ser command using both I and N with baud rate. I have also tried using the onboard uart with Hser commands. Neither one worked. There is a TX led that pulses low when data hits the radios uart, this works with both.

I have not used a max232. I would like to eliminate this part. Both devices will be on the same board so distance should not be a problem. I purchased the radios with a development board that does have the 232 chip on it. My understanding is that I need to use the max232 if I want to communicate between the Atom and the raido on the development board. If the radio is removed from the board then it needs a TTL signal.

The Xtend manual is here http://ftp1.digi.com/support/documentat ... 0958_A.pdf page 9 is the serial interface. I know I am looking at the answer but can't quite connect the dots.

kenjj I don't know if I have thanked you but you have responded to all of my post and it is greatly appreicated.

Also any suggestions on a book about serial comm.


Top
 Profile  
 
 Post subject: Re: interfacing to 9xtend radio
PostPosted: Sun Apr 26, 2009 5:40 pm 
Offline
Master

Joined: Sun Oct 05, 2008 9:40 am
Posts: 111
Going back a little while ago I interface the Atom with a Deluo GPS. Now the gps had two output pins 1 for serial data and the other for TTL. I tried the TTL data out first and this did not work. I then tried the serial data out with a 22k resistor and I was able to recieve the data. Why would this be?

Another example is interfacing to the lassen gps. I have a development board from Sparkfun that has the 232 port and one that connects directly to the gps uart without the max232. I can communicate with the Atom when using the port with the 232. When using the port without 232 I can not send or receive anything. I understand that doing it like this is likly to damage the Atom but I have done it once or twice and it is the only way I have been able to communicate with the Lassen so far.


Top
 Profile  
 
 Post subject: Re: interfacing to 9xtend radio
PostPosted: Sun Apr 26, 2009 7:43 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Let's clear up something real quick: which version of the Atom are you using? There is a 28 pin and 40 pin DIP package, and the two modules. The DIP versions are just the processors; the modules are surface mount processors mounted on a small circuit board with the minimal operating circuitry, which includes the clock crystal, voltage regulator, RS232 translator circuits, etc. Also, there was an 'A' version DIP part. This used two pins for programming and serial communications, while the new version uses a single pin for both transmitted and received data (think SERIN/SEROUT).
With a module, the SERxx commands use the S_IN and S_OUT pin, which is actually the same pin, and use RS232 levels. The UART (I'm winging it here, don't own a module) probably is just another set of I/O pins to the edge of the board. So, SERxx will be RS232 levels; HSERxx will be TTL if you don't feed them through a translator IC. But the DIP part does TTL at all pins.
BTW, people _do_ RS232 to and from a standard DIP processor with only one translation IC present at the other device's side. You put a resistor (say, 22k?) between the RS232 device and the processor's input. The processor's output you send straight out. Since you lack the inversion factor of the missing MAX232 (or whatever), you must invert the data you send out from the processor. Most translator ICs will work with TTL levels, but no gaurantees. And only over a few feet or so. I don't recommend this method, however.

Something to check for is the level on the radio's CTS pin mentioned in the sheet on page 9 or 10 of the radio's data sheet. If this is high, then the radio is saying it can't take any more data. This is true if the internal transmit buffer holds over 2K of data, which will happen if the Baud rate you're sending at is much higher than the radio's Baud rate for transmissions. Check that CTS pin. If it's high, you need to at least check those two rates mentioned. There is a way to implement hardware flow control with the SERxx commands, but I doubt you'll need to worry about it if the Baud rates are set properly. Unless you are sending out an encyclopedia... ;-D

BTW, I noticed a warning on the radio sheet about running these radio modules less than two feet apart if using the 1 Watt output.

Thaks for the compliment,
kenjj

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: interfacing to 9xtend radio
PostPosted: Mon Apr 27, 2009 10:19 am 
Offline
Master

Joined: Sun Oct 05, 2008 9:40 am
Posts: 111
I am using the Atom 24 moduel.

Using the SERxx command with S_in / S-out uses these pins through a RS232 translator circuit if any other pin is used with SERxx it is not going through the translator circuit and would be TTL (correct?)

You are correct with the uart.

I have a few ideas now and some things to prototype. The good news is I do have most the payload working. I have also done alot of work on the rocket airframe. The way it looks now is I will have a few lower altitude test flights come late spring/early summer. Then a high altitude test flight this summer with an expected altitude of 26,000 ft and just shy of mach 2 :shock:


Top
 Profile  
 
 Post subject: Re: interfacing to 9xtend radio
PostPosted: Mon Apr 27, 2009 2:24 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
SHOULD I DUCK??!! :o

Yes, ATN (RTS in the serial world), S_IN and S_OUT go through a translator, all other pins are TTL.
Take care,
kenjj

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO