I am using the nfc_writable_ndef_msg example in the SDK to write from my phone to the board using NFC. I get it working successfully however, I am also trying to add code to parse the NDEF data and print it out. However, when I run the code I have written, the COM port terminal just says NDEF Message updated and does not printout the message I have updated. Below is the function I have created and how I used it contextually within the main. The code is all the same from nfc_writable_ndef_msg except for the one function below and it's usage in main.
//NDEF READ AND PRINTOUT FUNCTION
void ndef_data_analyze(uint8_t * p_ndef_msg_buff, uint32_t nfc_data_len)
{
ret_code_t err_code;
uint8_t desc_buf[NDEF_FILE_SIZE];
uint32_t desc_buf_len = sizeof(desc_buf);
err_code = ndef_msg_parser(desc_buf,
&desc_buf_len,
p_ndef_msg_buff,
&nfc_data_len);
if (err_code != NRF_SUCCESS)
{
NRF_LOG_INFO("Error during parsing a NDEF message.");
}
ndef_msg_printout((nfc_ndef_msg_desc_t*) desc_buf);
}
//Main
int main(void)
{
ret_code_t err_code;
log_init();
/* Configure LED-pins as outputs */
bsp_board_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS);
/* Initialize App Scheduler. */
APP_SCHED_INIT(APP_SCHED_MAX_EVENT_SIZE, APP_SCHED_QUEUE_SIZE);
/* Initialize FDS. */
err_code = ndef_file_setup();
APP_ERROR_CHECK(err_code);
/* Load NDEF message from the flash file. */
err_code = ndef_file_load(m_ndef_msg_buf, sizeof(m_ndef_msg_buf));
APP_ERROR_CHECK(err_code);
// Restore default NDEF message.
if (bsp_board_button_state_get(APP_DEFAULT_BTN))
{
uint32_t size = sizeof(m_ndef_msg_buf);
err_code = ndef_file_default_message(m_ndef_msg_buf, &size);
APP_ERROR_CHECK(err_code);
err_code = ndef_file_update(m_ndef_msg_buf, NDEF_FILE_SIZE);
APP_ERROR_CHECK(err_code);
NRF_LOG_DEBUG("Default NDEF message restored!");
}
/* Set up NFC */
err_code = nfc_t4t_setup(nfc_callback, NULL);
APP_ERROR_CHECK(err_code);
/* Run Read-Write mode for Type 4 Tag platform */
err_code = nfc_t4t_ndef_rwpayload_set(m_ndef_msg_buf, sizeof(m_ndef_msg_buf));
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO("Writable NDEF message example started.");
/* Start sensing NFC field */
err_code = nfc_t4t_emulation_start();
APP_ERROR_CHECK(err_code);
//NDEF DATA ANALYZE
ndef_data_analyze(m_ndef_msg_buf, m_ndef_msg_len);
while (1)
{
app_sched_execute();
NRF_LOG_FLUSH();
__WFE();
}
}
When I run this code and update the NDEF message I get the following. I see that it is updated yet there is no printout of what I have written to the NDEF from my phone.

I am not sure why it wont printout the message I have sent over NFC.
