Is there a BS2 eb500 hw flow control sample?
tea333
Posts: 10
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:
I tried an inverted baud rate but then the \2 doesn't seem to affect RTS at all:
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!
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
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 -->
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!
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
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!
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!
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 Savage
Parallax Tech Support
csavage@parallax.com
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!
(modern, not modem.)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com