I’m setting up a FreeRTOS v8.0.0 application on an STM32L1xxB (Cortex M3) based. I have a strange issue when calling I2C functions within my tasks :
whenever I call a function to write some I2C data it will trigger corresponding interrupts only if :
- it gets called in the task initializazion section (before the inifinite for loop)
2)It gets wrapped in a function itself.
For example, my I2C function is I2C_WriteReg(Device_Address, Reg_Address, num_data, &beffer);
Related TX interrupts will be generated only I do the following :
return I2C_WriteReg(Device_Address, Reg_Address, num_data, &beffer);
and then I call the function from the task inititlization section :
static void LedTask( void pvParameters )
/ if I call I2C_WriteReg(…) here it will not work */
/* if I call I2C_WriteReg(…) here it will not work */
Same thing holds for I2C RX interrupts when I use I2C_ReadReg(…)
I’ve taken precautions on NVICPriorityGroup = 4 and tested the I2C interrupts with priority 0 (maximum) and then 12 that is between configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY (=5) and configLIBRARY_LOWEST_INTERRUPT_PRIORITY(=15) since in later developments I’m planning to use xSemaphoreGiveFromISR(…) functions within I2C interrupt context to wake up tasks waiting for I2C operations.
Do you have any suggestion on what my problem might be related to ?