This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

usbd_cdc_acm example recognized by PC but cdc_acm_user_ev_handler never called

From the latest Nordic SDK 15.2, I'm running the usbd_cdc_acm example on an NRF52840 connected to a PC using USB. The firmware correctly executes the USBD_POWER_DETECTION code path, usbd_user_ev_handler events notify correctly and the PC lists the device's COM port in device manager. Nice!

My simple PC program that opens a serial port and writes characters down the wire works fine over any Arduino device, is able to connect to the 52840 COM port listed in device manager, even the writes are successful, however the firmware never receives events of any kind in the cdc_acm_user_ev_handler callback, no connection event, not RX events, nothing.

Any ideas? Thanks!

Parents
  • Hi,

    Are you testing this with the example from the SDK, or did you modify it in any way? 

    Did you test it on nRF52840 DK, or on a custom board?

    Best regards,
    Jørgen

  • Hi Jørgen,

    Correct this is the unmodified example from the SDK. I'm running this on a Fanstel BT840 module. The example app is recognized as a proper COM endpoint device in Windows Device Manager so the USB connection is evidently valid. 

    When my PC serial port test app connects to the COM port, I notice in app_usbd_cdc_acm.c that the event callback in setup_req_class_out is called with APP_USBD_CDC_REQ_SET_LINE_CODING, followed by a APP_USBD_CDC_REQ_SET_CONTROL_LINE_STATE event. However line_state is always APP_USBD_CDC_ACM_SERIAL_STATE_BREAK so new_dtr is always false, so the following if (old_dtr == new_dtr) never allows the user_event_handler to be called with APP_USBD_CDC_ACM_USER_EVT_PORT_OPEN.

    Various other APP_USBD_CDC_REQ_SET_LINE_CODING and APP_USBD_CDC_REQ_SET_CONTROL_LINE_STATE calls are made with line_state always APP_USBD_CDC_ACM_SERIAL_STATE_BREAK.

    Thanks!

Reply
  • Hi Jørgen,

    Correct this is the unmodified example from the SDK. I'm running this on a Fanstel BT840 module. The example app is recognized as a proper COM endpoint device in Windows Device Manager so the USB connection is evidently valid. 

    When my PC serial port test app connects to the COM port, I notice in app_usbd_cdc_acm.c that the event callback in setup_req_class_out is called with APP_USBD_CDC_REQ_SET_LINE_CODING, followed by a APP_USBD_CDC_REQ_SET_CONTROL_LINE_STATE event. However line_state is always APP_USBD_CDC_ACM_SERIAL_STATE_BREAK so new_dtr is always false, so the following if (old_dtr == new_dtr) never allows the user_event_handler to be called with APP_USBD_CDC_ACM_USER_EVT_PORT_OPEN.

    Various other APP_USBD_CDC_REQ_SET_LINE_CODING and APP_USBD_CDC_REQ_SET_CONTROL_LINE_STATE calls are made with line_state always APP_USBD_CDC_ACM_SERIAL_STATE_BREAK.

    Thanks!

Children
No Data
Related