Hello,
I am using SDK 15 & Softdevice 6,
I am using NRF52840.
I have merged the USB CDC into a multi-link example.
I confirmed that it worked, and the project was successful.
But there was one problem.
I need debugging and I have activated the log as below.
I have disabled the logs and built and uploaded the logs for the clean operation of the program as below.
However, if you disable the log, USB CDC PORT will not be displayed. I am not sure if an error occurred during USB INIT.
The main sources are:
int main(void) { static uint8_t rgLeRecvBuf[BT_RECVBUF_SIZE]; static bool bFirstScan = false; static uint8_t u8LeRecvBufLen; static int idx; // CDC Code Start #if CDC_Code /* not use gpio -> Output Low setup */ not_used_gpio_init(); UICR_Init(); //jwcheon 1.8V -> 3.0V change ret_code_t ret; static const app_usbd_config_t usbd_config = { .ev_state_proc = usbd_user_ev_handler }; ret = NRF_LOG_INIT(NULL); APP_ERROR_CHECK(ret); ret = nrf_drv_clock_init(); APP_ERROR_CHECK(ret); nrf_drv_clock_lfclk_request(NULL); while(!nrf_drv_clock_lfclk_is_running()) { /* Just waiting */ } ret = app_timer_init(); APP_ERROR_CHECK(ret); //init_bsp(); //init_cli(); app_usbd_serial_num_generate(); ret = app_usbd_init(&usbd_config); APP_ERROR_CHECK(ret); app_usbd_class_inst_t const * class_cdc_acm = app_usbd_cdc_acm_class_inst_get(&m_app_cdc_acm); ret = app_usbd_class_append(class_cdc_acm); APP_ERROR_CHECK(ret); #endif // CDC Code End #if Multi_Code // Initialize. log_init(); timer_init(); leds_init(); buttons_init(); power_management_init(); ble_stack_init(); gatt_init(); db_discovery_init(); lbs_c_init(); ble_conn_state_init(); //gatt_mtu_set(m_test_params.att_mtu); //data_len_ext_set(m_test_params.data_len_ext_enabled); //conn_evt_len_ext_set(m_test_params.conn_evt_len_ext_enabled); //preferred_phy_set(&m_test_params.phys); // Start execution. NRF_LOG_INFO("Multilink example started."); NRF_LOG_INFO("USBD CDC ACM example started."); memset(g_tConnState, 0, sizeof(conn_state_t)*NRF_SDH_BLE_CENTRAL_LINK_COUNT); memset(m_tBTRecvBuf, 0, sizeof(bt_recv_buf_t)*NRF_SDH_BLE_CENTRAL_LINK_COUNT); comm_pkt_init(); comm_pkt_reset_evt(); bsp_buttons_enable(); #endif #if CDC_Code if (USBD_POWER_DETECTION) { ret = app_usbd_power_events_enable(); APP_ERROR_CHECK(ret); } else { NRF_LOG_INFO("No USB power detection enabled\r\nStarting USB now"); app_usbd_enable(); app_usbd_start(); } #endif //init Finish //BSP_BOARD_LED_0 => RED //BSP_BOARD_LED_1 => BLUE //BSP_BOARD_LED_2 => GREEN bsp_board_led_on(BSP_BOARD_LED_0); for (;;) { #if Multi_Code if (m_bScanStart) { if (bFirstScan == false) { bFirstScan = true; bsp_board_led_off(BSP_BOARD_LED_0); bsp_board_led_on(BSP_BOARD_LED_1); nrf_delay_ms(300); } m_bScanStart = false; scan_start(); } tx_buffer_process(); // send ble comm_cdc_recv(); comm_cdc_send(&m_app_cdc_acm); sendConnState(); setSendComplete(); // ble read for (idx=0; idx<NRF_SDH_BLE_CENTRAL_LINK_COUNT; idx++) { if (BTRecvGetData(idx, rgLeRecvBuf, &u8LeRecvBufLen)) { comm_pkt_recvdata_req((uint8_t)idx, rgLeRecvBuf, u8LeRecvBufLen); } } #endif #if CDC_Code while (app_usbd_event_queue_process()) { /* Nothing to do */ } /* if(m_send_flag) { static int frame_counter; size_t size = sprintf(m_tx_buffer, "Hello USB CDC FA demo: %u\r\n", frame_counter); ret = app_usbd_cdc_acm_write(&m_app_cdc_acm, m_tx_buffer, size); if (ret == NRF_SUCCESS) { ++frame_counter; } } nrf_cli_process(&m_cli_uart); */ //UNUSED_RETURN_VALUE(NRF_LOG_PROCESS()); /* Sleep CPU only if there was no interrupt since last loop processing */ //__WFE(); #endif #if Multi_Code idle_state_handle(); #endif } }
Can you give me a clue as to why it does not work?
Thanks!