Output of DW3000-with-STM32-AT-Command - HardFault_Handler error

Hello,

I’m struggling with understanding the debugging log on my tag device. I have 1 tag and 6 anchors. I have given each one a unique ID according to their function. The tag gives the correct range values but the device keeps on repeating the same error HardFault_Handler error log. I have looked through ESP32 WROVER-B datasheet, UWB AT Module AT Command Manual(v1.0.8), at command datasheet and I can’t find the error log information details. I’m not sure what BootT means, Error_Bit1:85, Error_Bit2:0, Error_Bit3:0, Error_Bit4:0, Error_Bit5:0. I’m trying to send the range data over serial to my teensy 4.1 device to determine the (x,y) position of my object.

Can you please assist me?

Things I have tried:

  • Different power supply
  • Different devices
    ====================================================================

Here is the error log:

HardFault_Handler
Master/Slaver flash normal
ReadCheck MasterCheck��52524679 SlaverCheck52524679
System Parameter
UWB Module Compile:15:25:17 Feb 23 2024
UWB Module Software:v01_00_008
UWB Module Hardware:v01_03_000
UWB Module Flag:AAAA
UWB Module BootT:87
UWB Module Error_Bit1:85, Error_Bit2:0, Error_Bit3:0, Error_Bit4:0, Error_Bit5:0
UWB Module Role:Tag, Id:0, Rate:850K, Filter:1, AntTx:16408, AutoRpt:1, PA:1


portGetTickCnt:1385, scale:0.817, rtcCount1733
Tag start run, Id:0, Rate:850K
AT+RANGE=tid:0,mask:3F,seq:1,range:(185,221,173,116,173,274,0,0),
rssi:(-83.17,-80.56,-80.09,-75.84,-82.01,-82.29,0.00,0.00)

Processing AT+RANGE response
Range 1: 185.00
Range 2: 221.00
Range 3: 173.00
Range 4: 116.00
Range 5: 173.00
Range 6: 274.00
Sent range data: 185.00,221.00,173.00,116.00,173.00,274.00

AT+RANGE=tid:0,mask:3F,seq:2,range:(185,219,172,116,173,276,0,0),
rssi:(-81.61,-78.14,-79.19,-77.52,-78.73,-82.50,0.00,0.00)

Processing AT+RANGE response
Range 1: 185.00
Range 2: 219.00
Range 3: 172.00
Range 4: 116.00
Range 5: 173.00
Range 6: 276.00
Sent range data: 185.00,219.00,172.00,116.00,173.00,276.00

HardFault_Handler
Master/Slaver flash normal
ReadCheck MasterCheck��5252467B SlaverCheck5252467B
System Parameter
UWB Module Compile:15:25:17 Feb 23 2024
UWB Module Software:v01_00_008
UWB Module Hardware:v01_03_000
UWB Module Flag:AAAA
UWB Module BootT:88
UWB Module Error_Bit1:86, Error_Bit2:0, Error_Bit3:0, Error_Bit4:0, Error_Bit5:0
UWB Module Role:Tag, Id:0, Rate:850K, Filter:1, AntTx:16408, AutoRpt:1, PA:1


===================================================================
Here is my code:

#include <dw3000.h>
#include <dw3000_config_options.h>
#include <dw3000_device_api.h>
#include <dw3000_mac_802_15_4.h>
#include <dw3000_port.h>
#include <dw3000_regs.h>
#include <dw3000_shared_defines.h>
#include <dw3000_shared_functions.h>
#include <dw3000_types.h>
#include <dw3000_uart.h>
#include <dw3000_vals.h>
#include <dw3000_version.h>

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Arduino.h>
#include <SPI.h>

// Configuration settings
#define TAG
#define UWB_INDEX 0
#define FREQ_850K
#define UWB_TAG_COUNT 32

// Define serial connections
#define SERIAL_LOG Serial
#define SERIAL_AT mySerial2
HardwareSerial SERIAL_AT(2);

// Define pin assignments
#define RESET 32
#define IO_RXD2 18
#define IO_TXD2 19

#define I2C_SDA 4
#define I2C_SCL 5

Adafruit_SSD1306 display(128, 64, &Wire, -1);

// Initialize global variables
long int runtime = 0;
String response = “”;
String rec_head = “AT+RANGE”;

// Variables to store the range values
float rangeValues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};

// Setup function runs once at startup
void setup() {
pinMode(RESET, OUTPUT); // Set RESET pin as output
digitalWrite(RESET, HIGH); // Initialize RESET to high

// Initialize serial connections
SERIAL_LOG.begin(115200); // Start SERIAL_LOG at 115200 baud
SERIAL_AT.begin(115200, SERIAL_8N1, IO_RXD2, IO_TXD2); // Start SERIAL_AT

SERIAL_AT.println(“AT”); // Send AT command to initiate communication
Wire.begin(I2C_SDA, I2C_SCL);

// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32
SERIAL_LOG.println(F(“SSD1306 allocation failed”));
for (;;); // Don’t proceed, loop forever
}
display.clearDisplay();

