Problems using IIC in freertos

The stm32F103ZET6 chip I use, I want to use IIC communication to read and write AT24C02. However, when I initialize the IIC-related GPIO and structures, my chip will crash. After the crash, I cannot use the debug mode, so I cannot find it. Give specific reasons

static void prvSetupHardware( void )
{
	/* Start with the clocks in their expected state. */
	RCC_DeInit();

	/* Enable HSE (high speed external clock). */
	RCC_HSEConfig( RCC_HSE_ON );

	/* Wait till HSE is ready. */
	while( RCC_GetFlagStatus( RCC_FLAG_HSERDY ) == RESET )
	{
	}

	/* 2 wait states required on the flash. */
	*( ( unsigned long * ) 0x40022000 ) = 0x02;

	/* HCLK = SYSCLK */
	RCC_HCLKConfig( RCC_SYSCLK_Div1 );

	/* PCLK2 = HCLK */
	RCC_PCLK2Config( RCC_HCLK_Div1 );

	/* PCLK1 = HCLK/2 */
	RCC_PCLK1Config( RCC_HCLK_Div2 );

	/* PLLCLK = 8MHz * 9 = 72 MHz. */
	RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_9 );

	/* Enable PLL. */
	RCC_PLLCmd( ENABLE );

	/* Wait till PLL is ready. */
	while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
	{
	}

	/* Select PLL as system clock source. */
	RCC_SYSCLKConfig( RCC_SYSCLKSource_PLLCLK );

	/* Wait till PLL is used as system clock source. */
	while( RCC_GetSYSCLKSource() != 0x08 )
	{
	}

	/* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */
	RCC_APB2PeriphClockCmd(	RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC
							| RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE );

	/* SPI2 Periph clock enable */
	//RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE );


	/* Set the Vector Table base address at 0x08000000 */
	NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );

	NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );

	/* Configure HCLK clock as SysTick clock source. */
	SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );
	
	//init peripheral
	lcd_Strinit();
	GPIO_LED_Config();
	GPIO_Key_Iint();
	eeprom_init();
}
void I2C_EE_Init( void )
{
//	GPIO_InitTypeDef  GPIO_InitStructure;
	
//	EEPROM_I2C_APBxClock_FUN ( EEPROM_I2C_CLK, ENABLE );
//	EEPROM_I2C_GPIO_APBxClock_FUN ( EEPROM_I2C_GPIO_CLK, ENABLE );
	
//    GPIO_InitStructure.GPIO_Pin = EEPROM_I2C_SCL_PIN;
//    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
//    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
//    GPIO_Init(EEPROM_I2C_SCL_PORT, &GPIO_InitStructure);
//	
//    GPIO_InitStructure.GPIO_Pin = EEPROM_I2C_SDA_PIN;
//    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
//    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
//    GPIO_Init(EEPROM_I2C_SDA_PORT, &GPIO_InitStructure);
}

void I2C_modeconfig( void )
{
//	I2C_InitTypeDef  I2C_InitStructure;
	
//	I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
//	I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_16_9;
//	I2C_InitStructure.I2C_OwnAddress1 =I2Cx_OWN_ADDRESS; 
//	I2C_InitStructure.I2C_Ack = I2C_Ack_Enable ;
//	I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
//	I2C_InitStructure.I2C_ClockSpeed = I2C_Speed;
//	
//	I2C_Init(EEPROM_I2Cx, &I2C_InitStructure);
//	I2C_Cmd(EEPROM_I2Cx, ENABLE);
}
void eeprom_init( void )
{
	I2C_EE_Init();
	I2C_modeconfig();
}

Although I commented out all the code inside these two initialization functions, as long as calling any of these two functions will cause the program to freeze, unless both functions are commented out, it can run normally

Why not simply step through your code with a debugger to see what’s going on ?

Thanks for your post. To maintain the value of this resource for FreeRTOS users we prefer to keep question strictly about FreeRTOS and its related libraries, rather than embedded systems in general. As your question doesn’t appear to be FreeRTOS related I recommend asking on an ST or general embedded forum - thanks.