2024-06-07 02:52 AM
Hello, I am trying to use STM32g071rb to control ST25DV16 chip. I found out that we can use middleware X-CUBE-NFC4 to code on stm32cubeIDE better. Question 1 is that when l tried to use I2C1 to connect with ST25DV16, l found out that I2C1 will no longer be automatically initialized in the code, and l wondered why. The second question is that after l configured X-CUBE-NFC4, why won't it initialize in the code as well and l can't initialize it myself because when it tries to do ST25DV_ReadReg() in ST25DV_Init(), the debugger will jump to HardFault_Handler(). The pictures below are my configurations. Thanks.
Solved! Go to Solution.
2024-06-10 08:30 AM
Hi Zhanghn,
With the custom configuration for the NFC4 package, all function declarations and definitions for NFC4 are defined in custom_* files (I²C in custom_bus.c, nfc04 bsp driver in custom_nfc04a1.c, ...).
To initialize the component and its bus, simply call CUSTOM_NFCTAG_Init function (located in custom_nfc04a1_nfctag.c), you can then use other functions from this file to read or write tag (or more).
BSP drivers allow you to configure and set the Hardware needed to communicate with the component (ST25DV for this example). This package is coded to work with the NFC04A1 expansion board, BSP drivers functions (dedicated to the NFC04A1) can be found in the nfc04a1*.c files. In your case you seem to need to develop your own BSP drivers as you are not using this board, so this package allows that by using custom drivers, which are ready to work (only needed hardware for ST25DV is configured) but are also ready to be adapted by the user.
The component drivers are coded to be hardware independent and need to call BSP drivers functions to work on any setup (of course this requires some work on BSP drivers side).
I hope this can help you in your development.
Kind Regards.
2024-06-10 08:30 AM
Hi Zhanghn,
With the custom configuration for the NFC4 package, all function declarations and definitions for NFC4 are defined in custom_* files (I²C in custom_bus.c, nfc04 bsp driver in custom_nfc04a1.c, ...).
To initialize the component and its bus, simply call CUSTOM_NFCTAG_Init function (located in custom_nfc04a1_nfctag.c), you can then use other functions from this file to read or write tag (or more).
BSP drivers allow you to configure and set the Hardware needed to communicate with the component (ST25DV for this example). This package is coded to work with the NFC04A1 expansion board, BSP drivers functions (dedicated to the NFC04A1) can be found in the nfc04a1*.c files. In your case you seem to need to develop your own BSP drivers as you are not using this board, so this package allows that by using custom drivers, which are ready to work (only needed hardware for ST25DV is configured) but are also ready to be adapted by the user.
The component drivers are coded to be hardware independent and need to call BSP drivers functions to work on any setup (of course this requires some work on BSP drivers side).
I hope this can help you in your development.
Kind Regards.