Rs232/string question

hi every body, i m working on a contribution for the arduino, as the firmata is too much complex for an easy use.
I m porting the little protocol i have made for whitecat to be usuable in input/or/and/ output with any arduino.
Doc is there: http://www.le-chat-noir-numerique.fr/whitecat/dokuwiki/doku.php?id=configuration_arduino_eng

The sketch is ok, works fine with whitecat, so definitively i think i m encountering a trouble in the vvvv patch i m actually trying to write.

My problem is that the rs232 nodes receives data continuously, like a serial port would do, but i cant get the indication of the last byte, wich is sended being a return of carryage. The result is a confusion in the data readen being AN/ type ( Analog) and DG/ type ( Digital). There is mix between arrays, and i think this is due to the moment of the capture of the RS232 data flow.

is there any trick to get the return of carriage ? or to know that the received data is complete ( in C code i m waiting for a END OF LINE car.)

I have tried CDR(string) and byte(decimal) > as value = 13
but refreshment of values fall down completely.
The return of carriage is not recognized on last caracter of the string received !

So any idea to S+H correctly the input from RS232 will be really appreciated ;-)

arduino_whitecat_protocol.v4p (58.2 kB)
whitecat_arduino_for_vvvv.zip (2.2 kB)

Haven´t had a look at your patches, but from your description I´d say Tokenizer (String) does what you are looking for.

hi bjoern, founded it was a 10 value needed ( end of line)
but still having mismatch between the two structures ( AN and DIG) .

Does Tokenizer saves this type of troubles ?

arduino_whitecat_protocol.v4p (59.9 kB)

hi karistouf,

have a look at @korriander))'s basicmata-arduino-interface (the included vvvv-patch). i think this should give you a good idea how to decode the sent values using ((node:Tokenizer (String)

i’m looking forward to your contribution :)

hi motzi, thanks a lot. and thanks for basic mata link.
;-)

no my problem is not Tokenizer.
I have the rs232input not receiving correctly the two types of messages sended by arduino.

Analogic are received correctly, AN/ and Bytes with data
But digital signal is crashed at the incoming, i m never having in vvvv RS232 node the DG/ keyword.

Its very strange, has the script works perfectly with whitecat. there may be a kind of subtility ( mainloop ? baudrate needed to be set higher ? a peculiar way to flush or handle the RS232 port ?) i m not used to …

If Uncle Kalle and Uncle West are around , it would be great to have their advices !

Have you set ‘increase timing precision’ in the mainloop?

rs232 is pretty unpredictable without that in my experience

Ok i will put it, thanks for the advice.
I m usually using 9600 bauds com do you think its necessary to go upper

Hum strange

By the way no help node in f1

What are devvvvs recommandations?

hum precision didnt do anything.
The S+H string captured string is changing of length all the time… very weird

what i m not understanding is that it works ok with AN/ wich are actually set to 3, so at total a message of 3bytes header + 3 bytes data + 1 byte ending (dec value 10)

and this doesnt work with dig, a message of 3 bytes headers + 13 bytes data + 1 byte ending ( dec value 10)

arduino_whitecat_protocol.v4p (67.8 kB)

ok, i didn’t look at your patch in great detail, but i think you’ll find parts of it can be simplified using this plugin:
asascii-(string-hex)

oi karistouf,

in the end, did you ever try tokenizer?

looking at your patch you assume that incoming serial data is arriving as one integer packet. data+delimiter at the end.
due to arduino and vvvv not being in sync you might get partial packets or more packets at a time, so the delimiter might not be at the end.
tokenizer is the one for fixing that. you should be able to use your delimiter as separator.

i always use custom bytewise serial data between arduino and v4 and there hasn’t been the case of v4 receiving something else than the arduino sent.

for debugging, you might just want to record some frames of data into a textfile (and post it into the forum)

setting a slower framerate, and faster baud rate could help.

What are your current setting for these?

hi master woei, and hi mrBoni.
well i m quite puzzled, because in C code i m just waiting the ending caracter to analyze incoming data. its stored and then i m flushing the port
maybe i should use a queue (string node) waiting for it. and process analyze at this moment.
eh eh… puzzling with method ;-) what i need is to store the data correctly. and so i presume now that RS232 is not keeping data inside itself !

thanks for your advice mrboni! i m using usually at 50 fps core and 25 to 50 fps request data, at 9600 bauds for a clasic arduino set ( 13 IO 6 Ana).

some work so i would come again on this topic sunday.

merci!

i’d say the v4 rs232 node reads the port each frame and then flushes it, no matter whats inside.
try yourself by blocking v4 (e.g. open up the save dialog).
so you have to care about stitching the parts together and splitting it after the delimiter by yourself. and thats what tokenizer is supposed to do.

increase your baud rate fo sho. is there a reason you’re using 9600?

tokenizer should work though. I had some problems with it in the past but I can’t remember what now and there’s a high chance I was being dumb :)

Hum high chance i m also a dumb.

Tokenizer was for me a kind of scanf. Not a buffer
Ok i keep you informed in some days about this topic. Thxs for your gentle help!