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

SPI and openthread on nRF52840

Hi, 

I am  new to openthread development. My goal is to distribute measured values received from the SPI Bus over a thread network. I am using a nRF52840-DK Board, SDK for Thread and Zigbee 2.0 together with Segger Embedded Studio on Windows 10.

For my project I need to include the SPI driver as well as the UART driver since I get the meassured values via SPI and UART. Trying to integrate the .\peripheral\spi example in the .\thread\cli example I get compiler errors with multiple defines.

I already tried to use the latest openthread libs as described here: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.0.0%2Findex.html

but things got worse as the examples wouldn't comile any more. Please verify if all paths mentioned in the documentation are correct. For example $(SDK)\external\openthread\include has no platform folder. 

Could you explain or point me to a documentation how I can set up the spi driver together with openthread?

Thank you in advance

Best regards

Marco

Parents
  • Hello Marco,

    Since openthread is an external library, and in continuous change, it is difficult to keep the documentation up to date at all times. The SDK and it's examples works with the openthread version that is used when it was developed, but if you compile a later version, you may have to configure the examples as well. This is mentioned in the SDK documentation

    Note:
    OpenThread is still in prerelease phase and its API changes frequently. Keep in mind that when the API changes, the examples might not compile with the latest OpenThread version right away without fixes.

    What do you need for your project? You want to add an SPI, right? Have you tried to add the SPI as it is done in the "normal" SDK examples? I don't think you need to update the openthread library. As long as you don't use SPIS0 it should work. 

    Best regards,

    Edvin

  • The same goes with UART0, by the way. This is taken by the openthread build, but you can use the others.

    BR,

    Edvin

Reply Children
  • Sorry that there are multiple replies here, but I found something more:

    If you check the SDK\external\openthread\project\readme.txt, it says:

    OpenThread libraries projects are based on the following commit of OpenThread: 704511c96e0d093139e4b80ef0739ed2d701afb1

    If you pull this commit, then you shouldn't have to change anything in the example, as it is the version used to make the SDK.

    Best regards,

    Edvin

  • Hi Edvin, thank you very much for the quick response and sorry for the late reply. 

    I sorted it out. I had some conflicts between prs, spi and uart in the sdk_config file. Setting all of them to anything other than 0, I managed to compile and run the SPIM Driver. 

    Unfotunately, I still have some questions regarding the behaviour of the driver. I hope it is OK to ask them in this context. If not please feel free to move the topic.

    I need to address a 4 Channel AD Converter from TI with the follwoing sequence. 

    The SPIM Driver seem to send and receive at the same time as shown in the screenshot below. 

    Is there a way to init a sequential write/read?

    Thank you in advance 

    Best regards

    Marco

     

  • Glad to hear that it worked,

    SPI typically works this way, you have two data lines, MOSI and MISO, so that the devices can both send and receive data.

    I am not familiar with that sensor specificaly. They usually need some setup commands (over SPI). It should be described in the datasheet. See if you can find something in the datasheet, or if you can find a driver which you can port to fit the nRF.

    Best regards,

    Edvin

Related