System Hardfault when calling dwt_probe()

Hello bruno,

In the API guide, it has mentioned about const struct dwt_driver_s … something. Do we need to add that to somewhere in our code?

Thanks in Advance!!!

Hi Kavindu,
That is an internal struct, what you have to do when you are configuring the dw3000 is a call to a function because if not all driver functions points to Null.
Here the initial piece of my configuration script:
int TransmitterConnector_init(void){
int err = 0;
uint32_t dev_id;

//must disable interrupts before doing all that, then reenable at the end
my_disable_IRQ();

//this is our tested and working init sequence: slowrate, wakeup, reset, wait a little.
port_set_dw_ic_spi_slowrate();
wakeup_device_with_io();
reset_DWIC();
HAL_Delay(10); 

int retval;
retval = dwt_probe((struct dwt_probe_s *)&dw3000_probe_interf); // THIS IS WHAT I TOLD BEFORE

while (!dwt_checkidlerc()) /* Need to make sure DW IC is in IDLE_RC before proceeding */ { };
port_set_dw_ic_spi_fastrate(); //after idle, we can set to fastrate

if (dwt_initialise(DWT_DW_INIT) == DWT_ERROR)
{
    err = -1;
    return err;
	//while (1) { };
}

dev_id = dwt_readdevid();

if(dev_id != 0xdeca0302){ //if it doesn't read the correct devID, just get it out early. this way we can manage retries with more flexibility on caller function (main). USE THE devID THAT SUITS YOUR DEVICE!!!
	err = -1;
	return err;
}

// 	continue your DW configuration

Hope it helps!

1 Like

I changed the linker file as you mentioned and also followed the steps you have given in DWM3000 with STM32L433 undefined reference in library - #2 by emeric_hes . Now I also getting a hardfault error when calling dwt_readdevid() function. dwt_probe() function returns 0 (DWT_SUCCESS) but code stucks at dwt_readdevid(). Do you know any solution to this?

Thanks in Advance!!!

Code snippet

Just recently in Nov 2024 I saw a new release of the SDK-1.0.0 where the driver is in the src form as in the old good times.
Hope that may help you understand how it works.