I am using STM32L496QGI6P mcu to communicate with the ISL91302BIIZ-TR5931 PMIC.
Following is my relevant code which uses i2c3 (pg7/pg8 pins on mcu for scl/sda), I am also initializing GPIO PE1 as EN pin for PMIC. I am at the end scanning the i2c3 bus to see if I can find any device but I am not able to get a communication on any of the I2C addresses.
else if(hi2c->Instance==I2C3)
{
/* USER CODE BEGIN I2C3_MspInit 0 */
/* USER CODE END I2C3_MspInit 0 */
/** Initializes the peripherals clock
*/
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_I2C3;
PeriphClkInit.I2c3ClockSelection = RCC_I2C3CLKSOURCE_PCLK1;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
Error_Handler();
}
__HAL_RCC_GPIOG_CLK_ENABLE();
/**I2C3 GPIO Configuration
PG7 ------> I2C3_SCL
PG8 ------> I2C3_SDA
GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF4_I2C3;
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
/* Peripheral clock enable */
__HAL_RCC_I2C3_CLK_ENABLE();
/* USER CODE BEGIN I2C3_MspInit 1 */
/* USER CODE END I2C3_MspInit 1 */
void I2C3_ScanBus(void) {
printf("Scanning I2C3 bus...\n");
//Reinit_I2C3();
//__HAL_RCC_I2C3_CLK_ENABLE();
for (uint8_t addr = 0x03; addr <= 0x77; addr++) {
// Shift address to 8-bit form (HAL expects 8-bit address)
if (HAL_I2C_IsDeviceReady(&hi2c3, addr << 1, 2, 10) == HAL_OK) {
cmis_page0[0] = addr;
HAL_Delay(10);
printf("Scan complete.\n");
int main(void)
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
PeriphCommonClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_I2C4_Init();
MX_I2C2_Init();
MX_ADC1_Init();
MX_ADC2_Init();
MX_ADC3_Init();
__HAL_RCC_SPI1_CLK_ENABLE();
MX_SPI1_Init();
__HAL_RCC_I2C2_CLK_ENABLE();
__HAL_RCC_I2C4_CLK_ENABLE();
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_6, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_1, GPIO_PIN_RESET);
HAL_Delay(1000);
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_1, GPIO_PIN_SET);
MX_I2C3_Init();
I2C3_ScanBus();
void SystemClock_Config(void)
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
/** Configure the main internal regulator output voltage
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK)
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
RCC_OscInitStruct.MSICalibrationValue = 0;
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
/** Initializes the CPU, AHB and APB buses clocks
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
/**
* @brief Peripherals Common Clock Configuration
* @retval None
void PeriphCommonClock_Config(void)
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;
PeriphClkInit.AdcClockSelection = RCC_ADCCLKSOURCE_PLLSAI1;
PeriphClkInit.PLLSAI1.PLLSAI1Source = RCC_PLLSOURCE_MSI;
PeriphClkInit.PLLSAI1.PLLSAI1M = 1;
PeriphClkInit.PLLSAI1.PLLSAI1N = 8;
PeriphClkInit.PLLSAI1.PLLSAI1P = RCC_PLLP_DIV2;
PeriphClkInit.PLLSAI1.PLLSAI1Q = RCC_PLLQ_DIV2;
PeriphClkInit.PLLSAI1.PLLSAI1R = RCC_PLLR_DIV2;
PeriphClkInit.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_ADC1CLK;
static void MX_I2C3_Init(void)
/* USER CODE BEGIN I2C3_Init 0 */
/* USER CODE END I2C3_Init 0 */
/* USER CODE BEGIN I2C3_Init 1 */
/* USER CODE END I2C3_Init 1 */
hi2c3.Instance = I2C3;
hi2c3.Init.Timing = 0x10030D09;
hi2c3.Init.OwnAddress1 = 0;
hi2c3.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
hi2c3.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
hi2c3.Init.OwnAddress2 = 0;
hi2c3.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
hi2c3.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
hi2c3.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
if (HAL_I2C_Init(&hi2c3) != HAL_OK)
/** Configure Analogue filter
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c3, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
/** Configure Digital filter
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c3, 0) != HAL_OK)
/* USER CODE BEGIN I2C3_Init 2 */
//HAL_I2CEx_EnableFastModePlus(I2C_FASTMODEPLUS_I2C3);
/* USER CODE END I2C3_Init 2 */
static void MX_GPIO_Init(void)
/* USER CODE BEGIN MX_GPIO_Init_1 */
/* USER CODE END MX_GPIO_Init_1 */
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
HAL_PWREx_EnableVddIO2();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_1;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
Can you help to check if the initialization sequence for PMIC is correct and if I am missing setting anything on PMIC before which I will be able to communicate with PMIC using I2C.
Hi
As I understand you raised the ticket our concern person will provide further support
Thanks
AB
Hi,
Kindly check the following:
Tie WDOG_RST (pin C6 on ISL91302B) to GND via 10k or drive it low from STM32.
WDOG_RST
Ensure SDA/SCL pull-ups (~4.7k) are present to VIO.
Thanks, and regards,Avinash Kumar
Hello Avinash,
Thanks for the reply. Below is the schematic which we are using:
In my code, I follow the following flow: HAL Init->I2C3 Init->EN pin High->wdog reset low->scan for PMIC (or) HAL Init->I2C3 Init->wdog reset low->EN pin High->scan for PMIC. I have put some delay between the calls. But, I am still unable to detect the PMIC using I2C.
Your schematics look ok. Kindly get the program checked from the STM side.
Thanks for the response. Can you please let me know the sequence to turn on the PMIC (in terms of Enable or any other pins) before which I2C communication with PMIC is available.
Also, can you confirm that I can use STM32 MCU to communicate with this PMIC. Do I need any other driver or HAL layer to communicate with it other than the generic HAL for I2C.
Thanks!
Hi Vicks,
I will ask internal team if we have a sample code to share with you, you will get a better idea.
Thanks for the help. It will be very helpful if I had sample code for the sequence. Let us know once you have it.
Thanks again for your help! Greatly appreciate it.