Making own UWB library implementation

Hi,

I am going to create a library for the DWM1001-DEV in C++. For this, I will use the SPI library provided by the PANS Library. However, I cannot seem to find some easy SPI read/write operations from the nRF chip to the DWM1000 chip. Can somebody link me to these examples or, if possible, provide me these examples? Thank you.

HI!
Maybe https://github.com/Decawave/dwm1001-examples/blob/master/deca_driver/port/port_platform.c ?

Hi cytro,

Thanks for the fast reply. It seems this is indeed what I am looking for. I can also not seem to find this SPI library in the “DWM1001_DWM1001-DEV_MDEK1001_Sources_and_Docs_v9” folder, when downloading this from the dwm1001 product page. Do you happen to know why this is not the case?

Hi Marc!
You cannot find that library simply because it is not there. Use this repo code and add it to your own project - this code works well, at least for me :slight_smile:

Sorry, forgot about it, if needed, fix the next functions to:

decaIrqStatus_t decamutexon(void)
{
NVIC_DisableIRQ(GPIOTE_IRQn);
return 0;
}
// ----------------------------------------------------------------------------

void decamutexoff(decaIrqStatus_t s)
{
NVIC_EnableIRQ(GPIOTE_IRQn);
}

This is a quick fix, but it works.

Hi cryto,

Thanks for the reply agian, however, I was planning to use the following SPI functions according to the examples you have sent:

dwt_writetodevice
dwt_readfromdevice

It appears these are the most basic I/O functions to communicate from the nRF to the DW1000 chip, defined in deca_device.c.

OK Mark, I don’t know anything about these features:
dwt_writetodevice
dwt_readfromdevice

I’m using the functions from legacy port_platform.c:
/ *

  • Read data from DW1000
  • /
    int readfromspi (uint16 headerLength, const uint8 * headerBuffer,
    uint32 readlength, uint8 * readBuffer)
    {
    and
    int writetospi (uint16 headerLength, const uint8 * headerBuffer,
    uint32 bodylength, const uint8 * bodyBuffer)

If you prefer, please use these, they work well. I read/write to/from DW1000 in DMA mode (nrfx_spim) - it works fine.
And I’m under FreeRTOS - it’s not sufficient :slight_smile:

Thanks, I’ll try both functions. By the way, do you happen to know an IDE like CLion or Visual Studio sort of template I can use? Segger Embedded Studio does not even have the feature to rename variables.