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?

  • Alright, thanks for the clarification. I have ported the example code you uploaded to SDK 15 and got it to work, however, I am getting fatal error and system reset when the code enters the while true loop and performs this operation:

    while (app_usbd_event_queue_process())
     

    When I call it before entering the while(true) loop, then the system reset error does not arise. Seem like the frequent calling of this function causes the system to somehow crash . Do you have any idea why this might be happening?

    /Hadi

  • Hi Hadi

    Do you enter sleep in your main loop, or do you just run it over and over?

    Maybe you can share your main file and I can take a look at it?

    Best regards
    Torbjørn

  • Hi Torbjørn,

    I have now managed to port it to SDK15 and getting it to work, but there is something that cause the test to fail when receiving the command and sending a response. I suspect that there is something in my CDC event handler when I send it to main, but can't tell what might cause the cmd operation to fail.

    /Hadi

    direct_test_mode.zip

  • Hi Hadi

    I assume you mean SDK v15.3.0?

    Is there a particular command that causes it to fail, or will any command do it?

    Have you run the debugger to see if some error is triggered in the nRF52, or will it just fail on the tester side?

    I can give your code a go and see if I can reproduce it. 

    Best regards
    Torbjørn

  • Hi Torbjørn,

    No, I have been using SDK 15.0 only

    I have tried bleoff, tx and rx commands with my code and all of them fail (PC<-->NRF52840 and running a python script). I can see that the port is opening and that a message is sent through the led indications, but all of the commands fail. I tested the code you provided with sdk 14.2, and it works perfectly.  However, when I perform the exact same operations on sdk 15.0, it does not work. 

    I had problems with compiling the application when having the "UART_LEGACY_SUPPORT 1" in the sdk_config.h, get the following error:

    /opt/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: _build/nrf52840_xxaa/nrfx_uarte.c.o: in function `UARTE0_UART0_IRQHandler':
    /home/dek/sdk/nRF5_SDK_15.0.0_a53641a/examples/dtm/direct_test_mode/pca10056/blank/armgcc/../../../../../../modules/nrfx/drivers/src/nrfx_uarte.c:571: multiple definition of `UARTE0_UART0_IRQHandler'; _build/nrf52840_xxaa/nrfx_uart.c.o:/home/dek/sdk/nRF5_SDK_15.0.0_a53641a/examples/dtm/direct_test_mode/pca10056/blank/armgcc/../../../../../../modules/nrfx/drivers/src/nrfx_uart.c:644: first defined here

    I do not know whether this flag in the sdk_config.h might be the problem?

    EDIT: I put some nrf_logs in my cdc event handler, and can see that the port is opened and also performs the tx done. However, the rx done is never executed.

    EDIT 1:35 pm: Through further investigations I have noticed that the "APP_USBD_CDC_ACM_USER_EVT_RX_DONE" event is never called even if data is sent. When I connected to the port with a serial terminal application, I noticed that whatever I send nothing will be received at the DK side

    EDIT 3:30 pm: Changing the UART_LEGACY_SUPPORT to 1, did not resolve the issue and seem to be something else that prevents the application to call APP_USBD_CDC_ACM_USER_EVT_RX_DONE when new data is available

    /Hadi

Reply
  • Hi Torbjørn,

    No, I have been using SDK 15.0 only

    I have tried bleoff, tx and rx commands with my code and all of them fail (PC<-->NRF52840 and running a python script). I can see that the port is opening and that a message is sent through the led indications, but all of the commands fail. I tested the code you provided with sdk 14.2, and it works perfectly.  However, when I perform the exact same operations on sdk 15.0, it does not work. 

    I had problems with compiling the application when having the "UART_LEGACY_SUPPORT 1" in the sdk_config.h, get the following error:

    /opt/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: _build/nrf52840_xxaa/nrfx_uarte.c.o: in function `UARTE0_UART0_IRQHandler':
    /home/dek/sdk/nRF5_SDK_15.0.0_a53641a/examples/dtm/direct_test_mode/pca10056/blank/armgcc/../../../../../../modules/nrfx/drivers/src/nrfx_uarte.c:571: multiple definition of `UARTE0_UART0_IRQHandler'; _build/nrf52840_xxaa/nrfx_uart.c.o:/home/dek/sdk/nRF5_SDK_15.0.0_a53641a/examples/dtm/direct_test_mode/pca10056/blank/armgcc/../../../../../../modules/nrfx/drivers/src/nrfx_uart.c:644: first defined here

    I do not know whether this flag in the sdk_config.h might be the problem?

    EDIT: I put some nrf_logs in my cdc event handler, and can see that the port is opened and also performs the tx done. However, the rx done is never executed.

    EDIT 1:35 pm: Through further investigations I have noticed that the "APP_USBD_CDC_ACM_USER_EVT_RX_DONE" event is never called even if data is sent. When I connected to the port with a serial terminal application, I noticed that whatever I send nothing will be received at the DK side

    EDIT 3:30 pm: Changing the UART_LEGACY_SUPPORT to 1, did not resolve the issue and seem to be something else that prevents the application to call APP_USBD_CDC_ACM_USER_EVT_RX_DONE when new data is available

    /Hadi

Children
No Data
Related