Forum

More RS232 - data read delays?

hello all-

i too have been experimenting with the RS232 node and Bluetooth. i have a small app sending data from my pocket pc over bluetooth to the bluetooth serial port (COM4) in my laptop. as with some others’ rs232 setups, it works great when sending and receiving from HyperTerminal. and monitoring the traffic on COM4 with a port monitor shows nice little bursts of activity when a i send or receive some data from the PocketPC to HyperTerminal.

But, when i connect with the RS232 node, using the same settings, i can SEND data out pretty well, but it seems i can only RECEIVE data when i send it in large blocks. Also, the Port Monitor switches into overdrive and it seems vvvv is sending a READ command to COM4 once every MainLoop frame. it almost seems as if this is keeping the port so busy, it can’t grab the data unless its timed just right - but perhaps its just a coincidence? i have to constantly press ‘send’ on my PocketPC app and every once in a while, data will come thru.

is there some kind of buffer that fills up before it dumps into vvvv? is there any way to have 4v READ from COM4 only when data comes thru- as it does in HyperTerminal? i tried different Baud rates and MainLoop rates and neither seemed to make any difference.

i searched through all the other rs232 threads and found bits and pieces, but no one seemed to have this particular issue. any thoughts?

yes, vvvv issues a READ every frame - the basic intent is obviously here to get any incoming data as soon as possible into vvvv. this is the expected behaviour.

three thoughts:

(1) there are occasionally some buffers somewhere down in the driver, and especially with Bluetooth they make sense for certain applications. so there might be some option in the windows control panel options for the driver. look for things called FIFO.

(2) vvvv tries to run as fast as possible and tries to consume as much cpu as legally possible in windows. some foolishly written bluetooth drivers might have a lower-than-normal process priority and dont get enough cpu as soon as vvvv is running. Try using Mainloop (VVVV) to limit vvvvs frame rate/ CPU consumption, or use Boost (VVVV) with enabled=-1 (sic!) to lower vvvvs process priority.

(3) i have seen user @Milo hacking an alternative (spreadable!) RS232 node in c# as a plugin in a couple of hours. perhaps its possible with c# to access some more high level options to deal with serial bluetooth devices.

is there some kind of buffer that fills up before it dumps into vvvv? is there any way to have 4v READ from COM4 only when data comes thru- as it does in HyperTerminal? i tried different Baud rates and MainLoop rates and neither seemed to make any difference.

i searched through all the other rs232 threads and found bits and pieces, but no one seemed to have this particular issue. any thoughts?

thanks oschatz, for some good ideas!

i have been looking into the problem a bit more. the MainLoop does definitely read from the serial port every frame - but upon closer inspection, it turns out that this does not seem to be limiting the serial data transmission after all. in my serial port monitor, i see vvvv’s request:

0.00000279 vvvv.exe IOCTL_SERIAL_SET_QUEUE_SIZE Serial3 SUCCESS InSize: 2048 OutSize: 2048

so, from the Terminal program on my PocketPC, if i send 2048 bytes at once, the data comes through to vvvv immediately. if i send less than 2048 bytes, i have to send multiple times, until the data totals 2048 bytes - then it all comes through in one long data block.

i did find the FIFO buffer settings, and changed them and turned them off, but this didn’t seem to affect anything. close, but not quite! seems like vvvv has a minimum data block size it can accept?

the standard rs232 module doesn’t seem to have any options that would address this low level setting. and i dont have the c# skills to write a plugin that would open up these settings. perhaps i can just send 2kb messages everyframe? doesn’t seem like the most efficient thing to do when i’m just trying to send XY coordinates of my PocketPC touchscreen (at least for now).

any other ideas?

hello again-

i have still yet to figure this out - been trying lots of things, but no luck yet…

i thought perhaps a specific serial message would trigger the rs232 node immediately, instead of waiting till the queue fills up. but i haven’t been able to find anything like that - and i’m not sure what the rs232 would be listening for anyway.

i tried using the Port(device) node, but i haven’t been able to find the port address for my Bluetooth Serial COM port. would anyone know where to find this? also, i looked in the Device Manager and could i’m not even sure if the Port node can talk to a virtual serial such as this- maybe it can only work with a real hardware port?

i might start to look into a new plugin, i wonder if that may address the serial issues.

or perhaps i can code my PocketPC app to send MIDI messages over the serial link. though i’m not sure how i would make the PC recognize it as a MIDI connection. maybe i would have to code some custom serial/MIDI receiver/ driver to get the MIDI accesible to PC apps.

still at the drawing board!