Multi-NUS with USB CDC Support upgraded to SDK v2.5.0

We have Multi-NUS running with USB CDC Support upgraded to SDK v2.5.0, but I only have Rx working when connected to another dev board running the Peripheral UART Sample.  I'm not sure why Tx (sending from Multi-NUS central to the Peripheral) isn't working.  Attached (link below) is my project.  Please let me know your thoughts.

dongle.zip

Thanks,

Starbuck

Parents
  • Hi Hieu,

    Here's a little more information from my debugging today.

    I added the following LOG print in the main for() loop to see how many bytes are retrieved from the fifo_uart_rx_data.

    	for (;;) {
    		/* Wait indefinitely for data to be sent over Bluetooth */
    		struct uart_data_t *buf = k_fifo_get(&fifo_uart_rx_data,
    						     K_FOREVER);
    		LOG_INF("Received: %d bytes", buf->len);
    		multi_nus_send(buf);					
    		k_free(buf);
    	
    	}

    I also adjusted and added a few more LOG prints to the Broadcasting section of the multi_nus_send() function:

    	}else{//Broadcast message
    		LOG_INF("Broadcasting to %d peers", num_nus_conns);
    		for (size_t i = 0; i < num_nus_conns; i++) {
    			const struct bt_conn_ctx *ctx =	bt_conn_ctx_get_by_id(&conns_ctx_lib, i);
    
    			if (ctx) {
    				struct bt_nus_client *nus_client = ctx->data;
    
    				if (nus_client != NULL) {
    					err = bt_nus_client_send(nus_client,
    								     message,
    								     length);
    					if (err) {
    						LOG_WRN("Failed to send data over BLE connection"
    							"(err %d)",
    							err);
    					}else{
    						LOG_INF("Sent to server %d: %s", nus_index, buf->data);
    					}
    
    					bt_conn_ctx_release(&conns_ctx_lib,
    							    (void *)ctx->data);
    
    					err = k_sem_take(&nus_write_sem,
    							 NUS_WRITE_TIMEOUT);
    					if (err) {
    						LOG_WRN("NUS send timeout");
    					}
    				} else {
    					LOG_WRN("nus_client is NULL");
    				}
    			} else {
    				LOG_INF("No connection context found for connection ID %d", i);
    			}
    		}
    	}
    	LOG_INF("Message sent");
    	return err;
    }

    Test Results:

    I only see the "Received: x bytes" and "Broadcasting to 4 peers" print the first time I send something to be transmitted over the Central's USB CDC port.  These prints are not printed out the second time I send text to be transmitted to the Peripheral.  See prints and screenshot below.

    SEGGER J-Link V7.94e - Real time terminal output
    SEGGER J-Link (unknown) V1.0, SN=1050288953
    Process: JLink.exe
    [00:00:00.007,476] <inf> fs_nvs: 8 Sectors of 4096 bytes
    [00:00:00.007,507] <inf> fs_nvs: alloc wra: 0, fd0
    [00:00:00.007,537] <inf> fs_nvs: data wra: 0, 1c
    [00:00:00.007,690] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                                c5 93 ba a9 14 4d 8d 05  30 4e 9b 92 d7 71 1e e8 |.....M.. 0N...q..
                                                aa 02 50 3c                                      |..P<             
    [00:00:00.011,169] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.011,199] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
    [00:00:00.011,230] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 197.47763 Build 2370639017
    [00:00:00.011,810] <inf> bt_hci_core: No ID address. App must call settings_load()
    [00:00:00.011,840] <inf> central_uart: Bluetooth initialized
    [00:00:00.012,512] <inf> bt_hci_core: Identity: FC:E5:A6:2C:
    [00:00:21.558,227] <dbg> central_uart: uart_cb: UART_RX_BUF_REQUEST
    [00:00:21.608,215] <dbg> central_uart: uart_cb: UART_RX_RDY
    [00:00:21.608,245] <dbg> central_uart: uart_cb: UART_RX_BUF_RELEASED
    [00:00:21.608,306] <dbg> central_uart: uart_cb: UART_RX_BUF_RELEASED
    [00:00:21.608,337] <dbg> central_uart: uart_cb: UART_RX_DISABLED
    [00:00:21.608,367] <inf> central_uart: Received: 7 bytes
    [00:00:21.608,398] <inf> central_uart: Broadcasting to 4 peers
    [00:00:26.360,961] <dbg> central_uart: uart_cb: UART_RX_BUF_REQUEST
    [00:00:26.410,949] <dbg> central_uart: uart_cb: UART_RX_RDY
    [00:00:26.410,980] <dbg> central_uart: uart_cb: UART_RX_BUF_RELEASED
    [00:00:26.411,010] <dbg> central_uart: uart_cb: UART_RX_BUF_RELEASED
    [00:00:26.411,041] <dbg> central_uart: uart_cb: UART_RX_DISABLED

    So, I suspect the issue lies somewhere in the broadcasting section of the multi_nus_send() function, but it's not jumping out at me. Slight smile

  • Thank you, Starbuck, for the additional information.

    It looks like a considerable amount of debugging is going to be necessary. Meanwhile, we are currently understaffed, so such debugging will be quite hard to scheduled.

    That's not to say that I will not continue to support you, but just to inform you that it would be difficult for me to follow-up soon.
    The situation should improve after the Easter holiday.
    My apologies for the inconvenience.

    Hieu

  • Thanks for replying!  Wes had some time today to help me.  He may have fixed it ... I'm testing his changes now.  I will upload the project so that it may be used by others as a decent starting point for a Multi-NUS+USB-CDC Sample and then close this ticket once I finish my verification.

  • It's great to know that you have received support, and even greater to hear you intend to share the project. Thank you!

    Looking forward to the good news.

Reply Children
No Data
Related