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

DTM UART communication through USB port instead of Tx Rx

Hi everyone!

I am currently working on a custom prototype that is using the nrf52840 chip and sdk 15, and now want to perform DTM tests on the device. Looking at the DTM example code and description, I see that the application uses 2 pins (tx,rx) in order to perform the UART communication. In my case with the custom prototype board that is not possible since we have not included these pins. Is there any other way to perform the UART communication through the USB port instead. One idea that I am currently thinking of is to implement USB CDC and use that instead, does it sound reasonable and/or are there any other easier way to do that?

Would be very thankful for any help I can get!

/Hadi

Parents
  • UPDATE: I have started implementing USB cdc in the DTM example that is available, however, I am facing some problems. When I run my code on the board I can't see any com port appearing. So my question is: Does the USB CDC example require a Softdevice to be programmed on the device in order for the device to work with USB cdc? If so, then I assume that it won't work to integrate both cdc and DTM, since, the DTM application requires that no softdevice is present on the device. Correct me if I am wrong

  • Thanks for the help Torbjørn, I really appreciate it. I have one question regarding the DTM tests. We are going to perform certification test soon: Radio (TX: Mod low,mid,high and carrier & RX: no beacon ) and also EMC with usb traffic, my question is whether it is possible to perform this with the DTM application only or do I also have to use the Radio application?

  • Hi,

    Apparently since SDK 15.0 there is a new function called  app_usbd_cdc_acm_read_any, which calls the rx done whenever there is new data in the buffer. I have now changed to this function, however, my tests still fail when I run my script. I can see that the bytes are received but when the dtm application performs the tx write, nothing is received on the computer side. Also, I tried manually sending some data and seems that the application stops receiving/transmitting any data after the application have sent the last result. (See updated answer below)

    I have attached the most recent code below on dtm+cdc that I am using currently.

    Would really appreciate any help I could get on getting the dtm+cdc application to work

    Update!

    The tests now runs successfully without any problem. I had by mistake changed the rx buffer size to 1 when initializing the variable. I'll upload the code here that works with sdk 15 in case any other would need this in the future...

    cdc_dtm_SDK15.zip

    /Hadi

  • Hi Hadi

    Good to hear you found the issue, and thanks for sharing the code Slight smile

    I will consider the case closed then. 

    Best regards
    Torbjørn

  • Hi Torbjørn

    Sorry to disturb you, I have a question regarding this application that you uploaded. I have tested mine application and yours also, and it seems like it does not work and is not sending any RF signals on either low, mid or high. I have tested with the original dtm application with tx rx and can see that it works and transmits a signal on the right frequency, however, with the modified example it is not transmitting any signal at all. Did you test your application that it was working? Because I couldn't get it to transmit any signals, neither did it work on the sdk 15.0 application that I made. How did you test it if it worked?

    In my application it seems like the problem is when the command is received and then building the uint16_t command, but can't figure out whether it is the cdc read that is the problem or the fifo buffer that is causing this problem.

    Best regards

    Hadi

  • Hi Again,

    I have managed to solved the problem now, however, I am not sure whether it is acceptable that I don't consider this wait function call now. I now concatenate the commands MSB & LSB together and then change a flag that tells that the cmd value was received directly inside the cdc rx handler. In the main function I just call the dtm_put function with the cmd value and send a response back. Is this approach acceptable?

    I have attached the latest code here below, would really appreciate if you could tell me whether this approach is acceptable.

    Thanks in advance

    Best regards

    Hadi

    cdc_dtm_sdk15.0_latest.zip

  • Hi Hadi,

    I found this post because I was looking for this exact example combination. Thank you for your hard work doing it. Do you think it would be difficult to make this example work for sdk 15.3?
    We you also working on the radio test example + cdc? I am also trying to find that.
    I am a hardware engineering and combining these examples is very difficult for me with my basic firmware/programming skills.
    If you are working on it would you be able to share it?

Reply
  • Hi Hadi,

    I found this post because I was looking for this exact example combination. Thank you for your hard work doing it. Do you think it would be difficult to make this example work for sdk 15.3?
    We you also working on the radio test example + cdc? I am also trying to find that.
    I am a hardware engineering and combining these examples is very difficult for me with my basic firmware/programming skills.
    If you are working on it would you be able to share it?

Children
  • Hi Silvano,

    this is the least I could do to share my code, and I am glad that others will make use of the code.

    The changes from 15.0 to 15.3 shouldn’t be that large or even no changes would be required. Usually it is larger changes between major releases but minor updates from 15.0 to 15.3 shouldn’t be that large. I remember that I looked on the 15.3 example and it was the similar code if I recall correctly, however, I did not work on 15.3 so unfortunately have no code to share.

    If you want to port it to 15.3 I would suggest to copy all the attached code in my attached main.c into CDC acm example main.c in 15.3 and include dtm to sdk_config.h and the header files in the makefile.

    Best regards

    Hadi

  • Hi Hadi

    I don't think it's a problem that you omit the dtm_wait() function, if that's what you mean?

    My main concern looking at the code is what would happen if you dropped a byte, as you could fall out of sync with the update sequence, but I doubt this is a common occurrence in practice. 

    Best regards
    Torbjørn

Related