Varun Mishra
Varun Mishra

Reputation: 121

USB Serial Virtual COM Port : Read not working but write works

I use embedded hardware (by TI : Piccolo Control Stick xxx69) which uses FTDI usb to serial converter hardware.

On PC, I have simple VC++ application which tries to communicate to hardware over Virtual COM port (VCOM : typically COM7).

Data is on the line, because when I use normal hyper-terminal software, I am able to read the data correctly form controller and it is visible. [On controller side, it is all right because we can see data on hyper-terminal.

I am not windows programmer, as I deal with micro-controllers. Therefore, some help in terms to pursue this issue would be of great help.

Best Regards,

-Varun

Here is a Reference

Upvotes: 2

Views: 3322

Answers (1)

Varun Mishra
Varun Mishra

Reputation: 121

Issue is solved. I had to add wait till InQueue > 0 (it means there is atleast 1 byte in receive buffer) or timeout (as safety exit) is over. it would be blocking call but it is OK for my application at the moment. waitComm() did not work well for me here.

sample snippet:

while(1)
    {
        ClearCommError((HANDLE)*h_drv, (LPDWORD)&Err, &CST);

        if((CST.cbInQue >0)||(count >1000000))
        break;

        count++;
    }

Upvotes: 1

Related Questions