Shop OBEX P1 Docs P2 Docs Learn Events
Is there a BS2 eb500 hw flow control sample? — Parallax Forums

Is there a BS2 eb500 hw flow control sample?

tea333tea333 Posts: 10
edited 2006-07-30 20:23 in BASIC Stamp
Is there a BS2 eb500 hardware flow control sample? I've had success accessing the eb500 from a BS2 using the normal SERIN / SEROUT, but I cannot find any samples that actually use the hardware flow control with SERIN, etc.

I'm very familiar with RS-232 flow control but the SERIN docs are not clear on how SERIN/SEROUT deal with RTS/CTS. In fact, the default seems the opposite to what I'd want.·It seems RTS is raised HIGH when SERIN is done, and it goes low when SERIN starts - whenI do the following:
SERIN 0\2,BAUDRATE,BadData,wTimeOut,NoData,[noparse][[/noparse]STR ch\1]

I tried an inverted baud rate but then the \2 doesn't seem to affect RTS at all:
SERIN 0\2,16468,BadData,wTimeOut,NoData,[noparse][[/noparse]STR ch\1]

RTS (pin 2) just stays LOW.
My guess is that the EB500 supports RTS/CTS but the BS2 either doesn't support the right RTS via SERIN 0\n, or I need to use my 0\2 and invert PIN 2.
What surprises me is that I cannot find one BS2 sample that uses EB500 "set flow hardware" to show how hardware flow control works with BS2.
Any help or thoughts on this?
Thanks!

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-07-27 10:22
    tea333 -

    If you are using a line driver (MAX-232 or equivalent) the CTS/RTS and flow pins must go through the line driver too. In other words, if you use flow control and a line driver, you will need 4 channels, two for Rx/TX, and two for CTS/RTS.

    The reason for this is that a line driver, by nature, inverts the signals, and if one set of signals goes through the line driver and the other set does not, they may be out of polarity synchronicity.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • tea333tea333 Posts: 10
    edited 2006-07-27 10:36
    I've got the EB500 wired as an AppMod to a BS2 on the homework board. It is using the following I/O pins for RS-232:

    P0 TX
    P1 RX
    P2 RTS
    P3 CTS

    If the EB500 is connected to an AppMod its signals go to the BS2 as in the docs (partly shown above). This raises several questions.

    1. Is the EB500 a DCE or DTE. I'm guessing DCE but nothing in the docs, including RTS/CTS references clarifies who drives what. I assume the BS2 drives RTS (it is the DTE) to the EB500 (DCE). (Docs for EB500 are here: http://www.parallax.com/dl/docs/prod/comm/eb500UserManual.pdf)

    2. Regardless,·the BS2's SERIN 0\2 will lower pin 2 LOW during SERIN and raise to HIGH after leaving SERIN. This seems opposite to normal HIGH flow control as I've seen it.

    3. Finally, when I tell the EB500 to "set flow hardware" and I tell the BS2 to raise pin 2 to HIGH, I do not see CTS go HIGH (pin 3 from EB500).

    All the above brings me back to the question: Has anyone every really used hardware flow control from the BS2 to the EB500, and if so, is there a .bs2 sample available.

    Any thoughts welcome! Thanks!
  • JonathanJonathan Posts: 1,023
    edited 2006-07-27 14:24
    Tea,

    I have had the same problem in the past. I could never get flow control to work correctly with an eb500 either. I tried with VB, Stamp to Stamp, and through hyperterm. Finally gave up, and just am careful about when I push data.

    If you get a working sample, please let me know, and I'd appreciate a copy of the code.

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • tea333tea333 Posts: 10
    edited 2006-07-27 21:44
    Jonathan, Your confirmation helps. The main thing is that if I don't see the EB500's CTS go high when the stamp's RTS goes high, then it is typically a problem because usually the DCE is immediately ready to accept upon DTE's RTS high (and some settings can make a DCE show its CTS even without seeing the RTS but that in my experience is usually the exception).

    I say all of the above without having tried to reverse things, making the EB500 control RTS, but since I saw addendum warning docs about the EB500's sensitivity to pins being set high when they should not, I thought I'd query before trying something different.

    I think the EB500 docs should be clearer in this area. They should have a sample as well as clear specs on what role it plays, DTE or DCE, and any information about what it can buffer (or not). Since it's handling Bluetooth, I'd imagine it can buffer some certain amount while RTS is low, etc. Knowing that info just makes things clearer - saves a lot of time, and allows one to know professionally how the device stacks up.

    Thanks again for your input!
  • tea333tea333 Posts: 10
    edited 2006-07-28 03:38
    I did some more footwork. The Bluecore2 module on the EB500 has a UART_CTS pin which is active low. My tests show that pin follows the toggling of BS2's OUT2 (pin 2), so when doing a SERIN 0\2... I see Bluecore's UART_CTS follow. Since SERIN in that form supports active low, the UART_CTS goes low on SERIN and high when returning from SERIN.

    I did the same experiment with SERIN 0\3... I do NOT see UART_RTS fluctuate, and in fact, I see a valid low during SERIN but nothing when it returns. I'm guessing this means UART_RTS (as per the Bluecore2 docs) is an output, and since it's active low, it probably stays low and SERIN setting P3 to high doesn't give me a valid high. This would make sense.

    So it seems that each side is a DTE in the sense that you connect what EB500 calls RTS to what BlueCore2 calls UART_CTS. Further, UART_CTS on the Bluecore2 is designated as an input so that would mean DTE. Only DTEs read CTS while output RTS, and DCEs do the opposite (generate CTS and read RTS). So in a logical, if not physical sense, it's essentially a null modem type connection with hardware flow control (connecting RTS to CTS and CTS to RTS). Additionally, RTS / CTS are active low as opposed to high, and SERIN seems to follow that standard so while confusing, it should work.

    After figuring out the above, what puzzles me is what originally puzzled me: It does NOT SEEM TO WORK! If I have a long pause, like PAUSE 5000, and I send data to the EB500 (bluecore2) via bluetooth, it should hold/buffer that data until it sees UART_CTS go low. When I call SERIN, UART_CTS should go high and the data should be read. It works for only a single character, dropping any subsequent characters. If I send "hello" over bluetooth during the pause, I will see 'h' on the next SERIN, but nothing else. Seems lame! I would think the logic to pass on received buffered data would wait until UART_CTS goes active low, buffering more than one character during that time. The bluecore2·seems to have lot's·of space to receive data, so I'm not sure why it only keeps one character if UART_CTS is inactive high (or if it holds more I'm not sure what's wrong).

    Once again, no hw flow sample seems to exist which is probably a sign it may not work much beyond what I've seen above.

    If you·or anyone reading knows more, please POST the info! Thanks!
  • JonathanJonathan Posts: 1,023
    edited 2006-07-28 15:42
    Tea,

    What you are saying basically jibes with what I experienced. I too saw the long pause/single char of a string that you saw. Have you contacted the manufacturer? I would, but I don't have a setup ready to test. Maybe I'll get back on that, but I have been in a high voltage experiment mode lately and would have to set the digital stuff back up. Sure wish I had more room...

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-28 20:24
    It's been a very long time since I have looked at this code, and it's very rough and out of date, but this code was used over a year ago to confirm proper flow control between two BOE/EB500 setups.· I hope this helps.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • tea333tea333 Posts: 10
    edited 2006-07-28 21:03
    Chris, Thanks for your response. I looked at ur samples and they confuse me a little. One uses \2 for SERIN flow control while the other uses \3 for SERIN flow control. The hardware connections should be the same across samples so I'm not sure how both could work for input flow control. (?)

    My review of the Bluecore2 docs along with some logic probe testing, shows that \2 is the one to control Bluecore2's UART_CTS (active low) pin. Not sure why one of you samples has \3 ...(?) but thanks for trying.

    I already have code similar to what you've posted (using \2 for SERIN) but my main questions have to do with ambiguities with the specifications/docs/product.

    It's not clear what input (from Bluetooth) flow control should stop. Since bluecore2 has large buffers, I would think that UART_CTS high (inactive/off) would buffer a nice chunk of data. Right now, it only seems to be one character.

    Can someone at ur company find the skinny on what to expect from EB500 in terms of inbound hw flow ctl? (Forget about any BS2 limitations. I want to know what to expect from the EB500 as a "pure" RS-232 device with receive flow control. Most modems will hold a nice buffer of data, and I'd expect any modem RS-232 Bluetooth device to do the same. ??)

    Any help appreciated!
  • tea333tea333 Posts: 10
    edited 2006-07-28 21:07
    I meant to end that last one like this: I'd expect any modern RS-232 Bluetooth device to do the same. ??

    (modern, not modem.) smilewinkgrin.gif
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-29 20:15
    I will see what I can come up with, but it may be Monday before I can do that.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • tea333tea333 Posts: 10
    edited 2006-07-30 20:23
    Thanks Chris. Sounds great!
Sign In or Register to comment.