USB serial become stuck sending data

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
streammaster
Posts: 78
Joined: Mon Jul 31, 2017 11:14 am
Has thanked: 7 times
Been thanked: 13 times

USB serial become stuck sending data

Post by streammaster »

Hi Guys,

I'm not sure if this is related to V8 only, but i'm trying to get it going using the FC8.
This is related to the "USB serial" communication component in FC8.
I get USB serial transferring data to and from Windows 10 application all working fine. As long there is a connection, and an application is running on W10 to receive data the PIC is all happy. However if there is no application to receive data on PC side, but USB is connected, sending data from PIC will hang (not 100% sure if is send or receive which actually hangs). It is actually not hang, but just it is waiting that some buffer become empty. It sounds like some low level handshake on USB port. As long as i start the application on PC (PUTTY) the PIC continues to work (execute my main loop). Even the USB is disconnected the PIC is waiting!!

I implement the detection of USB voltage and if the USB cable is not connected it skips the USB routine completely, and main loop is continue to execute. This is working as expected. However when I plug the USB back, PIC starts to send data to USB and since there is no application running on PC side everything looks like it hang. Once it hang and USB is never connected again it will wait for ever.

There is no feedback or time out from the Send data macro (SendByte), or setting send time out. How I can work around this problem?

I also noticed that the initialize macro command supposed return time out (255) or OK (0), but i can not get this going either: if the USB is not connected the initialize would become stuck (would not time out as expected) and would never return 255.

Could you please help with this issues?

Regards,

Igor

Post Reply