NFC07a1 UID reading Difficulties


Hier ist die englische Übersetzung deines Textes:
---
Hello everyone,
I am quite new to the STM family. I am currently working on a project where I need to send data to and read data from an NFC tag using an NFC reader (NFC07A1). This data should then be sent via Bluetooth to another microcontroller and output there via USART.
I have already familiarized myself with data input and output via USART. However, I first tried to read the UID of a tag. A UID is always displayed without using a tag. It turned out that it is the UID of the NFC07A1 because I read the UID of the reader using an Android app (just mirrored). As soon as I use my phone as a tag and hold it to the reader, an error message appears. Any other tag I have tried is not even recognized. Only the phone, but it is not readable.
This is the code to read the UID:
```c
void MX_NFC7_ReadUID(void)
{
char uid_str[50]; // Buffer to hold the formatted UID string
// Check if the NFC reader is ready
if (NFC07A1_NFCTAG_IsDeviceReady(NFC07A1_NFCTAG_INSTANCE, 3) == NFCTAG_OK)
{
// Read the UID of the NFC tag
if (NFC07A1_NFCTAG_ReadUID(NFC07A1_NFCTAG_INSTANCE, &uid) == NFCTAG_OK)
{
HAL_Delay(100); // Small delay to ensure the tag is detected properly
// Format the UID into the string
sprintf(uid_str, "UID: %08lX %08lX\r\n", (unsigned long)uid.MsbUid, (unsigned long)uid.LsbUid);
HAL_UART_Transmit(&huart2, (uint8_t*)uid_str, strlen(uid_str), HAL_MAX_DELAY);
NFC07A1_LED_Off(BLUE_LED);
NFC07A1_LED_On(GREEN_LED);
}
else
{
sprintf(uid_str, "Error reading UID.\r\n");
HAL_UART_Transmit(&huart2, (uint8_t*)uid_str, strlen(uid_str), HAL_MAX_DELAY);
NFC07A1_LED_On(YELLOW_LED);
}
}
else
{
sprintf(uid_str, "NFC reader not ready.\r\n");
HAL_UART_Transmit(&huart2, (uint8_t*)uid_str, strlen(uid_str), HAL_MAX_DELAY);
NFC07A1_LED_On(YELLOW_LED);
}
}
```
Can someone please tell me where the error lies? I am totally at my wit's end.
Thank you very much.
Best regards,
- Tamti
