Bluetooth serial BT-232B-E problem

bielec

Member
Licensed User
Longtime User
I am trying to use the low cost Bluetooth RS232 adapters type BT 232B E

1. Using the serial example program by Erel, the unit connects at both ends (Galaxy S2 to Terminal program on PC) but as soon as data is typed at either end, the B4A hangs up with "stopped responding" error.

2. I have tried Erel's B4A program on other BT devices (GPS) and the data flow is ok so the prog and h/w are in order.

3. I have tried the PC end communicating with another PC with a second BT-232B-E and it is ok too, in both directions, and set as Master/Slave and Slave/Master. I have also communicated with a GPS on the PC. So the BT232BE's are ok

4. I have tried scenario 1. with a different BT terminal program (Sena BT Term) and "voila" it works! I can type keys at both ends and the data is transferred.

5. Suspecting that there was some specific problem with compatibility between the serial demo program and the BT232BE, I started trying different things without success....

commenting out the lines,
'Else
' Serial1.Listen

Unpairing and Pairing with the BT232BE

Adding
Dim bt As BluetoothAdmin
to the Process_Globals
and
Serial1.StopListening
to the Disconnect Sub

Using different Connect commands,
Serial1.ConnectInsecure(bt,PairedDevices.Get(l.Get(res)),1)
Serial1.Connect2.........
Serial1.Connect3.........

Each of these connected, at both ends, but no data could be transferred and the Android device hung as soon as a key was pressed at either end.

An annoying thing is that when it hangs, the remote RS232BE remains "connected", with the led lit, and stays in this state as long as the Android BT is switched on. I have to switch off BT, wait for the RS232BE to drop back to discover mode, then switch on BT again before I can test another software change.

Does anyone have any ideas? I have run out and am just looking for suggestions.
 

Scantech

Well-Known Member
Licensed User
Longtime User
Same thing happen to me when I was using TextReader1.ReadLine and TextWriter1.WriterLine. Try using TextReader1.Read/TextWriter1.Write Instead.
 
Upvote 0

bielec

Member
Licensed User
Longtime User
Erel and Scantec are both right.
I thought that I had issued "end of line" by hitting "CR" on the PC terminal program but Android is a bit unusual (in my opinion) in that it requires "LF" to indicate end of line. The B4A terminal program from Erel was waiting for this. There is, of course, no LF key on a standard keyboard but you can generate it by pressing "ctrl" and "J". When I did this it all worked.


For reference, in the Serial program from Erel, I did the following mods....

1. Removed "Else .. Serial1.Listen"

2. Connected using "Serial1.Connect3(........)),1)

3. Added to the Disconnect Sub "Serial1.stopListening"

Thanks for the help and suggestions.
 
Upvote 0
Top