// Send initial configuration AT commands
sendData(“AT?”, 2000, 1);
sendData(“AT+RESTORE”, 5000, 1);
sendData(config_cmd(), 2000, 1);
sendData(cap_cmd(), 2000, 1);
sendData(“AT+SETANT=16408”, 2000, 1);
sendData(“AT+GETCFG?”, 2000, 1);
sendData(“AT+SETRPT=1”, 2000, 1);
sendData(“AT+SAVE”, 2000, 1);
sendData(“AT+RESTART”, 2000, 1);
}

// Main loop function runs repeatedly after setup
void loop() {
// Check for data from SERIAL_AT and process it
while (SERIAL_AT.available() > 0) {
char c = SERIAL_AT.read(); // Read next character
if (c == ‘\r’) continue; // Ignore carriage return
else if (c == ‘\n’ || c == ‘\r’) {
// Process range response
SERIAL_LOG.println(response);
processRangeResponse(response); // Process range response
response = “”; // Clear response string for next message
} else {
response += c; // Append character to response
}
}

// Update OLED display every second
if (millis() - runtime > 100) {
updateDisplay();
runtime = millis();
}
}

// Function to process AT+RANGE responses
void processRangeResponse(String response) {
if (response.startsWith(“AT+RANGE”)) {

// Extract and store range values
int rangeStart = response.indexOf("range:(") + 7;
for (int i = 0; i < 6; i++) {
  int rangeEnd = response.indexOf(',', rangeStart);
  if (rangeEnd == -1) rangeEnd = response.indexOf(')', rangeStart);
  String rangeStr = response.substring(rangeStart, rangeEnd);
  rangeValues[i] = rangeStr.toFloat();
  rangeStart = rangeEnd + 1;

  // Debugging: Show each range value
  SERIAL_LOG.print("Range ");
  SERIAL_LOG.print(i + 1);
  SERIAL_LOG.print(": ");
  SERIAL_LOG.println(rangeValues[i]);
}

// Send all range values as a single line
String rangeData = "";
for (int i = 0; i < 6; i++) {
  if (i > 0) rangeData += ",";  // Add a comma between values
  rangeData += String(rangeValues[i], 2);  // Ensure two decimal places
}
SERIAL_AT.println(rangeData);  // Send the data string

}
}

// Function to update the OLED display
void updateDisplay() {
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);

display.setCursor(0, 0);
display.print(" < Tag Device >“);
display.setCursor(0, 9);
display.print(”---------------------");

// Display the range values
for (int i = 0; i < 4; i++) {
display.setCursor(0, 15 + i * 10);
display.print(“Range “);
display.print(i + 1);
display.print(”: “);
display.print(rangeValues[i]);
display.print(” cm”);
}
display.setCursor(0, 55);
display.print(“R5:”);
display.print(rangeValues[4]);
display.print(“|”);

display.setCursor(65, 55);
display.print("R6:");
display.print(rangeValues[5]);

display.display();
}

// Function to send AT commands and return the response
String sendData(String command, const int timeout, boolean debug) {
String response = “”; // Local variable to store the response

SERIAL_LOG.println(command); // Print command to Serial Monitor
SERIAL_AT.println(command); // Send command over serial

long int time = millis(); // Capture the current time

// Wait for a response or until timeout
while ((time + timeout) > millis()) {
while (SERIAL_AT.available()) {
char c = SERIAL_AT.read(); // Read next character
response += c; // Append character to response string
}
}

if (debug) {
SERIAL_LOG.println(response); // Print response if debugging is enabled
}

return response; // Return the response
}

// Function to generate AT+SETCFG command
String config_cmd() {
String temp = “AT+SETCFG=”;

temp += UWB_INDEX; // Add device ID to the command

// Add device role to the command
#ifdef TAG
temp += “,0”;
#endif
#ifdef ANCHOR
temp += “,1”;
#endif

// Add frequency to the command
#ifdef FREQ_850K
temp += “,0”;
#endif
#ifdef FREQ_6800K
temp += “,1”;
#endif

temp += “,1”; // Add range filter setting

return temp; // Return the command
}

// Function to generate AT+SETCAP command
String cap_cmd() {
String temp = “AT+SETCAP=”;

temp += UWB_TAG_COUNT; // Add Tag capacity to the command

// Add time slot duration based on frequency
#ifdef FREQ_850K
temp += “,15”;
#endif
#ifdef FREQ_6800K
temp += “,10”;
#endif

return temp; // Return the command
}