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

Problem with serial communication between C# application and USB CDC ACM dongle

Hello, 

I have been developing a serial C# application to work with the nrf52840 chip, initial development was done using the nrf52840 development kit which worked without any issue. After developing the whole thing, the DK was replaced with the dongle which is when the problem occurred, the problem is that the c# application takes too long to read the data written to the serial port.  When I did some debugging, I found that there was around a 5-second delay between the dongle writing something to the serial port and the C# application actually being able to read the data written which is very odd. I tried to see if the same delay could be seen when Putty was used, but there wasn't any delay there. Initially, the driver used by the device was windows serial device which was then changed to nrf52 USB CDC ACM(and Demo), neither of them made any difference. Could someone please shed some light on this behavior? I'm using ncs v1.4.0.

Thanks for any help.

Parents
  • Hi,

    Based on your descriptions it sounds like the issues are to be found at the C# end of things. Especially since there are no delays when using Putty. (I assume that Putty replaced your C# application there.)

    When using the nRF52840 DK, did you use UART through the interface MCU, or did you use USB ("nRF USB" connector on (bottom) long edge of the DK)?

    I find it very strange however that it should work without delay on the DK, but with 5 seconds delay (an eternity!) when using the Dongle.

    Do you have any USB sniffer traces that could shed some light on what might be the difference?

    Regards,
    Terje

  • Hey,

    Sorry for the late reply, but I did take a look at the USB sniffer trace and the results are shown in the screenshots attached. The shorter one is for the DK board, and it can be seen that the data is being transferred in bulk but with the dongle, the data is sent one byte at a time. Also, the time delay can be noticed for the Dongle while the DK has no time delay for the incoming message. I'm not sure what to make out of this data tbh. I tried changing the parameters on the c# app for serial connection but doesn't really seem to make any difference. Also, when I connected it to the nRF USB connector side of the DK, the same delay as seen on the dongle was also observed there. This means as long as the data comes through the Jlink interface chip on the DK, the transfer seems to be fine without any delay but when it is connected directly to the nRF chip, the delay is present but only when used through the c# app. Furthermore, as I mentioned before, when I'm using Putty to talk to the Dongle and perform the same function the C# application does, I don't see any delay even after analyzing the sniffer trace. Please do let me know if you would like a copy of the C# app and the firmware for reference.

    Regards, 

    Sethu

     

  • Hi, 

    have you solved your problem? 

    Best regards,
    Kaja

Reply Children
No Data
Related