Shop OBEX P1 Docs P2 Docs Learn Events
eb500 + BOE + BS2sx — Parallax Forums

eb500 + BOE + BS2sx

jcobrerosjcobreros Posts: 2
edited 2010-11-14 14:38 in Accessories
Hello. Like the title says I'm trying to use an eb500-SER Rev D. Bluetooth module plugged into the App-Mod of a BOE Rev C with a Basic Stamp BS2sx.

I have a couple of problems. Mostly I'm trying to send commands to the eb500 (like "ver all", "lst visible", etc) to test it's configuration. The problem is that the serial connection from the BOE goes to Sin and Sout of the BS2sx, and it doesn't reach the eb500. If I try hyperterminal the eb500 (using the Bluetooth COM port) it connects, but then the eb500 is in data mode and it just bridges what I type to the BS2sx, instead of answering my commands.
I've tried to have the BS2sx act as a bridge between the DEBUG cable and P0 and P1 (the internal serial connection that goes to the eb500). I've written a program with the commands DEBUGIN, SERIN, DEBUG, and SEROUT, that waits for commands from DEBUG, captures a string, and sends the string to the eb500, then does the same with the eb500 reply.
The problem with this is that there seems to be a maximum string length of 20 something chars, so I can't get the full reply of the eb500.
The second problem is that I get inconsistent responses with errors. The responses are not always the same, and some letters are always messed up.

My question is, is there a way to communicate with the eb500 directly while it is in command mode? (In the manual they use a serial board for the eb500).
And also, has someone else had problems of data corruption like randomly truncated msgs, random line breaks, missing letters?

Sorry for the long and boring post. I hope somebody can give me some advice.
Thanks!!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-11-14 12:25
    It's really difficult to do what you want in that the BS2sx (and all the Stamps) is single threaded and can only do one thing at a time. If it's listening for information from the PC, it can't listen to the EB500. When it's listening to the EB500, it can't listen to the PC. In command mode, you're a bit better off in that the command sequences are well defined and the EB500 doesn't respond until the command is received.

    The BS2sx has 64 bytes of scratchpad RAM that's usable with GET and PUT statements. You'll have to receive characters one at a time to store them there. That helps with the limited variable storage of the Stamps. The BS2p series Stamps has the ability to do SERIN directly to scratchpad, but the BS2sx does not. The BS2sx may be fast enough to use the scratchpad RAM, you'll have to try it to see.

    You should be able to use the USB2SER adapter to connect the EB500 directly to a PC for configuration and experimentation.
  • jcobrerosjcobreros Posts: 2
    edited 2010-11-14 13:29
    Hello Mike, and thanks for the quick reply!
    You were right :) And the fact that the BS2sx doesn't accept SPSTR to send data to the ScratchPad doesn't help at all.
    I need to have a program read all the available Bluetooth devices, which the eb500 spits out as multiple text lines.
    I don't want to ask the easy question, but I can't find it anywhere.
    Do you know how I could get one character at a time from SERIN and put it into scratchpad? Putting it into the scratchpad is easy, but how do I get one character at a time without loosing the rest of the string?
    Thank you for your help
  • Mike GreenMike Green Posts: 23,101
    edited 2010-11-14 14:38
    Unfortunately, the BS2sx just isn't fast enough to get all that's needed done in the 100us or so during the stop bit at 9600 Baud.

    You'll need to switch to a BS2p/pe/px so you can use the SPSTR prefix or you could switch to something like a Propeller which is fast enough and has enough memory.

    If you had a limited number of items to process like Bluetooth addresses, you could use the WAIT prefix in a single SERIN and the HEX2 formatter to break apart a single Bluetooth address in a single SERIN. By having several different SERIN statements, each with a different number of WAIT prefixes, you could handle the 1st address in a list in one SERIN, the 2nd address in a list with another SERIN, etc. for some fixed number of SERIN statements.

    Note that HEX "gobbles up" the 1st non-hex character after one or more hex characters.

    This handles a list with one or more entries saving the first entry:

    SERIN 0,84,[WAIT(“ACK”,CR)]
    SERIN 0,84,[HEX a,HEX b,HEX c,HEX d,HEX e,HEX f,WAIT(">")]

    This handles a list with two or more entries saving the second entry:

    SERIN 0,84,[WAIT(“ACK”,CR)]
    SERIN 0,84,[WAIT(CR),HEX a,HEX b,HEX c,HEX d,HEX e,HEX f,WAIT(">")]
Sign In or Register to comment.