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.

CC2540 USB send data

Other Parts Discussed in Thread: CC2540

请教各位大侠一个关于CC2540 USB的问题,具体的code如下:

// Poll for data to USB.
void usbHIDSendData(void)
{
    uint8 ep = 0x00;
    uint8 max = HAL_UART_USB_TX_MAX;
   
    // Save current endpoint
    ep = USBFW_GET_SELECTED_ENDPOINT();
   
    // Select endpoint4
    USBFW_SELECT_ENDPOINT(4);
   
    // If the IN endpoint is ready to accept data.
    if (USBFW_IN_ENDPOINT_DISARMED() && (ucUSB0Send == 1))
    {
        if(isrCfg.rxHead != isrCfg.rxTail)
        {
            do
            {
                USBF4 = isrCfg.rxBuf[isrCfg.rxHead++];
            } while ((isrCfg.rxHead != isrCfg.rxTail) && (0 != --max));
           
            USBFW_ARM_IN_ENDPOINT();
        }

        // rx buffer empty
        if (isrCfg.rxHead == isrCfg.rxTail)
        {
            isrCfg.rxHead = 0x00;
            isrCfg.rxTail = 0x00;
            ucUSB0Send = 0;
        }   
    }
   
    USBFW_SELECT_ENDPOINT(ep);
}

使用endpoint4作为fifo,先讲rxBuf中数据写入endpoint4,然后USBFW_SELECT_ENDPOINT(ep);

但是用Bus Bound监听不到数据,不知道是不是Bus Bound不能被动接受数据还是USB寄存器配置的不对?

USB 发送数据还要配置那些寄存器啊?

希望ti的工程师能够提供一些帮助,也欢迎各位大侠不吝赐教。

  • Which code you are based on your development ?

    What is the USB descriptor is using ?

    Generally, data send/ receive has to be matched with the USB descriptor.

  • 因为要实现HID功能,所以我的code是基于HIDAdvRemoteDongle,但是我对 USB descriptor做了一些修改,

    输入输出均采用endpoint4,大小均为64Byte,具体见附件,麻烦您帮忙看一下,

    谢谢。

  • 您好 kong lei,

    我现在也在使用CC2540 USB,我想要实现DONGLE通过USB和PC的简单数据传送,数据发送函数和您用的是一样的,使用串口调试助手监听不到数据,使用IAR调试的时候发现USBF4中并没有写入数据,我想知道您的问题解决了吗,能不能给我一些指点?十分感谢您的帮助。

    YAPENG

  • 其实重点在USB descriptor,USB device的PID和VID也很重要,我采用的我们公司自己的PID和VID,

    将CC2540虚拟成了可以进行大量数据读写的设备。

    你再仔细检查一下USB descriptor部分吧,

    祝你好运。

x 出现错误。请重试或与管理员联系。
x 出现错误。请重试或与管理员联系。