打印

用VC程序能向C68013写数据,但是读不到数据

[复制链接]
601|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
Leeu9527|  楼主 | 2018-12-3 17:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
why can not read data from  bulkin endpoint 0x86

烧写了slavefifo的固件 slave.iic到芯片的eeprom里了。用自带的 streamer.exe和bulkloop.exe但是只能写,但时回读不到数据。 但是同样的硬件,用labview却是可以读写数据的。
请大神指导下,可能问题出在哪里。

下载了bulkloop.iic之后,完全没法用,芯片被搞挂了,也不能烧回来。


I am using C68013 chip.  I have downloaded the firmware from  AN61345 - Source code slave fifo  slave.iic.



using the newest driver  1.2.3.20 by 11/08/2017 on windows 7 x64.





the FPGA code is OK,  we can wirte and read data using NI-VISA driver and Labview program.



But,

I can write the data to C68013,  but can not read data from C68013.

Here is the VC++ code.  I also used the usb bus hound to look the data , there is also no data in to PC.

please help me, thank you very much!



// out endpoint  is ok

bool UsbTest::SendUsbData(unsigned char *wdata, long writeLength)

{

CCyUSBEndPoint *epBulkOut = m_usbDev->EndPointOf(2);

bool rst = epBulkOut->XferData(wdata, writeLength);



printf("send usb data ok\n");

return rst;

   

}





void UsbTest::RecvUsbData()

{



    long nCount = 0;

    long BytesXferred = 0;

    long outTransferred = 0;

bool m_bBulkLoopCompleted = false;







CCyUSBEndPoint *epBulkIn = m_usbDev->EndPointOf(0x86); // in传输   0x86

if (NULL == epBulkIn)

{

printf("epBulkIn is NULL\n");

return;

}





long totalTransferSize = epBulkIn->MaxPktSize * 16;

//epBulkIn->SetXferSize(10);

//epBulkIn->TimeOut = 1200;



unsigned char data[512] = { 0 };

OVERLAPPED inOvLap;

inOvLap.hEvent = CreateEvent(NULL, false, false, NULL);



        long readLength = 10;



   



UCHAR *inContext = epBulkIn->BeginDataXfer(data, readLength, &inOvLap);

if (epBulkIn->NtStatus || epBulkIn->UsbdStatus)

{

printf("BeginDataXfer Failed with (NT Status = 0x%X and USBD Status = 0x%X). Bailing out...\n", epBulkIn->NtStatus, epBulkIn->UsbdStatus);

}





        //////////Wait till the transfer completion..///////////////////////////

        if (!epBulkIn->WaitForXfer(&inOvLap, 150))

        {

/*

            epBulkIn->Abort();

if (epBulkIn->LastError == ERROR_IO_PENDING)

{

WaitForSingleObject(inOvLap.hEvent, 1500);

}*/

        }

      

        ////////////Read the trasnferred data from the device///////////////////////////////////////

bool success = epBulkIn->FinishDataXfer(data, readLength, &inOvLap, inContext);

      

printf("read usb data ok\n");

for (int idx = 0; idx < 64; ++idx)

{

printf(" 0x%x, ", data[idx]);

}



Sleep(300000);



   



}
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

1

帖子

0

粉丝