This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NFC trigger hard fault

Hi,

I have a problem of crash device after trying to connect my device to the PC via NFC. 

The issue is very rare.

I think that the issue occurs because of an assert in the function nrf_drv_clock_hfclk_release - ASSERT(m_clock_cb.hfclk_requests > 0).

How can I solve that?

In addition - I noticed that the functions in that file can be called form an interrupt context - isn't that unsafe to enter critical regions from an interrupt context? Maybe that can also cause some errors.

Thanks!

Parents Reply
  • Not quite, the fix is the added if clause that checks if there is already a field on. The idea is to only release the clock if it has already been request earlier, avoiding decrementing the semaphore twice.  Workaround provided in the previous linked thread:

            case NRFX_NFC_FIELD_STATE_OFF:
                if (m_nfct_cb.field_on)     //This added if clause is the workaround
                {
                    nrfx_nfct_state_force(NRFX_NFCT_STATE_SENSING);
    #ifdef NRF52840_XXAA
                    /* Begin: Bugfix for FTPAN-116 (IC-12886) */
                    if (m_nrf52840.eng_a)
                    {
                        *(volatile uint32_t *)0x40005010 = 1;
                    }
                    /* END: Bugfix for FTPAN-116 (IC-12886) */
    #endif // NRF52840_XXAA
                    nrf_nfct_int_disable(NRFX_NFCT_RX_INT_MASK | NRFX_NFCT_TX_INT_MASK);
                    m_nfct_cb.field_on = false;
                    nfct_evt.evt_id    = NRFX_NFCT_EVT_FIELD_LOST;
        
                    NRFX_NFCT_CB_HANDLE(m_nfct_cb.config.cb, nfct_evt);
                }                       //The if statement ends here
                break;

Children
Related