cancel
Showing results for 
Search instead for 
Did you mean: 

IC2 2 is interfering PB3.

BLilj.1
Associate

Hello.

I have a problem with STM32L051C8T6. I have uppdated an old project with a I2C bus connected to I2C 2 pins PB10 and PB11. The I2C bus works fine but it interferes with my port PB3. 

In file STM32L0XX_HAL_I2C.C the PB3 is Cleared (Reset) by this line hi2c->Instance->CR2 = tmpreg; in static void I2C_TransferConfig(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t Size, uint32_t Mode, uint32_t Request).

The port is reset until this line (*pData++) =hi2c->Instance->RXDR; in HAL_StatusTypeDef HAL_I2C_Master_Receive(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout).

This is not good since a LED is connected to PB3. This LED is flashing when the I2C 2 is used.

I have noticed that the STM32Cube creates a file stm32l0xx_hal_msp.c in later versions. This file I do not have in my old project.

Which is the easiest way to add a new function for example an I2C bus to an old project with a new function?

It is a lot of work to do this merge manually.

Please help me in this case since I am rather new to STM32Cube.

0 REPLIES 0