This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cc2531bulk发送方式发送错误

Other Parts Discussed in Thread: CC2531

您好,我在尝试将cc2531枚举为大容量存储设备,以bulk方式发送数据,当需要发送一个大的数据包时(比如8K),数据会发送不出去(用bushound没有观察到数据输出)

 

我的发送函数是这样的

 

#define SEND_PACEKT_LEN 64

 

void UsbSendBlock(uint8 *ps, uint32 len)

{

             uint32 index=0;

 

         // USB ready to accept new IN packet

         halIntOff();

 

         oldEndpoint = USBFW_GET_SELECTED_ENDPOINT();

         USBFW_SELECT_ENDPOINT(3);

 

 

         while(!USBFW_IN_ENDPOINT_DISARMED());

 

         // The IN endpoint is ready to accept data

         // Number of bytes present in RF buffer

 

         // Write to USB FIFO

         while(index<len)

         {

                   if(len-index>SEND_PACEKT_LEN)

                   {

                            usbfwWriteFifo(&USBF3, SEND_PACEKT_LEN, (uint8*)(ps+index));

                            index+=SEND_PACEKT_LEN;

                   }else

                   {

                            usbfwWriteFifo(&USBF3, (len-index), (uint8*)(ps+index));

                            index = len;

                   }

                   USBFW_ARM_IN_ENDPOINT();

//USBFW_SELECT_ENDPOINT(5);

                   //USBFW_ARM_IN_ENDPOINT();

                   //while(!USBFW_IN_ENDPOINT_DISARMED());

         }

         //USBFW_ARM_IN_ENDPOINT();

         // Flag USB IN buffer as not ready (disarming EP4)

         //USBFW_SELECT_ENDPOINT(5);

         //USBFW_ARM_IN_ENDPOINT();   // Send data to the host

 

 

         USBFW_SELECT_ENDPOINT(oldEndpoint);

         halIntOn();

 

}

 

上述程序中的注释是我尝试过的发送方式

 

不知道这种bulk方式发送数据有什么问题,导致数据不能发送出去