2013-03-16 07:42 PM
Hello...
Now i design USB Host System. In the system there are 2 button interrupts, USB Host Interrupt. I use STM32_F105-07_F2xx_USB-Host-Device_Lib_V2.0.0 libraries and stm32f105...In the system, i sometimes disable and enable button interrupts when i enter interrupt routine of button and when i enter USB Process function of USB libraries... i use system clock 8MHz for my system and PLL for my USB Host Clock...NVIC priorities is as follows: 1- Button interrupts(for each two) : NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 3; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;2- my USB board support package configuration : Timer : NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; USB Global Int. NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 5; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;And my button enable disable code is follows : void STM32_UP_Button_OnOff(FunctionalState NewState){ EXTI_InitTypeDef EXTI_InitStructure; /* Initializes the EXTI_InitStructure */ EXTI_StructInit(&EXTI_InitStructure); EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Line = UP_BUTTON_EXTI_LINE; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; //EXTI_ClearITPendingBit(UP_BUTTON_EXTI_LINE ); /* Disable the DOWN_BUTTON_EXTI_LINE on falling edge */ if(NewState == DISABLE) { EXTI_InitStructure.EXTI_LineCmd = DISABLE; } /* Enable the EXTI DOWN_BUTTON_EXTI_LINE on falling edge */ else { /* Clear the the DOWN_BUTTON_EXTI_LINE interrupt pending bit */ //E EXTI_InitStructure.EXTI_LineCmd = ENABLE; } EXTI_Init(&EXTI_InitStructure); }The problem is that when program works in USBH_USR_MSC_Application function, the button enable/disable does not work even if i see that External Interrupt Mask Register sets register in Keil... i can not enter button interrupts even if i enable button interrupts in USBH_USR_MSC_Application function? i want to change my enable, disable status in this function but i could not... Thanks in advanceBest regards #stm32-usb-host2013-03-17 05:17 PM
problem still goes on... any suggestion?
Thanks in advance2013-03-17 07:57 PM
Well I'm not totally clear about what is or is not going on here, I don't think I have enough info to duplicate. Consider a better presentation/explanation.
Do the EXTI interrupts ever work? If not, how are they configured in totality, not a selective summary. Is it reasonable to use EXTI_Init() to do this, or should you be changing individual bits in the EXTI peripheral. Could you turn the on/off via the NVIC, or a variable that flags enablement?2013-03-18 06:14 AM
Problem : i want to enable and disable USBH_Process(&USB_OTG_Core, &USB_Host) function with a FLAG... and i enable or disable this flag via my external interrupt routines. For example, when i click YES, TRANSFER button, i enable this Flag to enter USB_Process function and when i click NO TRANSFER button , i disable this Flag. Normally, i can enable or disable button interrupts in the program but i can not enable or disable in the USB_Process->USBH_USR_MSC_Application function. i tried with only External Interrupt Mask, after this via NVIC but again no result...
1. if i can disable only external interrupts via mask registers, i think it must be disabled? and it will not come to NVIC? i mean when i want to disable or enable external interrupt, should i enable or disable both NVIC and EXTI->IMR ? or only EXTI->IMR is enough?2 I use board support package to disable USB interrupts, USB Power port for low power application, it can be problem for my application when i sometimes open and close my USB Power port?3. And i think i use default USB port configuration. i do not need to make other configuration like making GPIO configuration. For example for interrupt port, we make some configuration for floating input etc. but for USB, is it default? RCC_OTGFSCLKConfig(RCC_OTGFSCLKSource_PLLVCO_Div3); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_OTG_FS, ENABLE) ;
2013-03-18 07:12 AM
Do the EXTI interrupts ever work? This is a pretty basic/fundamental question, let's start with it first.
Do you have the AFIO clock enabled in your F105 chip?2013-03-18 08:22 AM
application starts , yes it works... i can enter ext interrupts. and i change a flag in this interrupt. but after entering USR_App. in the USB process function, i can not change enable disable status of ext. interrupts...
RCC_APB2PeriphClockCmd(DOWN_BUTTON_CLK | RCC_APB2Periph_AFIO, ENABLE);this is part of AFIO...but i noticed something... in the past, i had the same problem with 1 timer... when i close timer, my button interrupts worked... i speak about other part of code... Thanks in advance...2013-03-18 08:24 AM
this is my main part
if (Main_Data.USBWriteFlag) { USBH_Process(&USB_OTG_Core, &USB_Host); }2013-03-18 08:32 AM
Ok, and the purpose of disabling them is what? Could you not just leave them enabled, and handle whatever state transitions you need based on your current state? Ignoring them if required.
I'm not sure how you're debugging this, but when trying to understand dynamic system interactions I tend to output telemetry out of a serial port or via a screen.2013-03-18 08:37 AM
Using an interrupt on a button can be an issue.
Buttons cause mechanical bounce and can display ugly signals when viewed on a scope,do the buttons employ de bounce circuitry?2013-03-18 08:52 AM
I'm fishing, and playing 20 questions to draw out an understanding of the system. I'm a savant, not a telepath.
I would contend that disabling an EXTI sourced interrupt, in the IRQHandler itself would be trivially easy to do. As the USB Handler is being pumped repetitively in a while(1) loop, one could also poll the buttons.