cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-WBA55CG: ISM330DHCX init fails at ISM330DHCX_Set_Mem_Bank with X-NUCLEO-IKS02A1

kclauah
Associate II

Hello,

I have been working with a NUCLEO-WBA55CG board and the X-NUCLEO-IKS02A1 expansion board. When running my initialization code, the program execution jumps to the error handler. Using a debugger, I've pinpointed the failure to the ISM330DHCX_Set_Mem_Bank function. The function returns an error status, which triggers my error handling routine. My initial approach was to replicate the project setup described in DataLogTerminal project . This led directly to the failure at ISM330DHCX_Set_Mem_Bank. I have compared my initialization code against the reference implementation in Board Extension IKS02A1 ISM330DHCX_0_Probe function and they appear to be identical.

My Questions:

  • Is there a known compatibility issue for using ISM330DHCX with the NUCLEO-WBA55CG board?
  • Could this failure point to a I2C communication problem or a timing issue? How can I fix it?
  • Any recommended procedure for initializing I2C or this sensor?

 Here is the code that I added:

/* USER CODE BEGIN Includes */
#include "ism330dhcx.h"
#include "stm32wbaxx_nucleo_bus.h"
/* USER CODE END Includes */

  /* USER CODE BEGIN 2 */
  MX_MEMS_Init();
  /* USER CODE END 2 */

/* USER CODE BEGIN 4 */
static void MX_MEMS_Init(void){
	ISM330DHCX_IO_t io_ctx;
	io_ctx.Address = ISM330DHCX_I2C_BUS;
	io_ctx.BusType = ISM330DHCX_I2C_ADD_H;
	io_ctx.Init = BSP_I2C1_Init;
	io_ctx.DeInit = BSP_I2C1_DeInit;
	io_ctx.ReadReg = BSP_I2C1_ReadReg;
	io_ctx.WriteReg = BSP_I2C1_WriteReg;
	io_ctx.GetTick = BSP_GetTick;
	io_ctx.Delay = HAL_Delay;

	int32_t ret = 0;
        ISM330DHCX_Object_t imu_sensor;
	ret = ISM330DHCX_RegisterBusIO(&imu_sensor, &io_ctx);
	if (ret != ISM330DHCX_OK){
		Error_Handler();
	}
	ret = ISM330DHCX_Set_Mem_Bank(&imu_sensor, ISM330DHCX_USER_BANK);
	if (ret != ISM330DHCX_OK){
		Error_Handler();
	}

	uint8_t id;
	ret = ISM330DHCX_ReadID(&imu_sensor, &id);
	if (ret != ISM330DHCX_OK){
		Error_Handler();
	}
	if (id != ISM330DHCX_ID){
		Error_Handler();
	}

	ISM330DHCX_AxesRaw_t axes_raw;
	ISM330DHCX_Init(&imu_sensor);
	ISM330DHCX_ACC_SetOutputDataRate(&imu_sensor, 26.0f);
	ISM330DHCX_ACC_SetFullScale(&imu_sensor, ISM330DHCX_16g);
	ISM330DHCX_ACC_GetAxesRaw(&imu_sensor, &axes_raw);
	ISM330DHCX_GYRO_SetOutputDataRate(&imu_sensor, 26.0f);
	ISM330DHCX_GYRO_SetFullScale(&imu_sensor, ISM330DHCX_4000dps);
	ISM330DHCX_GYRO_GetAxesRaw(&imu_sensor, &axes_raw);

	ISM330DHCX_ACC_Enable(&imu_sensor);
	ISM330DHCX_GYRO_Enable(&imu_sensor);
}
/* USER CODE END 4 */

Steps to Reproduce:

 

  • Create a new STM32 project in STM32CubeIDE.
  • In the Board Selector, choose NUCLEO-WBA55CG and initialize the project with default peripheral settings.
  • Navigate to "Connectivity" and enable I2C1. Set the SCL and SDA pins to PB1 and PB2 respectively.
  • Change I2C speed mode to Fast Mode. Other settings leave unchanged.
  • Navigate to "System Core" RCC. and select HSE and LSE to crystal/ceramic resonator
  • Navigate to "Computing" and enable CRC.
  • Navigate to "Trace and Debug" Debug and select Serial Wire.
  • Navigate to "Timers" RTC and activate Clock Source and Calendar
  • Navigate to "Middleware" X-CUBE-MEM1 and activate AccGyr ISM330DHCX

Environment:

  • STM32CubeIDE: 1.19.0
  • STM32Cube MCU Pack for STM32WBA series: 1.7.0
  • X-CUBE-MEMS1: 11.3.0
  • Windows 10

 

2 REPLIES 2
kclauah
Associate II

I have tried the same code on NUCLEO-WB15CC and the code works perfectly.

 

Are there any specific I2C settings (e.g., timing, clock source, internal pull-ups) that must be configured differently for the STM32WBA series compared to the STM32WB series?

 

Updated: I have also tried updating STM32CubeIDE to 2.0.0 and the problem persist.

kclauah
Associate II

 

I've just tried updating my toolchain to the latest versions (CubeIDE 2.0.0, CubeMX 6.16.0, WBA FW 1.8.0, X-CUBE-MEMS1 12.0.0), but the issue now appears to be worse, with new errors emerging. The original problem remains unresolved. Still looking for a solution.