Shop OBEX P1 Docs P2 Docs Learn Events
BlueTooth eb500 <--> TclTk — Parallax Forums

BlueTooth eb500 <--> TclTk

janbjanb Posts: 74
edited 2006-12-30 19:08 in Propeller 1
<!--StartFragment -->·Hi,
I'd like to use· BlueTooth eb500 + Propeller on one end
and WinXP PC+ DLINK DBT-120 + Tcl scripts on the other end
to make 2-way serial communication between PC & Propeller.

Got various pieces to work (somehow) and have 2 big problems.

Let me start with the Spin code:
wrk6.spin
Creates one·"Simple_Serial" object and uses 2 cogs to
a)
·write a simple text to the ep500
FromProp=D=
FromProp=E=
FromProp=F=
FromProp=G=· (so I can see it o Hyp-term on the PC·screen and know it writes new string ever 2 seconds)
b) at the same time it reads string typed in to the Hyp term on the PC and prints characters to the local TV hooked up to the Propeller.
Read & write are async - I used 2 cogs.

It works fine if I use Hyp term on WinXP Pc.

Now I want to replace Hyp term w/ a Tcl script.

I wrote 2 separate test scripts to read & write:
rdBlueRS232.tcl and wrBlueRS232

Both have ~5 lines and work fine under WinXP.

Q1:
I'd like to have the same· Tcl script which reads & writes to the ep500. \
Well, in the ep500 manual it says many times there are 2 COM ports associated w/ a bluetooth device : one to read & another 2 write.
I see both ports in the WinXP setup (see attachment) but both Tcl scripts work only if I use the 'out' port.
If I try to use the 'inp' port scripts do nothing.
I can't open the same COM port to read & write in TCL -'illegal access mode "rw"'
Note, also my Hyp term·uses·only the·'out' com-port and seems to do both read & write?
Any suggestions?
I'm using ep500 default for transmission: 9600,n,8,1

Q2: In this whole game I skipped initialization of ep500. I found by accident it is enough to fire once Hyp-term to do the full initialization (also of the remote ep500). It· holds· as long as I do not power cycle the ep500.
I· tried·to write a method 'init_ep500' (belongs to the same spin OBJ) but it does· not work·(ep500<--Tcl does not work)·and is commented out.
·Again any hint would be appreciated.
Yes, I checked·few times the pins for status & mode are assigned properly, verified w/ LED· both go up/down after specific line of code.
The Tx & Rx pins are right because Hyp term & Tcl scripts read/write proper data.
Q3:
There is also a small problem w/ c:=rs.rx.
If there is no data sent to ep500 it picks up some stray characters (like "NP$%^") every few secons. But I can live with this - it does not happend if here·are any real characters sent to ep500.

Sorry for this long mail
Jan

Post Edited (janb) : 12/30/2006 7:06:24 PM GMT

Comments

  • janbjanb Posts: 74
    edited 2006-12-30 19:08
    Hi,
    found solution to Q1. To open COM port to read & write in Tcl one needs to do:
    set fd [noparse][[/noparse]open $COMMPORT r+];
    An example Tcl script which reads & writes to ep500 at the same time is attached:
    rdwrBlueRs232.tcl

    Still don't know how to init ep500 after hard reset using a sipn code - my question #2.
    Thanks
    Jan
Sign In or Register to comment.