Skip to main content
Senior III
Oct 28, 2026 11:32 AM UTC
Question

BLE timeout when using I2C1

STM32WB55 - dongle


I’m trying to send I2C data over BLE. The dongle board only has I2C1 exposed but whenever I try to use I2C1 I get a BLE time out error. If I change to I2C3, which is not connected to anything, I get no time out error & get a whole load of 0’s as expected. Also when I send dummy data with no I2C at all the BLE works as expected.

I looked at what I thought were similar problems on here but so far the proposed solutions haven’t had any effect in the behaviour.

Additional info, this code worked fine on the P-NUCLEO-WB55 board.

  I2C_HandleTypeDef hi2c1;
I2C_HandleTypeDef hi2c3;

// Timeouts when I use hi2c1 as below but send expected 0's when using hi2c3

/* ADT7410 set up */
/* temp_0 at 0x48
* temp_1 at 0x49 */
temp_0.adti2c = &hi2c1; // I2C Handler
ADT7410_Init(&temp_0, 0x48); // I2C address depends of A0 and A1 pins
ADT7410_Reset(&temp_0); // Optional
ADT7410_SetResolution(&temp_0, ADT7410_16BITS); // Put the device in 16 bits resolution

temp_1.adti2c = &hi2c1; // I2C Handler
ADT7410_Init(&temp_1, 0x49); // I2C address depends of A0 and A1 pins
ADT7410_Reset(&temp_1); // Optional
ADT7410_SetResolution(&temp_1, ADT7410_16BITS); // Put the device in 16 bits resolution

/* ADXL345 set up
* acc_0 at 0x1D, write 0x3A, read 0x3B
* acc_1 at 0x53, write 0xA6, read 0xA7
*/
acc_0.adxl345i2c = &hi2c1; // I2C handler - might have to change this
acc_1.adxl345i2c = &hi2c1; // ~CS needs to be tied to Vdd for I2C comms
ADXL345_Init(&acc_0, 0x1D, 0x3A, 0x3B); // ALT_ADDRESS tied to Vdd
ADXL345_Init(&acc_1, 0x53, 0xA6, 0xA7); // ALT_ADDRESS tied to GND

 

3 replies

Uwe Bonnes
Chief
Oct 28, 2026 12:28 PM UTC

ADT7410_XXX() functions are not shown. Check that there is no blocking delay used.

Senior III
Oct 28, 2026 12:38 PM UTC

The ADT7410 read code below. The only blocking I can see is waiting on the ADT7410 to be ready & that is on a timer just in case of time out. As mentioned in the OP this wasn’t an issue with the P-NUCLEO board.

 

HAL_StatusTypeDef ADT7410_ReadTemp(ADT7410 *ADT7410)
{
ADT7410_SetOperationMode(ADT7410, ADT7410_ONE_SHOT_MODE);
uint32_t startTime = HAL_GetTick();

while (!ADT7410_Ready(ADT7410))
{
if (HAL_GetTick() - startTime> (uint32_t) 1.5 * ADT7410_SINGLE_CONV_TIME)
{
return HAL_TIMEOUT;
}
}

uint8_t addr = ADT7410_ADDR_TEMP_MSB;
uint8_t raw[2] = { 0x00, 0x00 };
uint16_t raw_read = 0x0000;

HAL_I2C_Master_Transmit(ADT7410->adti2c, ADT7410->address, &addr, 1, ADT7410_TIMEOUT_I2C);
HAL_I2C_Master_Receive(ADT7410->adti2c, ADT7410->address, raw, 2, ADT7410_TIMEOUT_I2C);

raw_read += (raw[0] << 8);
raw_read += (raw[1] << 0);

ADT7410->raw_data = raw_read;
ADT7410_RawToTemp(ADT7410);

return HAL_OK;
}

 

Uwe Bonnes
Chief
Oct 28, 2026 10:21 PM UTC

while (! ready) looks like a tight blocking loop. With a device attached on I2C1, this will wait. Without a device connected, I2C primitives will get no ACK and probably abort, but that code again is missing.