DWM3001CDK Platform Agnostic Custom API

We’re developing a custom API layer for the DWM3001CDK for inter-operability between our Raspberry Pi and an Arduino/STM32 module, which the existing APIs did not provide a simple nor straightforward approach for.

I’ve essentially tried to port the Python SDK (which didn’t even detect our boards via tty, btw) to C. I’ve gotten everything mostly working (ie; get_device_info shows DECA something), the only problem being the notification receiving part, in which I’m getting random, garbage data. Any help?

Here’s the link to the repo, and a snippet of how I send commands and receive notifications:

// commands.c
int start_uwb_ranging_session(int tty_fd, uint32_t sid)
{
  uint8_t payload[SID_SIZE];
  size_t payload_len = sizeof(payload) / sizeof(payload[0]);
  init_payload(payload, payload_len, sid);

  Packet sent_pkt = create_packet(CommandHeader, RANGING, RANGE_START, payload, payload_len);
  Packet rcvd_pkt;

  return send_n_receive(tty_fd, sent_pkt, &rcvd_pkt);
}

void receive_process_notif(int tty_fd)
{
  while (1)
  {
    sleep(1);
    printf("\n\n\n");
    Packet rcvd_packet;
    rcv_packet(tty_fd, &rcvd_packet);
    print_packet_header(rcvd_packet.header);
    printf("    pkt: GID: %s (0x%04X)\n", gid_t_s(rcvd_packet.gid), rcvd_packet.gid);
    printf("    pkt: OID: %s (0x%04X)\n", oid_t_s(rcvd_packet.gid, rcvd_packet.oid), rcvd_packet.oid);
  }
}

// main.c
printf("\n -- Starting UWB 1 ranging... -- \n");
if (start_uwb_ranging_session(tty_fd_1, SESSION_ID) < 0)
{
  printf("\n**ERROR: FAILED TO START UWB RANGING**\n");
  gtfo(tty_fd_1, SESSION_ID);
  return -5;
}
sleep(3);

printf("\n -- Starting UWB 2 ranging... -- \n");
if (start_uwb_ranging_session(tty_fd_2, SESSION_ID) < 0)
{
  printf("\n**ERROR: FAILED TO START UWB RANGING**\n");
  gtfo(tty_fd_2, SESSION_ID);
  return -5;
}
sleep(3);

printf("\n -- Receiving UWB notifications... -- \n");
receive_process_notif(tty_fd_2); // also tried tty_fd_1, same data

Any help or hints in the right direction are greatly appreciated - thanks!

Hello, If you get a correct value after ‘get_device_info’ command, that means you correctly got the RSP message from the UWBS. As a reminder, for any CMD message from the host, there is a RSP message from the UWBS (mainly providing the status of the command - OK/KO).

Maybe there is an issue in the reading of the tty, if there is no buffering in the kernel side, you may lose some data from the tty. In the Python script, the read/write is ‘multithreaded’ (in Python : serial.threaded).

Hey, actually it turns out we were using an older version of the UCI build and I got most things working.

One issue though, I’m reading online that the DWM3001CDK don’t support AoA due to lacking a second antenna. Do you know how we might go about either adding one or modifying the board (swapping out the module?) to support AoA? We’ve already purchased two.

It’s pretty silly that there’s AOA plastered all over the docs but the board itself doesn’t seem to support it.