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

USB issue

Hi,

I am using the NRF52840 with the usbd_ble_uart example using the latest SDK.nRF5SDK160098a08e2.

My computer (windows 7)  recognize the NRF52840 as a nRF52 USB CDC BLE Demo (COM51) and everything seems ok.

But when I use  a serial port program as YAT, Hercules or PuTTY to send message over USB to/from the device, the USB user interrupt is not working.

I saw an instruction to set the #define APP_USBD_CONFIG_EVENT_QUEUE_ENABLE to 0 and to delete the app_usbd_event_queue_process() function from the main loop and I did so, but this didn't help, the interrupt is not triggering.

Besides what is the baud rate of the USB ? I didn't find where I can change the baud rate.

I am stuck with this.

Please help

Best Regards

JK

  • Hi 

    The usbd_ble_uart example will not send anything until you send the newline character. Typically you have to enter ctrl + enter in your terminal program to send this. 

    Secondly, I believe you need to be connected to a BLE central device in order to see the data being sent. 

    Besides what is the baud rate of the USB ? I didn't find where I can change the baud rate.

    The baudrate is not really relevant when using USB, since the USB interface has a much higher bandwidth than normal UART baudrates. This means it doesn't matter what baudrate you configure the CDC comport to on the Windows side. 

    Best regards
    Torbjørn

  • Hi Torbjørn,

    Thank you for your reply.

    My device shall communicate with PC throw USB or throw BLE USB dongle, that's why I chose this specific example.

    I already modified this example where the cdc_acm_user_ev_handler and the nus_data_handler to not send the data over, instead to call some message parsing function of mine.

    so I don't need a central to check the USB, I am setting a breakpoint in the begining of cdc_acm_user_ev_handler and it's not triggering when I send something from a serial port program from PC.

    Best Regards

    JK

  • Hi JK

    Do you have a Win10 computer around that you can test with to see if the problem is related to the operating system?

    All my PC's are updated to Win10, so I am not able to double check this on Win7 unfortunately. 

    Best regards
    Torbjørn

  • Hi,

    Thank you for your reply.

    I am still using windows 7 and I managed to let the USB work with your usbd_ble_uart example, the data sent from the device received at PC, but I still have a problem to receive the data sent from PC to the device.

    I set a Breakpoint on the beginning of the event handler ( cdc_acm_user_ev_handler) and it never triggers.

    as I said:

    I saw an instruction to set the #define APP_USBD_CONFIG_EVENT_QUEUE_ENABLE to 0 and to delete the app_usbd_event_queue_process() function from the main loop and I did so, but this didn't help, the interrupt is not triggering.

    I am facing this problem with Nordic's dongle and another custom device based on nRF52840

    please can you tell what the problem is !?

    BR

    JK

  • Hi,

    I used a Free Device Monitoring Studio to monitor the USB data and requests on the COM Port.

    the Request view is attached.

    It seems like the handshake not ending properly! I am not sure.

    I just used the example from the SDK, can you tell what is wrong !?

    011740: Create Request (DOWN), 07.04.2020 14:30:31.531 +30.751 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    Process 0x20b0 (X-RAYDetectorSW.exe) attempted to open the device
    011741: Create Request (UP), 07.04.2020 14:30:31.531 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    Process 0x20b0 (X-RAYDetectorSW.exe) create request status: 0x00000000
    011743: I/O Request (UP), 07.04.2020 14:30:31.531 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_PROPERTIES: Retrieve COM properties
      Packet Size=64
      Packet Version=2
      services implemented=SP_SERIALCOMM
      Max Tx bufsize=0
      Max Rx bufsize=0
      Max baud rate=Changeable bps
      Specific provider type=MODEM
      Capabilities supported=DTRDSR, RLSD, PARITY_CHECK, TOTALTIMEOUTS, INTTIMEOUTS
      Changeable parameters=PARITY, BAUD, DATABITS, STOPBITS, HANDSHAKING, PARITY_CHECK, RLSD
      Allowable baud rates=300 bps, 600 bps, 1200 bps, 2400 bps, 4800 bps, 9600 bps, 19200 bps, 38400 bps, 115200 bps, 57600 bps
      Allowable byte sizes=7, 8
      Stop bits/parity allowed=1 stop bit, None Parity, Odd Parity, Even Parity, Mark Parity, Space Parity
      Tx buffer size=0
      Rx buffer size=16384
    011745: I/O Request (UP), 07.04.2020 14:30:31.531 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_MODEMSTATUS: Retrieve modem status
      Modem status=None
    
    011747: I/O Request (UP), 07.04.2020 14:30:31.532 +0.001 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate
      Baud Rate=115200
    
    011749: I/O Request (UP), 07.04.2020 14:30:31.533 +0.001 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control
      WordLength=8
      StopBits=1 stop bit
      Parity=No parity
    
    011751: I/O Request (UP), 07.04.2020 14:30:31.533 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_CHARS: Retrieve special characters
      EofChar=0x1a
      ErrorChar=0x0
      BreakChar=0x0
      EventChar=0x1a
      XonChar=0x11
      XoffChar=0x13
    
    011753: I/O Request (UP), 07.04.2020 14:30:31.533 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information
      ControlHandShake=0
      FlowReplace=0
      XonLimit=4096
      XoffLimit=4096
    
    011755: I/O Request (UP), 07.04.2020 14:30:31.534 +0.001 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate
      Baud Rate=115200
    
    011757: I/O Request (UP), 07.04.2020 14:30:31.535 +0.001 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control
      WordLength=8
      StopBits=1 stop bit
      Parity=No parity
    
    011759: I/O Request (UP), 07.04.2020 14:30:31.535 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_CHARS: Retrieve special characters
      EofChar=0x1a
      ErrorChar=0x0
      BreakChar=0x0
      EventChar=0x1a
      XonChar=0x11
      XoffChar=0x13
    
    011761: I/O Request (UP), 07.04.2020 14:30:31.535 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information
      ControlHandShake=0
      FlowReplace=0
      XonLimit=4096
      XoffLimit=4096
    
    011762: I/O Request (DOWN), 07.04.2020 14:30:31.535 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_BAUD_RATE: Set baud rate
      Baud Rate=115200
    
    011764: I/O Request (DOWN), 07.04.2020 14:30:31.537 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_CLR_RTS: Clear RTS
    
    011766: I/O Request (DOWN), 07.04.2020 14:30:31.537 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_CLR_DTR: Clear DTR
    
    011768: I/O Request (DOWN), 07.04.2020 14:30:31.538 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_LINE_CONTROL: Set line control
      WordLength=8
      StopBits=1 stop bit
      Parity=No parity
    
    011770: I/O Request (DOWN), 07.04.2020 14:30:31.540 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_CHARS: Set special characters
      EofChar=0x1a
      ErrorChar=0x0
      BreakChar=0x0
      EventChar=0x1a
      XonChar=0x11
      XoffChar=0x13
    
    011772: I/O Request (DOWN), 07.04.2020 14:30:31.540 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_HANDFLOW: Set handshake information
      ControlHandShake=0
      FlowReplace=0
      XonLimit=4096
      XoffLimit=4096
    
    011775: I/O Request (UP), 07.04.2020 14:30:31.541 +0.001 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate
      Baud Rate=115200
    
    011777: I/O Request (UP), 07.04.2020 14:30:31.542 +0.001 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control
      WordLength=8
      StopBits=1 stop bit
      Parity=No parity
    
    011779: I/O Request (UP), 07.04.2020 14:30:31.542 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_CHARS: Retrieve special characters
      EofChar=0x1a
      ErrorChar=0x0
      BreakChar=0x0
      EventChar=0x1a
      XonChar=0x11
      XoffChar=0x13
    
    011781: I/O Request (UP), 07.04.2020 14:30:31.542 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information
      ControlHandShake=0
      FlowReplace=0
      XonLimit=4096
      XoffLimit=4096
    
    011782: I/O Request (DOWN), 07.04.2020 14:30:31.542 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_BAUD_RATE: Set baud rate
      Baud Rate=115200
    
    011784: I/O Request (DOWN), 07.04.2020 14:30:31.544 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_CLR_RTS: Clear RTS
    
    011786: I/O Request (DOWN), 07.04.2020 14:30:31.544 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_CLR_DTR: Clear DTR
    
    011788: I/O Request (DOWN), 07.04.2020 14:30:31.545 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_LINE_CONTROL: Set line control
      WordLength=8
      StopBits=1 stop bit
      Parity=No parity
    
    011790: I/O Request (DOWN), 07.04.2020 14:30:31.547 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_CHARS: Set special characters
      EofChar=0x1a
      ErrorChar=0x0
      BreakChar=0x0
      EventChar=0x1a
      XonChar=0x11
      XoffChar=0x13
    
    011792: I/O Request (DOWN), 07.04.2020 14:30:31.547 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_HANDFLOW: Set handshake information
      ControlHandShake=0
      FlowReplace=0
      XonLimit=4096
      XoffLimit=4096
    
    011794: I/O Request (DOWN), 07.04.2020 14:30:31.547 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_CLR_DTR: Clear DTR
    
    011797: I/O Request (UP), 07.04.2020 14:30:31.549 +0.001 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate
      Baud Rate=115200
    
    011799: I/O Request (UP), 07.04.2020 14:30:31.550 +0.001 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control
      WordLength=8
      StopBits=1 stop bit
      Parity=No parity
    
    011801: I/O Request (UP), 07.04.2020 14:30:31.550 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_CHARS: Retrieve special characters
      EofChar=0x1a
      ErrorChar=0x0
      BreakChar=0x0
      EventChar=0x1a
      XonChar=0x11
      XoffChar=0x13
    
    011803: I/O Request (UP), 07.04.2020 14:30:31.550 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information
      ControlHandShake=0
      FlowReplace=0
      XonLimit=4096
      XoffLimit=4096
    
    011804: I/O Request (DOWN), 07.04.2020 14:30:31.550 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_BAUD_RATE: Set baud rate
      Baud Rate=115200
    
    011806: I/O Request (DOWN), 07.04.2020 14:30:31.552 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_RTS: Set RTS
    
    011808: I/O Request (DOWN), 07.04.2020 14:30:31.552 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_CLR_DTR: Clear DTR
    
    011810: I/O Request (DOWN), 07.04.2020 14:30:31.553 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_LINE_CONTROL: Set line control
      WordLength=8
      StopBits=1 stop bit
      Parity=No parity
    
    011812: I/O Request (DOWN), 07.04.2020 14:30:31.555 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_CHARS: Set special characters
      EofChar=0x1a
      ErrorChar=0x0
      BreakChar=0x0
      EventChar=0x1a
      XonChar=0x11
      XoffChar=0x13
    
    011814: I/O Request (DOWN), 07.04.2020 14:30:31.555 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_HANDFLOW: Set handshake information
      ControlHandShake=0
      FlowReplace=64
      XonLimit=4096
      XoffLimit=4096
    
    011816: I/O Request (DOWN), 07.04.2020 14:30:31.555 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_RTS: Set RTS
    
    011818: I/O Request (DOWN), 07.04.2020 14:30:31.555 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_TIMEOUTS: Set timeouts
      ReadIntervalTimeout=4294967295
      ReadTotalTimeoutMultiplier=4294967295
      ReadTotalTimeoutConstant=1000
      WriteTotalTimeoutMultiplier=0
      WriteTotalTimeoutConstant=1000
    
    011820: I/O Request (DOWN), 07.04.2020 14:30:31.555 +0.0 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_WAIT_MASK: Set current event mask
      WaitMask=RXCHAR: Any Character received, RXFLAG: Received certain character, CTS: CTS changed state, DSR: DSR changed state, RLSD: RLSD changed state, BREAK: BREAK received, ERR: Line status error occurred, RING: Ring signal detected
    
    011822: I/O Request (DOWN), 07.04.2020 14:30:31.556 +0.001 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    IOCTL_SERIAL_SET_QUEUE_SIZE: Set queue size
      InSize=4096
      OutSize=2048
    
    011825: Write Request (DOWN), 07.04.2020 14:31:02.317 +30.761 (1. Device: nRF52 USB CDC BLE Demo (COM51))
    Buffer size: 0x30 bytes
     A5 01 00 01 A5 01 00 01 A5 01 00 01 A5 01 00 01   �...�...�...�...
     A5 01 00 01 A5 01 00 01 A5 01 00 01 A5 01 00 01   �...�...�...�...
     A5 01 00 01 A5 01 00 01 A5 01 00 01 A5 01 00 01   �...�...�...�...
    
    
    

    BR

    JK

Related