2025-09-18 7:35 AM
Hello,
I am running tha example code on RPi 5 on Ubuntu. Everything compiles fine but I get a Segmentation fault. I did configure the hwconfig.h
I added some debug messages to the code:
int main (void)
{
const ST25DV_PASSWD st25dv_i2c_password = {.MsbPasswd = 0, .LsbPasswd=0};
/* Init of the Type Tag 5 component (ST25DV-I2C) */
(BSP_NFCTAG_Init(0) != NFCTAG_OK);
printf("ST25DV-I2C init done\r\n");
printf("DEBUG1\n");
/* Present configuration password */
BSP_NFCTAG_PresentI2CPassword(0, st25dv_i2c_password );
printf("DEBUG1.5\n");
/* Set GPO Configuration */
BSP_NFCTAG_ConfigIT(0,ST25DV_GPO_ENABLE_MASK | ST25DV_GPO_FIELDCHANGE_MASK );
printf("DEBUG2\n");
while(ST25DV_GPO_Init() != NFCTAG_OK);
printf("GPO init done\r\n");
This is where it crashes:
./st25dv-i2c_gpo
ST25DV-I2C init done
DEBUG1
DEBUG1.5
Segmentation fault (core dumped)
Any help will be appreciated.
2025-09-18 9:20 AM
Hi,
Line 6 of the code snippet: the code does not check the return code of BSP_NFCTAG_Init(0). If the BSP_NFCTAG_Init(0) fails, some internal function pointers may be not initialized.
Make sure to test each return code in particular the return code of BSP_NFCTAG_Init.
Rgds
BT