Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

USB CCID class with nordic nRF52840

I am developing USB CCID driver class for nordic nRF52840. I used USB CDC-ACM class as reference and tried to implement for USB CCID. I have developed the device descriptor for it.

USB CCID class has 1 interface and 3 endpoints(1 for interrupt, 1 for bulk IN and 1 for bulk OUT). Now the windows is detecting as Microsoft Usbccid smart card reader(WUDF)

In modify the app_usbd_ccid_internal.h, i need to know modification to be done in 

1. class instance data (app_usbd_ccid_inst_t)

2. CCID class specific request handled via control endpoint (app_usbd_ccid_req_t)

3.  ccid context (app_usbd_ccid_ctx_t)

I have attached my app_usbd_ccid_internal.h file with tis for refrence.

app_usbd_ccid_internal.h

Parents Reply Children
  • Hi Håkon,

    I am developing USB CCID driver class which not exist in nRF52 SDK. 

    Nordic guy (kenneth) refer me to use USB CDC-ACM class as reference for developing USB CCID class driver.

    https://devzone.nordicsemi.com/f/nordic-q-a/38402/need-support-for-usb-ccid-using-nrf52840

    I have modified all the USB CDC class files in order to detect as USB CCID. Files are,
    1. app_usbd_ccid_types.h
    2. app_usbd_ccid_internals.h
    3. app_usbd_ccid_desc.h
    4. app_usbd_ccid.h
    5. app_usbd_ccid.c

    I have successfully written the Interface and class descriptor for CCID and I have tested it. Now the windows shows correctly Microsoft usbccid smart card reader(WUDF).

    Now I need to modify further more in order to finish the USB CCID class driver. So i need to know parameter details of

    1. usb class instant data (app_usbd_class_inst_t) (Here class will be cdc or audio or msc or HID, in my case it is ccid, app_usbd_ccid_inst_t).

    2. class context( app_usbd_class_ctx_t,  Here class will be cdc or audio or msc or HID, in my case it is ccid, app_usbd_ccid_ctx_t).

    3. class specific request handled via control endpoint ( app_usbd_class_req_t,  Here class will be cdc or audio or msc or HID, in my case it is ccid, app_usbd_ccid_req_t).

    I have attached my app_usbd_ccid_internal.h file for your refrence.(above)

  • Hi,

    Mohammad said:
    Now I need to modify further more in order to finish the USB CCID class driver. So i need to know parameter details of

    1. usb class instant data (app_usbd_class_inst_t) (Here class will be cdc or audio or msc or HID, in my case it is ccid, app_usbd_ccid_inst_t).

    2. class context( app_usbd_class_ctx_t,  Here class will be cdc or audio or msc or HID, in my case it is ccid, app_usbd_ccid_ctx_t).

    3. class specific request handled via control endpoint ( app_usbd_class_req_t,  Here class will be cdc or audio or msc or HID, in my case it is ccid, app_usbd_ccid_req_t).

    Unfortunately, we do not have a document/guide specifically on how to create a own usb class.

    The parameters you're asking for is defined in the USB CCID class itself, which you can find here: https://www.usb.org/sites/default/files/DWG_Smart-Card_CCID_Rev110.pdf.

    To implement these into the USBD framework, I would recommend looking at the already present classes, and the documentation for USBD:

    https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_usbd.html?cp=6_1_3_60

     

    Kind regards,

    Håkon

  • Hi,

    Thanks for your response.

    Can you let me know how to receive the data from the specific endpoint.

  • Hi,

     

    When using app_usbd, see the event handler, in case of the cdc, cdc_acm_event_handler, case "APP_USBD_EVT_DRV_EPTRANSFER".

    Kind regards,

    Håkon

  • Hi,

    Thanks for your response.

    Can you specify your answer more clearly where i can refer in the cdc code for receive the data from endpoint.

    For example, to send the data in endpoint(EP0), i use the following code,

    ret_code_t ret;
    nrf_drv_usbd_transfer_t transfer =
    {
       .p_data = {.tx = p_data},
       .size = size
    };
    ret = nrf_drv_usbd_ep_transfer(NRF_DRV_USBD_EPIN0, &transfer);

    As per your above statement, once the NRF_DRV_USBD_EVT_EPTRANSFER event is generated, it calls cdc_acm_endpoint_ev where the type of endpoint is check.

    If it is bulkout endpoint, cdc_acm_rx_block_finished is called once the NRF_USBD_EP_OK is OK.

    But i need to know how to copy the data from the endpoint.

Related