X-CUBE-NFC6 manual porting to STM32F4 Nucleo-144: EXTI interrupt never clears
Hi I didn’t find any topic or help for the porting of the X-cube-NFC06 to a nucleo 144 f439zi. I’m writting down all the setup I used to achieve this porting with succes, maybe that will help someone one day.

IOC configurations
- SPI: prescaler 16 (5.25MBits/s) / CPHA 2 edge (info from example and can be found in st25r3916b datasheet) do not enable NSS from cubeMX instead configure PD14 as GPIO_OUTPUT and name it SPI1-CS.
- IRQ: rising edge / no pull / don’t forget to activate IRQ from NVIC (exti line3 interrupt)
*ETH peripheral is using PA7, instead of PA7 I used PB5 as SPI1_MOSI pin. U just have to use a jumper wire to wire up PB5 to D11 (old PA7).
Code modifications
After generating the code, you should be able to compile without any trouble. If you program the nucleo, you will be facing this :

The program isn’t giving any error but, it’s stuck in a infinite “loop”. If you measure with a multimeter btw GND and ST25R_IRQ pin you will constantly have a high lvl (we don’t want this). Here is a picture from a logic analyzer for more context.

SOLUTION
go to main.c, PRESS CTRL on MX_GPIO_Init() and go to user code section in this function. Copy paste this (adapt for your ST25R_IRQ PIN if is not PA3 !!!).
/* USER CODE BEGIN MX_GPIO_Init_2 */
EXTI_ConfigTypeDef EXTI_ConfigStructure;
EXTI_ConfigStructure.Line = EXTI_LINE_3;
EXTI_ConfigStructure.Mode = EXTI_MODE_INTERRUPT;
EXTI_ConfigStructure.Trigger = EXTI_TRIGGER_RISING;
EXTI_ConfigStructure.GPIOSel = EXTI_GPIOA;
HAL_EXTI_SetConfigLine(&H_EXTI_3, &EXTI_ConfigStructure);
/* USER CODE END MX_GPIO_Init_2 */Compile, flash, enjoy.

What this fix ?
before this patch, IRQ is triggered but his pending flag never rise down.

The condition if (regval != 0x00u) never happens because hexti->Line is pointing the wrong value (0 by default). We have to manualy route the right value to hexti->Line by using HAL_EXTI_SetConfigLine(&H_EXTI_3, &EXTI_ConfigStructure);
