This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

usbDeviceError in USB CDC connection

Hello everyone,

I have a following problem, I am trying to use my LPC4357 on MCB4300 as USB Host for CDC connection.

I have the simplest code

#include <stdio.h>
#include "cmsis_os.h"
#include "rl_usb.h"                     // Keil.MDK-Pro::USB:CORE
#include "RTE_Components.h"             // Component selection
#include "EventRecorder.h"

int main(){

    usbStatus usb_status;                 // USB status
    uint16_t deviceVID;

    osKernelInitialize();
    osKernelStart();

    EventRecorderInitialize(EventRecordAll, 1);
    EventRecorderStart();
    USBH_Initialize(0U);
    for(;;){
        usb_status = USBH_CDC_ACM_GetDeviceStatus(0U);
        if(usb_status != usbDeviceError && usb_status != usbClassErrorCDC){
            deviceVID = USBH_Device_GetVID(0);
            if (deviceVID != 0x00) {
                for (;;) {}
            }
        }
    }
}

In this line usb_status = USBH_CDC_ACM_GetDeviceStatus(0U); I always get usbDeviceError,
I have tried different devices and it doesn't work, when I use the same code but use device class "Mass storage"(USB stick) with USBH_MSC_GetDeviceStatus(0U) or "Human Interface device"(USB keyboard) with USBH_HID_GetDeviceStatus(0U) it works,
what am I doint wrong. Thanks