2022-07-19 12:28 AM
Hi guys,
I'm new to this. I'm using STM32L476RG in combination with NFC 4 Click. I downloaded the X-CUBE-NFC6 but when i go to read an NFC Tag nothing happens. NFC 4 Click device has ben succesfully initialized. They are connected using I2C. What am I doing wrong?
Brgd,
Anej
Solved! Go to Solution.
2022-07-19 02:59 AM
Hi,
yes, the interrupt is needed for proper operation (regarding your issue, having the interrupt not connected was my guess...).
I would recommend to check the MCU<->SR25R3916 connections by having a look on table 1 in UM2615.
The interrupt has to be connected on PA0 (CN8.1).
Rgds
BT
2022-07-19 02:22 AM
Hi,
In order to use I2C communication, make sure to follow §3.5.1 in the UM2616.
In particular, "You have to use the pre-processor compilation flag RFAL_USE_I2C and rename USE_HAL_SPI_REGISTER_CALLBACKS by USE_HAL_I2C_REGISTER_CALLBACKS, if needed, to activate the I²C driver compilation. "
If the I2C communication is OK, make sure to have ST25R3916 interrupt pin being properly connected. This can be checked by enabling ST25R_SELFTEST define. Just recompile with ST25R_SELFTEST being defined and run the FW from the debugger and check the return code of st25r3916Initialize (likely it will return ERR_TIMEOUT from line 183 of st25r3916.c).
Rgds
BT
2022-07-19 02:50 AM
Hi,
thanks a lot for the reply. I renamed the USE_HAL_I2C_REGISTER_CALLBACKS.
I do not even have an inetrrupt connected. I now see it is mandatory. To where do I connect it on the STM32L476RG side?
Thank you so much for your help.
Rgds,
Anej
2022-07-19 02:59 AM
Hi,
yes, the interrupt is needed for proper operation (regarding your issue, having the interrupt not connected was my guess...).
I would recommend to check the MCU<->SR25R3916 connections by having a look on table 1 in UM2615.
The interrupt has to be connected on PA0 (CN8.1).
Rgds
BT
2022-07-19 03:00 AM
Thank you so much. Now it is working like it should.
Could not do it with out you.
Rgrd,
Anej
2022-07-28 03:02 AM
Hi again,
I now connected 4 NFC 4 Click Modules via 74HC138 to I2C1 bus. But I am having issues with 4 interrupts. They are connected to pins PA0, PA1, PA4 and PA6. How do I define 4 interrupts and tell the program to listen for them?
rgrd, Anej
2022-07-28 05:30 AM
Hi,
basically, you have to configure the related GPIO in GPIO_MODE_IT_RISING thanks to HAL_GPIO_Init. You will find an example of currently used PA0 configuration in I2C1_MspInit() in STM32CubeExpansion_NFC6_V1.1.0\Projects\STM32L476RG-Nucleo\Applications\PollingTagDetect\Src\nucleo_l476rg_bus.c lines 1270-1275.
I suggest to simply replace line 1271 by:
gpioinitstruct.Pin = BUS_I2C1_IRQ_GPIO_PIN | GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_6;
Then you have to configure the NVIC Interrupt Controller accordingly for the EXTI0_IRQn, EXTI1_IRQn, EXTI4_IRQn and EXTI9_5_IRQn interrupt lines. See I2C1_MspInit() in STM32CubeExpansion_NFC6_V1.1.0\Projects\STM32L476RG-Nucleo\Applications\PollingTagDetect\Src\nucleo_l476rg_bus.c lines 1284-1286:
I suggest to simply add the following lines after line 1286
HAL_NVIC_SetPriority(EXTI1_IRQn, BSP_I2C1_IRQ_PRIO, 0);
HAL_NVIC_EnableIRQ(EXTI1_IRQn);
HAL_NVIC_SetPriority(EXTI4_IRQn , BSP_I2C1_IRQ_PRIO, 0);
HAL_NVIC_EnableIRQ(EXTI4_IRQn );
HAL_NVIC_SetPriority(EXTI9_5_IRQn , BSP_I2C1_IRQ_PRIO, 0);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn );
Then, add EXTI1_IRQHandler(void), EXTI4_IRQHandler(void) and EXTI9_5_IRQHandler(void) interrupt handlers in STM32CubeExpansion_NFC6_V1.1.0\Projects\STM32L476RG-Nucleo\Applications\PollingTagDetect\Src\stm32l4xx_it.c. See EXTI0_IRQHandler(void) for an example.
Note that the RFAL is designed to run a single instance of the reader. In a multi instance context, you will have to do some adaptation. Do you plan to use the 4 readers only sequentially or the 4 of them at the same time?
Rgds
BT