FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [June 2015 Threads]
Hello,
I am trying to use the I2C functions found in stm32f10xi2c.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 configLIBRARYLOWESTINTERRUPTPRIORITY 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?
Hmm. First look seems to indicate you have done everything necessary. Probably a stupid question, but are you sure the interrupt you are setting the priority for is the one that is actually executing - and more likely - that nothing in the ST drivers is resetting the priority after you have set it?
The other thing to check would be that the number of priority bits is set correctly in FreeRTOSConfig.h - although if you are using FreeRTOS V8.2.1 then I think that is done automatically for you using another assert(), worth checking though.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.