cancel
Showing results for 
Search instead for 
Did you mean: 

IKS02A1 and Nucleo H503RB don't work

matkergo
Associate

Hi, 

I am curretly using a Nucleo H503RB and the IKS02A1 expansion board in order to use the ISM330DHCX.

I tried several way to use via STM32Cube IDE which is my goal as i want to use C language without success to see any sign of an i2c adress with an i2c scan code.

 

When i used the Arduino ide with STM32Duino and the ISM330DHCX library it worked immediatly with the wire library i2c default instance. 

What am i doing wrong in stm32cube ide ?

 

int main(void)

{

 

 

HAL_Init();

 

/* USER CODE BEGIN Init */

 

/* USER CODE END Init */

 

/* Configure the system clock */

SystemClock_Config();

 

/* USER CODE BEGIN SysInit */

 

/* USER CODE END SysInit */

 

/* Initialize all configured peripherals */

MX_GPIO_Init();

MX_ICACHE_Init();

MX_USART2_UART_Init();

MX_I2C2_Init();

MX_USART3_UART_Init();

MX_I2C1_Init();

/* USER CODE BEGIN 2 */

HAL_UART_Transmit(&huart3, StartMSG, sizeof(StartMSG), 10000);

 

uint8_t i = 0, ret;

for(i=1; i<128; i++)

{

ret = HAL_I2C_IsDeviceReady(&hi2c1, (uint16_t)(i<<1), 3, 5);

if (ret != HAL_OK) /* No ACK Received At That Address */

{

HAL_UART_Transmit(&huart3, Space, sizeof(Space), 10000);

}

else if(ret == HAL_OK)

{

HAL_UART_Transmit(&huart3, StartMSG, sizeof(StartMSG), 10000);

 

}

}

HAL_UART_Transmit(&huart3, EndMSG, sizeof(EndMSG), 10000);

for(i=1; i<128; i++)

{

ret = HAL_I2C_IsDeviceReady(&hi2c2, (uint16_t)(i<<1), 3, 5);

if (ret != HAL_OK) /* No ACK Received At That Address */

{

HAL_UART_Transmit(&huart3, Space, sizeof(Space), 10000);

}

else if(ret == HAL_OK)

{

HAL_UART_Transmit(&huart3, StartMSG, sizeof(StartMSG), 10000);

 

}

}

HAL_UART_Transmit(&huart3, EndMSG, sizeof(EndMSG), 10000);

1 REPLY 1
Andrew Neil
Evangelist III