2017-04-28 11:51 AM
Hello, writing support library for my dev board, and i run into the problem.
I have simple txt file generated by Print_SD() function.
If this function is called from mains, it does produce TEST.TXT file, no problemsBut if i map this function to GPIO interrupt, and call Print_SD() function from IRQ program, it simply hangs. It looks like it is preventing functions to be executed:
void SDIO_IRQHandler(void);void SD_SDIO_DMA_IRQHANDLER(void);How can i fix this ? SDIO does have higher priority, so why it should hang ?
void NVIC_Config(void) //SDIO
{ NVIC_InitTypeDef NVIC_InitStructure; /* Configure the NVIC Preemption Priority Bits */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1); NVIC_InitStructure.NVIC_IRQChannel = SDIO_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); NVIC_InitStructure.NVIC_IRQChannel = SD_SDIO_DMA_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; NVIC_Init(&NVIC_InitStructure); }void Button_IRQ_Config(void)
{ /* SW1 PJ5 | SW2 PB10 */EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_InitStructure.EXTI_Line = EXTI_Line5; EXTI_Init(&EXTI_InitStructure); EXTI_InitStructure.EXTI_Line = EXTI_Line10; EXTI_Init(&EXTI_InitStructure); NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0xF; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0xF; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; NVIC_Init(&NVIC_InitStructure); NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn; NVIC_Init(&NVIC_InitStructure);}#ftfs #sdio #fat32 #irq #gpioSolved! Go to Solution.
2017-04-28 02:34 PM
With
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1); or something more appropriate?
2017-04-28 12:03 PM
Unless I'm mistaken you've selected one bit for premption level, and you only have 4 bits total to work with. Setting 0xF/0xF is counter productive. Select a 2/2-bit split, and configure the 'don't care' interrupt with 0x3/0x3
Writing data to the SD from an interrupt is probably something best avoided, it will block for a long while, buffer the data, and write in a worker thread, so you can serialize access to FatFs and SDIO.
2017-04-28 12:22 PM
Hi,
I try to run with different values, but did not helped, try one higher, one lower, Other way around, same, it is still hanging...2017-04-28 02:34 PM
With
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1); or something more appropriate?
2017-04-28 02:37 PM
Hey, it did the trick, i was only changing sub- priority
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //placed before GPIO NVIC config2017-07-31 07:17 AM
Hi,
Sorry to 'piggyback' on this question but where can I find the implementation of NVIC_PriorityGroupConfig() and the definition of NVIC_PriorityGroup_4 ?
The FreeRTOS website states that this call is required when using the STM32 Driver Library with FreeRTOS but I cannot find it in either the Driver Library or the CMSIS code that is generated when creating a project using STM32CubeMX. Reference is, however, made to it from stm32f7xx_hal_cortex.c in the header documentation for the function HAL_NVIC_EnableIRQ().
Is this no longer required on STM32F7 and only required for M3/M4 ?
Any clarification would be appreciated.
David
2017-07-31 09:18 AM
Thanks Jan !
With that pointer, I was able to find NVIC_PRIORITYGROUP_4 too.
I should have searched without case sensitivity on !!!
David
2017-07-31 10:05 AM
NVIC_PriorityGroupConfig() is the SPL's version of CMSIS's standard NVIC_SetPriorityGrouping(). Cube has another one, HAL_NVIC_SetPriorityGrouping().
JW