STM32F042 I2C Debug Problem
Hello,
Today, I was receiving my eeprom data normally with my normally working I2C code, but when I entered debug mode, the uwtick increased on my processor, but it was not receiving my commands. The LED indicating that the code was running was not blinking. After some time I noticed that in debug mode the commands were not working but when not in debug mode it was working.
Setting & Code

static inline void EEPROM_Write(uint16_t memAddress, uint8_t* data, uint16_t dataSize) {
HAL_I2C_Mem_Write(&hi2c1, EEPROM_ADDR << 1, memAddress, I2C_MEMADD_SIZE_8BIT, data, dataSize, HAL_MAX_DELAY);
}
static inline void EEPROM_Read(uint16_t memAddress, uint8_t* data, uint16_t dataSize) {
HAL_I2C_Mem_Read(&hi2c1, EEPROM_ADDR << 1, memAddress, I2C_MEMADD_SIZE_8BIT, data, dataSize, HAL_MAX_DELAY);
}
void Main_Loop(){
/* System Init*/
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1); HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2); HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2);
TIM1->CCR1 = 0; TIM1->CCR2 = 0;
Motor.M_STATUS = MOTOR_RELEASE; Motor.ControlType = CLOSE_LOOP;
Memory_Init();//M24C01 EEPROM Init //0x10 - 0x20 Parameters Address
HAL_ADCEx_Calibration_Start(&hadc);
HAL_TIM_Encoder_Start_IT(&htim2,TIM_CHANNEL_ALL);
while(1){
TIMER(); //Timer + Task Timer
Motor_Control(Motor.Rotation,Motor.Acceleration,Motor.Brake);
Timing.LoopTime = HAL_GetTick();
Timing.ElapsedTime = Timing.LoopTime - Timing.Timer;
}
}
