2026-01-13 8:55 AM
Hello,
I have tried a number of I2C slave tutorials found on YouTube with no success, but none are specifically for the STM32G03 series. Also I am getting a very strange phenomenon. In CubeMX for I2C2 I set the first slave address to 0x012. On my PC I am using python with a USB adapter to scan() the bus. I have an EEprom on the same bus an the scan address is correct but for the MCU it returns 0x13?
Has anyone encountered this address shift?
Is there ANY WORKING examples for this MCU series?
This is my first post on this community.
2026-01-13 8:58 AM
I meant 0x12 to 0x13.
2026-01-13 9:07 AM
All of these examples are working examples:
https://github.com/STMicroelectronics/STM32CubeG0/tree/master/Projects
Here is an I2C example:
Consider showing your code or following an existing working example.
2026-01-13 9:08 AM
Are you sure you are correctly justifying the 7-bit address ?
Please give some more details of your setup:
How to write your question to maximize your chances to find a solution
2026-01-13 10:23 AM
Code generated by CubeMX -
/* USER CODE END I2C2_Init 1 */
hi2c2.Instance = I2C2;
hi2c2.Init.Timing = 0x10707EBE;
hi2c2.Init.OwnAddress1 = 36;
hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
hi2c2.Init.OwnAddress2 = 0;
hi2c2.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
hi2c2.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
hi2c2.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
if (HAL_I2C_Init(&hi2c2) != HAL_OK)
{
Error_Handler();
}