Help with basic tx/rx example

So, I’m having a tough time now thinking that it is something on my end, and now thinking there could be something wrong with the driver api? At least with the dwm1000 specifically.

I now have two DWM1000s hooked up with STM32s. I am now using the board architecture that the api was designed for. I have the exact same results…

If I comment out the “dwt_configure(&config);” I am able to receive messages with the aforementioned error bits set, the rx stm32 prints “err”.

If I use any configuration, I never receive any messages at all.

These modules still work fine using the arduino library, so there is nothing wrong with them, and I have 4 modules that I have tested with each.

Please if anyone has any suggestions let me know. If not it looks like I will be moving on to a new UWB chip.

Thanks!

STM32 tx code:

[code]#include <mbed.h>
#include “decadriver/deca_device_api.h”
#include “decadriver/deca_regs.h”

static dwt_config_t config = {
2, /* Channel number. /
DWT_PRF_64M, /
Pulse repetition frequency. /
DWT_PLEN_1024, /
Preamble length. Used in TX only. /
DWT_PAC32, /
Preamble acquisition chunk size. Used in RX only. /
9, /
TX preamble code. Used in TX only. /
9, /
RX preamble code. Used in RX only. /
1, /
0 to use standard SFD, 1 to use non-standard SFD. /
DWT_BR_110K, /
Data rate. /
DWT_PHRMODE_STD, /
PHY header mode. /
(1025 + 64 - 32) /
SFD timeout (preamble length + 1 + SFD length - PAC size). Used in RX only. */
};

DigitalOut myled(PC_13);

static uint8 tx_msg[] = {0xC5, 0, ‘D’, ‘E’, ‘C’, ‘A’, ‘W’, ‘A’, ‘V’, ‘E’, 0, 0};

#define BLINK_FRAME_SN_IDX 1

#define TX_DELAY_MS 1000

DigitalInOut pin_rst(PA_10);

void reset_DW1000()
{
pin_rst.write(0);
wait(0.01);
pin_rst.write(1);
}

int main(void)
{
myled = 0;
Serial serial(PB_6, PB_7);
wait(0.5);
serial.baud(9600);

pin_rst.output();
pin_rst.mode(OpenDrain);
SPI bus(PA_7, PA_6, PA_5);//mosi, miso, clk

serial.printf("Device ID: %u\r\n", dwt_readdevid());

reset_DW1000();
bus.frequency(2000000);
if (dwt_initialise(DWT_LOADNONE) == DWT_ERROR)
{
    serial.printf("Error on init11\n\r");
    while (1) { ; };
}
bus.frequency(20000000);

//dwt_configure(&config);

while(1)
{
  dwt_writetxdata(sizeof(tx_msg), tx_msg, 0); /* Zero offset in TX buffer. */
  dwt_writetxfctrl(sizeof(tx_msg), 0, 0); /* Zero offset in TX buffer, no ranging. */

  dwt_starttx(DWT_START_TX_IMMEDIATE);

  while (!(dwt_read32bitreg(SYS_STATUS_ID) & SYS_STATUS_TXFRS))
  { };

  dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_TXFRS);

  myled = 1;
  wait(1);
  myled = 0;

  tx_msg[BLINK_FRAME_SN_IDX]++;
}

}
[/code]

STM32 rx code:

[code]#include <mbed.h>
#include “decadriver/deca_device_api.h”
#include “decadriver/deca_regs.h”

static dwt_config_t config = {
2, /* Channel number. /
DWT_PRF_64M, /
Pulse repetition frequency. /
DWT_PLEN_1024, /
Preamble length. Used in TX only. /
DWT_PAC32, /
Preamble acquisition chunk size. Used in RX only. /
9, /
TX preamble code. Used in TX only. /
9, /
RX preamble code. Used in RX only. /
1, /
0 to use standard SFD, 1 to use non-standard SFD. /
DWT_BR_110K, /
Data rate. /
DWT_PHRMODE_STD, /
PHY header mode. /
(1025 + 64 - 32) /
SFD timeout (preamble length + 1 + SFD length - PAC size). Used in RX only. */
};

#define FRAME_LEN_MAX 127
static uint8 rx_buffer[FRAME_LEN_MAX];

static uint32 status_reg = 0;

static uint16 frame_len = 0;

DigitalInOut pin_rst(PA_10);

void reset_DW1000()
{
pin_rst.write(0);
wait(0.01);
pin_rst.write(1);
}

int main(void)
{
//myled = 0;
Serial serial(PB_6, PB_7);
wait(0.5);
serial.baud(9600);

pin_rst.output();
pin_rst.mode(OpenDrain);
SPI bus(PA_7, PA_6, PA_5);//mosi, miso, clk

serial.printf("Device ID: %u\r\n", dwt_readdevid());

reset_DW1000();
bus.frequency(2000000);
if (dwt_initialise(DWT_LOADNONE) == DWT_ERROR)
{
    serial.printf("Error on init11\n\r");
    while (1) { ; };
}
bus.frequency(20000000);

//dwt_configure(&config);

while(1)
{
  int i;

  for (i = 0 ; i < FRAME_LEN_MAX; i++ )
  {
      rx_buffer[i] = 0;
  }
  dwt_rxenable(DWT_START_RX_IMMEDIATE);

  while (!((status_reg = dwt_read32bitreg(SYS_STATUS_ID)) & (SYS_STATUS_RXFCG | SYS_STATUS_ALL_RX_ERR))) { ; }

  if (status_reg & SYS_STATUS_RXFCG)
  {
      frame_len = dwt_read32bitreg(RX_FINFO_ID) & RX_FINFO_RXFL_MASK_1023;
      if (frame_len <= FRAME_LEN_MAX)
      {
          dwt_readrxdata(rx_buffer, frame_len, 0);
          for(int s=0; s<frame_len-3; s++)
          {
            serial.printf("%c", rx_buffer[s]);
          }
          serial.printf("\r\n");
      }
      dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_RXFCG);
  }
  else
  {
    dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR);
    serial.printf("Err\r\n");
  }
}

}
[/code]