I am using free RTOS on STM32 hardware which I have designed. There is an STM32F103RG MCU connected to an accelerometer (MMA8415Q), gyroscope(L3G2400D) and USB. The accelerometer is ineterfaced on I2C and Gyroscope on SPI. For the accelerometer and gyroscope routines I use taskENTER_CRITICAL and taskEXIT_CRITICAL during the I2C and SPI access. At the beginning of the program I just read the accelerometer and Gyroscope device ID registers. After this I go ahead and init the USB section for using VCOM.
If I read the accelerometer and Gyrocope registers, the USB is not enumerated by Windows and says Windows cannot recognise device.
If i comment out the taskENTER_CRITICAL and taskEXIT_CRITICAL from the accelerometer and Gyroscope routines then the Windows enumerated USB properly.
Can anyone advise on the above problem.