CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Using Bluetooth adapters for serial connection
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
bestbuylvr



Joined: 31 Jan 2007
Posts: 27
Location: Pittsburgh, PA

View user's profile Send private message

PostPosted: Fri Feb 02, 2007 7:27 am     Reply with quote

How would you go about transmitting from one serial port to another? Is there a program to do it, or is there a way to write it into a C++ code? I havent had a whole lot of serial experience, so any help would be nice. Thanks guys.
newguy



Joined: 24 Jun 2004
Posts: 1946

View user's profile Send private message

PostPosted: Fri Feb 02, 2007 1:08 pm     Reply with quote

Hyperterminal to one COM port, and CCS serial port monitor program to the other. Once they're each set up with the proper baud rate, etc., whatever you type in one window should show up in the other. If you can move a message from one port to another and back again, then your hardware isn't the problem.

The only thing is, I'm sure your hardware is the problem because you were able to move messages back & forth from the PC to the PIC when they were directly wired. This setup will allow you to more easily diagnose the issue and fix it.
bestbuylvr



Joined: 31 Jan 2007
Posts: 27
Location: Pittsburgh, PA

View user's profile Send private message

You'll like this.
PostPosted: Fri Feb 02, 2007 2:24 pm     Reply with quote

Ok, so here is the twist to this whole thing. It does indeed send data both ways when using hyperterminal and having the bluetooth devices hooked directly to the computer. This is a rather crazy find, since the PIC acts as though it is getting nothing. Now in order to connect the serial bluetooth device to the computer, I have to use a NULL modem(Femal to female), but I have a NULL modem (Male to Female) that I used to connect the Bluetooth to the PIC, just in case that was the problem. Neither way, straight or Null, worked. I dont know if the two NULL modems are any different because of the connections, but I would think that trying straight or inverted, I would have covered all bases. Do you think I need some other type of connector perhaps? By the way, thank you newguy for all of your help. I really do appreciate it.
newguy



Joined: 24 Jun 2004
Posts: 1946

View user's profile Send private message

PostPosted: Fri Feb 02, 2007 2:44 pm     Reply with quote

What sort of board is the PIC on? Is it a commercial prototyping board or something you put together yourself?

Are you sure that you use a null modem cable to connect the bluetooth device to the PC? That just doesn't seem right. Not at all.

Anyway, try this. Use a multimeter to see what pin goes where on the female-female cable that you used to connect the bluetooth device to the PC (and you know works properly). The PC transmits on pin 3, and receives on pin 2. See if pin 3 is connected to the other pin 3, or if pin 3 on the PC end is connected to 2 on the other end of the cable.

Then measure which pin is connected where on the PIC's board. All you need to know is where PIC pins C6 and C7 go on the DB9 connector.

See where this is going? You'll need to verify that you have equivalent wiring to the bluetooth device at the PC and PIC ends and that you don't have any swapped or broken connections on the tx and rx lines.

PC -> DB9 pin 3 -> Bluetooth 1 data in
PC <- DB9 pin 2 <- Bluetooth 1 data out

PIC -> C6 -> DB9 pin 3 -> Bluetooth 2 data in
PIC <- C7 <- DB9 pin 2 <- Bluetooth 2 data out

One more thing, do you have a level converter (max232 or equivalent) in the PIC circuit? Since the bluetooth device works if connected to the PC's serial port, it must have an RS232 level converter. Therefore there has to be one between the PIC and the bluetooth device as well.
bestbuylvr



Joined: 31 Jan 2007
Posts: 27
Location: Pittsburgh, PA

View user's profile Send private message

PostPosted: Mon Feb 05, 2007 7:40 am     Reply with quote

The Board I have is indeed a commercial prototyping board. The Bluetooth device I connect to the PC is only connected through the serial port when I was testing it and does indeed come with a null modem to use for that purpose. Under normal circumstances, that bluetooth device is connected to the serial cable of the PIC.

I will run through all of the connection checks that I can on the PIC side, but the other PC end is as I said a USB connector that only makes a virtual serial port, making it almost imposseble to tell what pins are transmitting or recieving there, but I guess we can assume it is not that whick is the problem considering it loops data correctly when using only the computer.

I am not quite sure about the level converter you are referring to. I know that the bluetooth serial device is powered by an external source, but the USB is powered internally, if that means anything. Again I thank you for your help.
bestbuylvr



Joined: 31 Jan 2007
Posts: 27
Location: Pittsburgh, PA

View user's profile Send private message

Update
PostPosted: Mon Feb 05, 2007 9:56 am     Reply with quote

Here is an interesting update. I used a multimeter to find out what pins on the PIC's serial were connected to the actual headphone-like end. It turns out that Pin 5 is GND, and pins 2 and 3 are Tx/Rx. I used the jumper wires I had to manually connect the serial port to the bluetooth serial adapter. I got it to work to the point I had before with it transferring from the PIC to the computer, but it still wont go back. I tried every pin connection between the PIC's serial pin 3 and all but the computer's GND and pin 2, which was receiving from the PIC. Does this mean a possible technical difficulty or a programming error? I have went over the code and it works flawlessly when physically connected. I assume something in the hardware may not be right, though I have no way to be certain. Your opinion?
bestbuylvr



Joined: 31 Jan 2007
Posts: 27
Location: Pittsburgh, PA

View user's profile Send private message

RESOLVED
PostPosted: Tue Feb 06, 2007 9:05 am     Reply with quote

OK, so apparently this bluetooth adapter I was using is waiting for a clear to send signal. Since the PIC doesnt send a CTS signal, it never got it and therefore decided not to send data over the connection even though I set it not to use CTS. I guess one of the adapters apparently doesnt agree with that, but using a 5 Volt signal on pin 8 seems to open the connection and solve the problem. Thank you guys again for your help, especially newguy.
~Harrison
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group