We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello everyone.. I am working on STM32F405xx controller. I am configuring SPI1 NSS pin(PA4) as external interrupt pin for falling edge but its not working for me. in reference manual it is given that it is possible to configure this pin (NSS pin )as general purpose pin while using the SPI1 in Software Select Mode. I have done the following settings:
/*!< SPI NSS pin configuration */ SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; SPI_InitStructure.SPI_Mode = SPI_Mode_Master; SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low; // SPI_CPOL_High SPI_CPOL_Low SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; // SPI_CPHA_1Edge SPI_CPHA_2Edge SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; SPI_InitStructure.SPI_BaudRatePrescaler = baudRatePrescaler; SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; SPI_InitStructure.SPI_CRCPolynomial = 7; SPI_Init(SPI1, &SPI_InitStructure); void Interrupt_Config(void) { GPIO_InitTypeDef GPIO_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; EXTI_InitTypeDef EXTI_InitStructure; /* Enable GPIOA clock */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);/* 13/09/2013 GPIOA */ /* Enable SYSCFG clock */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); /* Configure interrupt pin */ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; GPIO_Init(GPIOA, &GPIO_InitStructure); /* Connect GPIO_Pin_4 */ SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource4); /* Configure GPIO_Pin_4 */ EXTI_InitStructure.EXTI_Line = SID_INTRPT_LINE; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); /* Enable and set GPIO_Pin_4 Interrupt to the lowest priority */ NVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQn; /* 13/09/2013 */ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x01; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x01; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); } // following is the handler for temporary purpose void EXTI4_IRQHandler(void) { int x; x++; }
When i am checking it on simulator by clicking on to pending tab it goes into the handler but on real hardware it is not coming to handler. On hardware end everything is ok.
Looks reasonable if SID_INTRPT_LINE is EXTI_Line_4, and if your IRQHandler actually checked and cleared the same. I'd probably pull PA4 High.
Thanks for your kind support
I have solved the issue.