This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Generate NCP firmware for UART with UART pins modified

I am using Nordic's NRF_SDK_For_Thread_and_Zigbee_4.1.0.

In that example/thread/ncp, I want to build NCP firmware for uart.

Original uart pins for rx and tx are 8 and 6.

While I want to build that firmware for pins 26 and 6.

UART Rx is 26 and Uart Tx is 4.

So where I should update these pins so that my custom nordic module, that has uart Rx on 26 and Tx on 4, can be interfaced with my custom gateway board, which I use as border router.

Also, should I add some Pullup or Pulldown to Rx pin in the NCP's main code?

nrf_gpio_cfg_input(0x1A, NRF_GPIO_PIN_PULLUP);
  • Hello @Bhumika,

    First of all in case you starting the new project I just want to recommend moving to our new SDK called nRF Connect SDK where you can find the NCP example as well - https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/openthread/coprocessor/README.html

    The nRF5 SDK for Thread and Zigbee is still supported but it is only in a maintenance mode, and OpenThread there is pretty much old there.

    In case of nRF5 SDK for Thread and Zigbee the UART platform is placed in the pre-compiled OpenThread library, and so in order to change the pins, you need to regenerate libraries and replace them with ones from nRF5 SDK.

    The instruction on how to generate libraries can be found here: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/openthread/coprocessor/README.html

    Please however ensure that you checkout to the same revision of OpenThread from which the SDK was released:

    git checkout c6a258e3a5bd90aa26d8245c435c0ae5797027f4


    You can find the UART configuration in this file (and analogously for nRF52833 and nRF52811) - https://github.com/openthread/openthread/blob/c6a258e3a5bd90aa26d8245c435c0ae5797027f4/examples/platforms/nrf528xx/nrf52840/transport-config.h

    After libraries will be generated, you don't need to copy them all, it's enough to copy libopenthread-nrf528xx-transport.a (in case you use GCC).

  • Thanks for the reply. I will do this step and let you know.

  • I have generated a new image for NCP from the latest openthread directory, i.e., "ot-nrf528xx".

    I have followed the steps provided on https://github.com/openthread/ot-nrf528xx/blob/main/src/nrf52840/README.md .

    Also, I have made the following changes in the transport-config.h file at ot-nrf528xx/src/nrf52840:

    1. 

    #ifndef UART_PIN_TX
    #define UART_PIN_TX 4
    #endif

    2.
    #ifndef UART_PIN_RX
    #define UART_PIN_RX 26
    #endif

    3.
    #ifndef UART_HWFC_ENABLED
    #define UART_HWFC_ENABLED 0
    #endif

     

    I have changed TX, RX pin numbers as per my custom hardware. and disabled HWFC  and generated the new image.

    On flashing that image I am able to communicate with the border router but the NCP state is constantly "offline".

    Can you help me in debugging this issue? What is causing the NCP state in offline mode?

    I have checked everything on my side but couldn't find any reasonable solution.

  • Hello Bhumika,

    As I mentioned above, you have to use the same OpenThread commit as was used in the nRF5 SDK for the T&Z release.

    The ot-nrf528xx repository was created just recently and is not compatible with nRF5 SDK for T&Z.

    So please just clone OT repo, checkout to the c6a258e3a5bd90aa26d8245c435c0ae5797027f4 commit and generate libraries according to the documentation.

    I would then recommend checking with default UART pins that all works correctly and only then configure the pins and regenerate libraries one more time.

    Please let me know about the progress.


  • Thanks for clarifying my doubt.

    I have done this and the NCP image is working now. 

    But that open thread commit is more than a year old.

    Since then, there are multiple improvements in openthread repository, and I want to port my current application on the latest openthread commit.

    Kindly guide me through the process for the same.

    Bcoz when I applied the process mentioned https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v4.1.0%2Fthread_ot_libraries_building.html&cp=8_3_2_1_4 , my application won't compile. 

    there are many API related error like below:

    ../../../../../nrf_sdk_thread/components/thread/utils/thread_utils.c: In function 'platform_init':
    ../../../../../nrf_sdk_thread/components/thread/utils/thread_utils.c:129:5: error: implicit declaration of function 'otHeapSetCAllocFree'; did you mean 'otHeapCAlloc'? [-Werror=implicit-function-declaration]
         otHeapSetCAllocFree(ot_calloc, ot_free);
         ^~~~~~~~~~~~~~~~~~~
         otHeapCAlloc
    ../../../../../nrf_sdk_thread/components/thread/utils/thread_utils.c: In function 'thread_cli_init':
    ../../../../../nrf_sdk_thread/components/thread/utils/thread_utils.c:258:5: error: implicit declaration of function 'otCliUartInit'; did you mean 'otCliInit'? [-Werror=implicit-function-declaration]
         otCliUartInit(mp_ot_instance);
         ^~~~~~~~~~~~~
    

    How to port my current application on the latest openthread stack or nrf connect SDK ?

Related