ajcurtis84 wrote on Friday, June 26, 2015:
Hello,
I am trying to use the I2C functions found in stm32f10x_i2c.c. The one exception is that I am trying to unlock a semaphore from within the DMA IRQ handlers for synchronization. Even setting the IRQ priority to configLIBRARY_LOWEST_INTERRUPT_PRIORITY fails.
Here are the pertinent snippets of code:
:::C
#!NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
#.
#.
#/* Configure and enable I2C DMA TX Channel interrupt */
#NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel6;
#NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_LOWEST_INTERRUPT_PRIORITY;
#NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
#NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
#NVIC_Init(&NVIC_InitStructure);
#/* Configure and enable I2C DMA RX Channel interrupt */
#NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel7;
#NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_LOWEST_INTERRUPT_PRIORITY;
#NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
#NVIC_Init(&NVIC_InitStructure);
#.
#.
#void sEE_I2C_DMA_TX_IRQHandler(void) {
# BaseType_t HigherPriorityWoken = pdFALSE;
# /* Check if the DMA transfer is complete */
# if (DMA_GetFlagStatus(sEE_I2C_DMA_FLAG_TX_TC) != RESET) {
# /* Disable the DMA Tx Channel and Clear all its Flags */
# DMA_Cmd(sEE_I2C_DMA_CHANNEL_TX, DISABLE);
# DMA_ClearFlag(sEE_I2C_DMA_FLAG_TX_GL);
#
# /*!< Wait till all data have been physically transferred on the bus */
# sEETimeout = sEE_LONG_TIMEOUT;
# while (!I2C_GetFlagStatus(sEE_I2C, I2C_FLAG_BTF)) {
# if ((sEETimeout--) == 0)
# sEE_TIMEOUT_UserCallback();
# }
#
# /*!< Send STOP condition */
# I2C_GenerateSTOP(sEE_I2C, ENABLE);
#
# /* Perform a read on SR1 and SR2 register to clear eventually pending flags */
# (void) sEE_I2C->SR1;
# (void) sEE_I2C->SR2;
#
# /* Reset the variable holding the number of data to be written */
# *sEEDataWritePointer = 0;
#
# xSemaphoreGiveFromISR(EepromDoneCondition,&HigherPriorityWoken);
# portYIELD_FROM_ISR(HigherPriorityWoken);
# }
#}
I am only having this problem with DMA. GPIO EXTI works fine.
Thoughts?
- Allen