2020-07-09 03:08 AM
Hi,
I have downloaded the STM32CubeExpansion_NFC6_V1.0.0 and tested it on the NUCLEO-L476RG and it worked fine.
But when I tried to copy the file and add them to a STM32L476VG project it didn't work. I have changed the NFC, UART and LED pins.
The LEDs work fine, UART too, the NFC is well configured (they made a test for that), but it can't read the NFC Tags and when I approach the phone (with NFC activated) I get a HardFault.
Does any one have an idea about this please ?
Thanks
Solved! Go to Solution.
2020-07-21 07:46 AM
Hi,
We have figured it out, it was a Hardware problem, and we fixed it and it's now working fine
Thank you for your time and your help
Best regards
2020-07-09 07:41 AM
Hi
ST25R3916-DISCO is build around the STM32L476VG so there is no reason to have the RFAL not working. I would suggest to check the stack size.
If you have used STM32CubeMX for the project generation, can you share the .ioc file?
Thanks
Rgds
BT
2020-07-15 12:48 AM
Hi,
when using the linker option --info=stack, the map file contains the Stack Usage Information: Maximum Stack Usage for main 0x6f0 bytes. Your .ioc file defines a stack size of 0x400.
I would suggest to align with the stack size used in the demo (0x1000).
See AN 316 (Determining the stack usage of applications) for more information on stack size.
Rgds
BT
2020-07-20 06:37 AM
Hi,
Sorry for my late response.
Actually, I'm using a customized board, and I have changed the Led pins and NFC's IRQ/NSS pins.
The NFC RFAL initalization is good, the leds flash 3 times before the TX led keep toggling
As you can see in the project I sent you :
the NFC pins are (nucleo_l476rg_bus.h) :
the Led pins are (nfc06a1_conf.h) :
the USER_BUTTON is on E0 (stm32l4xx_nucleo.h) and I changed the USER_BUTTON_EXTI_LINE to GPIO_PIN_0 and USER_BUTTON_EXTI_IRQn to EXTI0_IRQn
I have modified the function EXTI0_IRQHandler() (stm32l4xx_it.c & stm32l4xx_it.h) to EXTI4_IRQHandler()
I have also changed USART, I am using the USART1 instead of 2 and I changed the pins to A9 and A10
I changed the STACK and HEAP size to 0x1000 and 0x800 like in the demo
I have modified the function HAL_MspInit() (stm32l4xx_hal_msp.c) because I'm using some of the Port E pins, so I commented the lines HAL_GPIO_Init(GPIOE, &GPIO_InitStruct) and __HAL_RCC_GPIOE_CLK_DISABLE()
But still it's not working, the DEMO.c sometimes it works (only CE) only for phones, the other times it blocks and it ends in a HARD_FAULT. For the nfc tags it doesn't work at all
NDEF_DEMO.c doesn't work neither for phones or NFC tags
Otherwise, I have tested the NFC project on the B-L475EIOT01A2C board and I have made the same changes and it worked just fine but not with the L476VG.
2020-07-20 07:54 AM
UPDATE
Well, I have made some few changes to
Plateform.h : I have changed NVIC_DisableIRQ(EXTI0_IRQn); to NVIC_DisableIRQ(EXTI4_IRQn);
stm32l4xx_hal_msp.c : I have deleted all the pins' parameters in the HAL_MspInit() function
And now, it works everytime for phones on CE mode for DEMO.c but still not working for other tags and also for NDEF_DEMO.c
2020-07-20 09:27 AM
HI,
your stm32l4xx_hal_msp.c has been manually modified to set free pins to analog and to disable the various GPIO CLK. The following generated lines have disappeared from the HAL_MspInit:
__HAL_RCC_SYSCFG_CLK_ENABLE();
__HAL_RCC_PWR_CLK_ENABLE();
If you want to set default analog config for unused pin, this can be done thanks to STM32CubeMX Project manager tab, Code Generator options and tick "set all free pins as analog (to optimize the power consumption)'
I would suggest to regenerate your project from STM32CubeMX and not change the generated code and rely on STM32CubeMX for setting the unused pins as analog. In a first step, do not try to disable GPIO clocks or optimize power consumption.
If the hard fault still occur, it has to be debugged. See http://www.keil.com/support/docs/3782.htm on how to trap hard fault and install VectorCatch.INI from Keil (fill the request form). The execution will be halted when the fault occur and some of the debug register will give informations (see http://www.keil.com/support/man/docs/uv4/uv4_cp_m347_faults.htm)
Rgds
BT
2020-07-21 03:52 AM
Hi,
The hard fault does not occur anymore, I have fixed that by changing NVIC_DisableIRQ(EXTI0_IRQn); to NVIC_DisableIRQ(EXTI4_IRQn); in Platform.h because the IRQ pin is on C4
And the NFC actually works but only in CE (card emulation) mode for phones and only for DEMO and not for NDEF_DEMO
But the other modes are not working (ST25TB, P2P, ISO15693, ...), which means it behaves like a card and not a reader, which also means that when I approach a NFC Tag to my board it doesn't read it. So my question is, do you have any idea why is it only in CE mode and not as a reader ?
I have tried the solution you gave me, I have generated the project from CubeMX and I have let the gpio.c configuration and usart.c configuration and only deleted the spi.c configuration. But it's the same thing, only CE mode works and not the other modes.
2020-07-21 07:46 AM
Hi,
We have figured it out, it was a Hardware problem, and we fixed it and it's now working fine
Thank you for your time and your help
Best regards
2020-07-21 08:37 AM
Hi,
can you share some details about this HW issue?
Rgds
BT
2020-07-22 12:58 AM
Hi,
The antenna was not correctly powered, the VDD_DR wasn't connected with VDD_RF and that's why it only worked in CE mode and not reader mode.
Regards