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

NFC code not working

Hi,

I'm trying to get NFC working on a PCA10040 dev board. Using the nfc/record_url hex file it works fine, so the hardware is obviously ok.

However, when I use the exact same code as in the record_url example from my software, it doesn't do anything. All functions execute without errors, but then log_uart_printf gets called with:

[NFC_HAL]: initialize
[NFC_HAL]: start
// ------------- put NFC device near 
[NFC_HAL]: fielddetected
[NFC_HAL]: reinitialize
[NFC_HAL]: fielddetected
[NFC_HAL]: fielddetected
[NFC_HAL]: reinitialize
[NFC_HAL]: fielddetected
[NFC_HAL]: reinitialize
[NFC_HAL]: fielddetected
[NFC_HAL]: reinitialize
[NFC_HAL]: fielddetected
[NFC_HAL]: fielddetected
[NFC_HAL]: fielddetected
[NFC_HAL]: fielddetected
[NFC_HAL]: reinitialize
[NFC_HAL]: fielddetected
[NFC_HAL]: reinitialize

Also, will the NFC code ever be distributed as something that's not a binary blob? I'm using a language interpreter (Espruino), and it expects functions to be compiled without hardware floating point (the call style is different). Currently the only way I can use NFC is to recompile with VFP, which means I'm then unable to pass floating point values into any functions!

Parents Reply
  • I changed the function to:

    static inline void nrf_nfct_field_event_handler(volatile nfct_field_sense_state_t field_state)
    {
        if (!m_field_on)
        {
            HAL_NFC_DEBUG_PIN_SET(HCLOCK_ON_PIN);  //DEBUG!
            
            bool was_running = nrf_drv_clock_hfclk_is_running();
            
            nrf_drv_clock_hfclk_request(&m_clock_handler_item);
            
    
            NRF_TIMER4->TASKS_CLEAR = 1;
            NRF_TIMER4->TASKS_START = 1;
            field_state_cnt = 0;
            
            if (was_running) nrf_nfct_clock_event_handler(NRF_DRV_CLOCK_EVT_HFCLK_STARTED);
    
            HAL_NFC_DEBUG_PIN_CLEAR(HCLOCK_ON_PIN);  //DEBUG!
        }
        m_field_on = true;
    }
    

    It works fine... Does that seem like a hack, or is it fine?

Children
No Data
Related