SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By Vern
#46289
Hi All,

For my project I need to get an XBee radio talking to an RS-232 serial port, which I have done via an SN7404 Hex Inverter, but it is acting very strange. I decided to use a Texas Instruments SN7404N after a Maxim MAX232CPE decided not to work at all (I was using 1uF tantalum caps, I think I might need 10uF)

I am using a 7404 as most RS-232 transceivers only come with 2 drivers (rx, tx) but I need rts and dtr also, so a 7404 was the feasible solution.

The circuit works - I can use the X-CTU terminal to transfer text between 2 xbee's on 2 separate pc's in the X-CTU terminal, no worries at all. The issue is that the XBee responds weirdly when X-CTU sends '+++'. I can send '+++' in the terminal and I get 'OK.' when X-CTU sends it, all I get back is 'O' so I assume the transmission is being cut.

I have a USB debug board which X-CTU can use to interface with both XBee's fine, just when I use the 7404 circuit. I am using the correct baud rates.

It seems to be narrowed down to the 7404 circuit. Are there any issues with the SN7404N I should know, like connecting the unused pins to GND or VCC?

Why would it send data fine in the X-CTU terminal, and then get a weird response when I press 'Test/Query' Both modems do this. I have turned CTS flow control off.

Any suggestions would be greatly appreciated.
By Vraz
#46319
It seems to be narrowed down to the 7404 circuit. Are there any issues with the SN7404N I should know, like connecting the unused pins to GND or VCC?
The TI datasheet specifies that all unused inputs to the 7404 should be connected to either VCC or GND, not left floating.

However, I am more curious about the voltages you are using. The XBee must be run on 2-8-3.4 volts (3.3v is typical) while the 7404 or MAX232 are both 5V devices. Mixing the voltages like that does not seem like a good strategy. To connect the XBee to a serial port, I would use the 3.3V version of the MAX232-- the MAX3232.

I have a project that uses the XBee modules and have not encountered any issues communicating with them. Mind you, on the PC side I am using the USB version and on the my project side, the XBee is connected to an AVR (2313) both running at 3.3V so no level conversion is required. Communication has been rock solid in both instances.

Note that MaxStream/Digi has a developer kit with a serial PC adapter. I know the schematic is in one of the documents though I cannot locate it at the moment (Digi has one of the most disorganized vendor sites I have ever dealt with). You might want to dig through there site and see if you can find it-- that might be a better starting point.
By stevech
#46325
using the 7404 - your voltage swings are +4.x volts down to 0.3 volts.
RS232 is -5 to +5.

Some devices will sort of work without the swing to below 0 volts.
Some act flaky.
Some work more or less depending on what the RTS, DTR lines are set to by the controlling (PC?) software.

The MAX232 works, I believe, with 1uF caps.
By Vern
#46327
Today I did some playing around and found the following:

The 7404 circuit works fine on a desktop PC, but still acts weird when using a serial adapter. I am putting this down to the 7404 not liking the +5v coming out of the USB adapter, it obviously is made to work with proper serial levels.

I think this is also why the MAX232 circuit didn't work.

I am using a 5v regulator to supply the 7404, and I am using one of the XBee breakout boards from www.droids.it which has an onboard regulator.

This is a problem as I would like to be able to use this project on a laptop, and sadly most come with USB only nowdays.

I can't find any TTL/RS232 drivers that are built t handle the lower RS-232 voltage. I am going to try the max232 circuit on the desktop and see what happens. A 7404 probably isn't a very good permanent solution for talking to a PC.
By n1ist
#46333
The 7404 is really the wrong part for the job - both sides are incorrect. In this case, the MAX3232 is the best choice as it does the 3.3v logic to bipolar rs232 level shifting. It uses 100n caps, and is the 3V equivalent of the MAX202, and should work with both the PC native serial ports and the USB-serial converter.

As for the MAX232, check the data sheet as some want 1uf caps, some 10uf caps, and some require them to be polarized (electrolytic or tantalum), and of course, they must face the right way. The -202 or -232 however, should only be used to drive somthing with TTL level I/O.

If you are looking for a strictly usb-xbee solution, try
http://www.sparkfun.com/commerce/produc ... cts_id=718
By Vraz
#46334
I am using a 5v regulator to supply the 7404, and I am using one of the XBee breakout boards from www.droids.it which has an onboard regulator.
Dump the 5v regulator and power a max3232 (or cheaper non-maxim version) directly from the 3.3v provided by the XBee breakout board (it has plenty of current for this). Also note that almost all the max3232 variations typically use four 0.1uf capacitors (plus a 0.1uf Vcc bypass)-- a nice easy small ceramic non-polarized capacitor (but of course, check the datasheet for the particular part you choose). Change over to this and your circuit gets simpler (no extra regulator) and should be rock solid since everything will run in spec.
By Vern
#46375
The MAX232 circuit works on desktop serial levels - but with the 1uF tantalum caps, the XBee started spewing out garbage when it had to send alot of data, mainly when X-CTU was reading its configuration.

10uF electrolytic caps fixed this problem, no problems yet. I have heard that you need to change the cap value as the baud rate changes. Just a rumour though. This is strange as the datasheet says to use 1uF caps.

Since I was intending to use the 7404 for the RTS and DTR pins, I now need more drivers - it appears that Maxim, or any other company don't make a 3.3v transceiver with 4 drivers for under $20 , one of those tiny low voltage regulators will have to do, I can't use 2 MAX3232's as my board space is limited.

The new MAX232 circuit doesn't work with laptop serial, could just be my brand of adapter, this is something that needs further investigation.
By Vern
#46380
Something else odd, is that the MAX232 circuit works, I can read all the config settings from the XBee, but now and again some of the values returned will be random garbage, and sometimes it will choke halfway through reading all the values and declare that it can't talk to the XBee.

The unused pins have internal pulldowns so that shouldn't be a problem, the only thing I can think of is the input voltage is weird, I'm powering the circuit of a 12v Sealed Lead-Acid battery, which under load reads 9.6v. It probably needs a good charge, or I need a regulated mains supply.

Should I put a cap in parallel across the voltage regulator/supply?
By stevech
#46390
mind the GND connection between PC and MAX232 circuit.
By Vern
#46421
I don't really understand what you mean by that, could you please clarify?

The XBee needs the power and signal GND connected to the one pin, so that means the MAX232 circuit will always be connected to the GND of the PC and the XBee.. am I missing something here?
By Philba
#46424
yes, he said to make sure that they are connected and that the connection is good.

I would double check all the connections. Especially using a solderless bread board which can be really flakey. ground unused rails.

Also, make sure that there are no interference sources near the comm path.

I've seen similar problems due to missing bypass caps. I would put .1uF caps on the xbee and max232 power/gnd pins.