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

Trouble running Adafruit Tag Example on nRF52840 DK

I am trying to use PN532 on nRF52840. Nordic SDK has an example Adafruit Tag Example but it is for nRF52832. I have ported the example but it fails in TWI Communication.

What did I do ?

  • In makefile change every occurrence of pca10040 to pca10056
  • In makefile change every occurrence of nRF52832 to nRF52840
  • Copy sdk_config.h from TWI Scanner example to Adafruit Tag Example

Problems I am facing

LOG :

I am not able to detect PN532. More precisely TWI command fails to send. The error received is NRF_ERROR_DRV_TWI_ERR_DNACK.

Another strange thing is that on pressing reset nRF doesn't log again.

Parents
  • Hello, 

    Nordic SDK has an example Adafruit Tag Example but it is for nRF52832

    What Nordic SDK are you running? 

    Have you tried to use the TWI scanner app first, to verify that you are able to find PN532?

    Kind regards,
    Øyvind

  • I am using SDK 15.3.0.

    Yes, I first ran TWI Scanner and it detected PN532 at the correct address.

  • Have you compared the makefile, sdk_config.h and other relevant files to a PCA10056 project e.g. the TWI Scanner Application? Please ensure that the linker script is configured correctly (examples\nfc\adafruit_tag_reader\pca10040\blank\armgcc\adafruit_tag_reader_gcc_nrf52.ld). This configures the memory regions of the device. 

    The sdk_config file for the PN532 project includes several application-specific configurations, did you overwrite examples\nfc\adafruit_tag_reader\pca10040\blank\config\sdk_config.h with examples\peripheral\twi_scanner\pca10040\blank\config\sdk_config.h?

  • For makefile :

    I changed every instance of nRF52832 to nRF52840 and pca10040 to pca10056.

    For sdk_config.h : 

    I copied sdk_config.h from TWI Scanner for pca10056. There was some code defining parameters for PN532 I copied them from this sdk_config.h  examples\nfc\adafruit_tag_reader\pca10040\blank\config\sdk_config.h

    This is the file I used

    For linker file : 

    I used the linker file from examples\peripheral\twi_scanner\pca10056\blank\armgcc\twi_scanner_gcc_nrf52.ld

  • For makefile:

    Please change the following (- is remove, + is add):



    nrf52 is used for nrf52832, make sure to remove.

    For sdk_config.h

    Comparing the sdk_config.h from twi_scanner (PCA10056) and sdk_config.h from adafruit_tag_reader:

    Also there are several instances included in the adafruit_tag_reader sdk_config.h e.g. APP_SCHEDULER_ENABLED which is not included in PCA10056 sdk_config.h
    I am not sure how important, if important, this is for the application, but could be worth trying. 

    For linker file:

    Yes, this seems ok. 

Reply
  • For makefile:

    Please change the following (- is remove, + is add):



    nrf52 is used for nrf52832, make sure to remove.

    For sdk_config.h

    Comparing the sdk_config.h from twi_scanner (PCA10056) and sdk_config.h from adafruit_tag_reader:

    Also there are several instances included in the adafruit_tag_reader sdk_config.h e.g. APP_SCHEDULER_ENABLED which is not included in PCA10056 sdk_config.h
    I am not sure how important, if important, this is for the application, but could be worth trying. 

    For linker file:

    Yes, this seems ok. 

Children