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

Can I modify source code for the vitual com of nRF52833 USB CDC ACM in \examples\peripheral\usbd_cdc_acm?

Hi, 

   we are using D- and D+ in our nRf52833 board,    I want to use the CDC ACM USB class  as Virtual COM port.

  I found that there has a demo example in the \examples\peripheral\usbd_cdc_acm,  but it is only used for nRf52840,  

  Could I modify it for nRF52833?

Parents Reply Children
  • Hi Simonr,

        initialize() and start()  are about Mesh

    static void mesh_init(void)
    {
        mesh_stack_init_params_t init_params =
        {
            .core.irq_priority       = NRF_MESH_IRQ_PRIORITY_LOWEST,
            .core.lfclksrc           = DEV_BOARD_LF_CLK_CFG,
            .models.config_server_cb = config_server_evt_cb
        };
        uint32_t status = mesh_stack_init(&init_params, &m_device_provisioned);
        switch (status)
        {
            case NRF_ERROR_INVALID_DATA:
                __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Data in the persistent memory was corrupted. Device starts as unprovisioned.\n");
                __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Reset device before starting of the provisioning process.\n");
                break;
            case NRF_SUCCESS:
                break;
            default:
                ERROR_CHECK(status);
        }
    #if 1//NRF_MESH_SERIAL_ENABLE
        ERROR_CHECK(nrf_mesh_serial_init(NULL));
    #endif
        m_evt_handler.evt_cb = mesh_evt_handler;
        nrf_mesh_evt_handler_add(&m_evt_handler);
    }
    static void initialize(void)
    {
        ERROR_CHECK(app_timer_init());
        hal_leds_init();
        __LOG_INIT(LOG_MSK_DEFAULT | LOG_SRC_DFU | LOG_SRC_APP | LOG_SRC_SERIAL, LOG_LEVEL_INFO, log_callback_rtt);
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- Bluetooth Mesh DFU Example -----\n");
        ble_stack_init();
        mesh_init();
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initialization complete!\n");
    }
    static void start(void)
    {
        if (!m_device_provisioned)
        {
            static const uint8_t static_auth_data[NRF_MESH_KEY_SIZE] = STATIC_AUTH_DATA;
            mesh_provisionee_start_params_t prov_start_params =
            {
                .p_static_data = static_auth_data,
                .prov_complete_cb = NULL,
                .prov_device_identification_start_cb = NULL,
                .prov_device_identification_stop_cb = NULL,
                .prov_abort_cb = NULL,
                .p_device_uri = EX_URI_DFU
            };
            ERROR_CHECK(mesh_provisionee_prov_start(&prov_start_params));
        }
    #if 1//NRF_MESH_SERIAL_ENABLE
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Enabling serial interface...\n");
        ERROR_CHECK(nrf_mesh_serial_enable());
    #endif
        mesh_app_uuid_print(nrf_mesh_configure_device_uuid_get());
        ERROR_CHECK(mesh_stack_start());
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "DFU with usb driver example started!\n");
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "bootloader_id is 255\n");
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "application_id is 255\n");
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "other is same with srd3_radar_sensor\n");
    }
Related