Environment:
Pi Systems: Raspberry Pi 3 Model B (revision a22082) and Raspberry Pi Model B Rev 2 (revision 000e)
NXP Explorer Board (element14) Explore-NFC Rev 1.6
I am trying to build from source for both reference and I have a proof of concept project (part of a much larger project)
and need to develop some custom handling.
According to the current links (as of time of posting) from NXP website, I need the following archive files:
SW282816.zip
SW3639.zip
I am familiar with C and both read and code in it, but these are dusty skills, although in the past I have succeeded at
developing device drivers. Just to level set abilities. I am these days a Java Enterprise developer. My POC goal is to
build a Tomcat webapp that will on demand prepare the reader to receive information from an Android Kitkat+ device via
NFC. A step along the way will be do build out a Java JNI wrapper around access to the NXP board. The explorer examples
will act as a reference to determine what is needed in this JNI wrapper.
I don't see an archive for a compatible version of neardal - hence I fetched 0.14-3.tar.gz from github AppNearMe archives.
The resulting package builds without error. I am unsure if this code is compatible or not, which adds to my confusion. My understanding
is that this is the component that will interface with dbus. I see that the installation implants /etc/dbus-1/system.d/org.neard. This configuration
file is slightly different than the one which is installed using the .deb files out of SW2827.zip. 2827 installs
Following the instructions in document AN11802.pdf, I have attempted to build what is needed from source. There are some issues
I am having difficulty resolving.
1) SW3639 is the NxpNfcRdLib. I encounter compile errors in NfcrdlibEx5_ISO15693 as follows:
[ 87%] Building C object NfcrdlibEx5_ISO15693/CMakeFiles/NfcrdlibEx5_ISO15693.dir/NfcrdlibEx5_ISO15693.c.o
/Volumes/workvol/workspaces/raspbian/work/NxpNfcRdLib-201708221632/NfcrdlibEx5_ISO15693/NfcrdlibEx5_ISO15693.c: In function ‘NfcrdlibEx5_ISO15693’:
/Volumes/workvol/workspaces/raspbian/work/NxpNfcRdLib-201708221632/NfcrdlibEx5_ISO15693/NfcrdlibEx5_ISO15693.c:209:43: error: ‘phacDiscLoop_Sw_DataParams_t’ has no member named ‘sTypeVTargetInfo’
phApp_Print_Buff(sDiscLoop.sTypeVTargetInfo.aTypeV[0].aUid, 0x08);
^
/Volumes/workvol/workspaces/raspbian/work/NxpNfcRdLib-201708221632/NfcrdlibEx5_ISO15693/NfcrdlibEx5_ISO15693.c:212:47: error: ‘phacDiscLoop_Sw_DataParams_t’ has no member named ‘sTypeVTargetInfo’
memcpy(aReceivedUid, sDiscLoop.sTypeVTargetInfo.aTypeV[0].aUid, 0x08);
^
/Volumes/workvol/workspaces/raspbian/work/NxpNfcRdLib-201708221632/NfcrdlibEx5_ISO15693/NfcrdlibEx5_ISO15693.c:215:50: error: ‘phacDiscLoop_Sw_DataParams_t’ has no member named ‘sTypeVTargetInfo’
if (DisplayCardTypeInfo(sDiscLoop.sTypeVTargetInfo.aTypeV[0].aUid) == PH_ERR_SUCCESS)
^
/Volumes/workvol/workspaces/raspbian/work/NxpNfcRdLib-201708221632/NfcrdlibEx5_ISO15693/NfcrdlibEx5_ISO15693.c:226:62: error: ‘salI15693’ undeclared (first use in this function)
status = phalI15693_ReadSingleBlock(&salI15693,
^
/Volumes/workvol/workspaces/raspbian/work/NxpNfcRdLib-201708221632/NfcrdlibEx5_ISO15693/NfcrdlibEx5_ISO15693.c:226:62: note: each undeclared identifier is reported only once for each function it appears in
/Volumes/workvol/workspaces/raspbian/work/NxpNfcRdLib-201708221632/NfcrdlibEx5_ISO15693/NfcrdlibEx5_ISO15693.c:227:29: error: ‘PHAL_I15693_OPTION_OFF’ undeclared (first use in this function)
PHAL_I15693_OPTION_OFF,
^
/Volumes/workvol/workspaces/raspbian/work/NxpNfcRdLib-201708221632/NfcrdlibEx5_ISO15693/NfcrdlibEx5_ISO15693.c:286:26: error: ‘PHPAL_SLI15693_FLAG_NBSLOTS’ undeclared (first use in this function)
(PHPAL_SLI15693_FLAG_NBSLOTS | PHPAL_SLI15693_FLAG_DATA_RATE | PHPAL_SLI15693_FLAG_INVENTORY),
^
/Volumes/workvol/workspaces/raspbian/work/NxpNfcRdLib-201708221632/NfcrdlibEx5_ISO15693/NfcrdlibEx5_ISO15693.c:286:56: error: ‘PHPAL_SLI15693_FLAG_DATA_RATE’ undeclared (first use in this function)
(PHPAL_SLI15693_FLAG_NBSLOTS | PHPAL_SLI15693_FLAG_DATA_RATE | PHPAL_SLI15693_FLAG_INVENTORY),
^
/Volumes/workvol/workspaces/raspbian/work/NxpNfcRdLib-201708221632/NfcrdlibEx5_ISO15693/NfcrdlibEx5_ISO15693.c:286:88: error: ‘PHPAL_SLI15693_FLAG_INVENTORY’ undeclared (first use in this function)
(PHPAL_SLI15693_FLAG_NBSLOTS | PHPAL_SLI15693_FLAG_DATA_RATE | PHPAL_SLI15693_FLAG_INVENTORY),
^
All other code out of this project builds correctly. There is a resulting NxpNfcRdLib.a built without error, as well as the other examples.
2) SW282816 will not complete the cmake step. The CMakeFiles.txt at project top references an external project to build the NxpNfcRdLib. The cmake terminates when
it discovers the needed external project (which defaults to a subfolder of the project) is empty. I would rather not monkey around with the cmake file as my working style
is to build shell scripts that will idempotently build the artifacts needed - and sed'ing the CMakeFiles is not a fun coding exercise (but I will do it if I have to).
The relevant results of the cmake are:
CMake Error at /usr/share/cmake-3.6/Modules/ExternalProject.cmake:1924 (message):
No download info given for 'NXPRDLIBLINUX' and its source directory:
/Volumes/workvol/workspaces/raspbian/work/NxpNfcRdLib-201708221632/nxprdlib-linux
is not an existing non-empty directory. Please specify one of:
* SOURCE_DIR with an existing non-empty directory
* URL
* GIT_REPOSITORY
* HG_REPOSITORY
* CVS_REPOSITORY and CVS_MODULE
* SVN_REVISION
* DOWNLOAD_COMMAND
Call Stack (most recent call first):
/usr/share/cmake-3.6/Modules/ExternalProject.cmake:2473 (_ep_add_download_command)
CMakeLists.txt:13 (ExternalProject_Add)
-- Checking for module 'glib-2.0>=2.40'
-- Found glib-2.0, version 2.42.1
-- Checking for module 'gthread-2.0>=2.40'
-- Found gthread-2.0, version 2.42.1
-- Checking for module 'gio-2.0>=2.40'
-- Found gio-2.0, version 2.42.1
-- Checking for module 'gio-unix-2.0>=2.40'
-- Found gio-unix-2.0, version 2.42.1
-- Checking for module 'neardal'
-- Found neardal, version 0.14.0
-- Configuring incomplete, errors occurred!
See also "/Volumes/workvolworkspaces/raspbian/work/NFCExplorer-201708231321/neard-explorenfc-1.2/build/CMakeFiles/CMakeOutput.log".
makefile was not created - there was a cmake failure
3) Attempting to run neardal demo - I see 'no adapter found'
I have been sure to enable SPI on both Pi platforms, and lsmod shows:
Module Size Used by
evdev 12423 2
joydev 9988 0
hidp 15368 1
md4 3862 0
md5 2608 1
hmac 3252 1
bnep 12051 2
hci_uart 19956 1
btbcm 7916 1 hci_uart
bluetooth 365511 27 hidp,hci_uart,bnep,btbcm
nls_utf8 1656 1
cifs 421953 2
brcmfmac 222874 0
brcmutil 9092 1 brcmfmac
cfg80211 543027 1 brcmfmac
rfkill 20851 4 bluetooth,cfg80211
snd_bcm2835 24427 1
snd_pcm 98501 1 snd_bcm2835
snd_timer 23904 1 snd_pcm
spidev 7373 0
snd 70032 5 snd_timer,snd_bcm2835,snd_pcm
i2c_bcm2835 7167 0
bcm2835_gpiomem 3940 0
spi_bcm2835 7596 0
uio_pdrv_genirq 3923 0
fixed 3285 0
uio 10204 1 uio_pdrv_genirq
i2c_dev 6913 0
fuse 99603 3
ipv6 406751 58
Output from ./demo:
pi@pi3:/Volumes/workvol/workspaces/raspbian/work/NeardAl-201708230924/neardal-0.14-3/demo$ ./demo
neardal_mgr_prv_get_all_adapters(): Error: 2:GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.neard was not provided by any .service files
In another terminal window, monitoring dbus, I see the following when I attempt to run the neardal demo:
pi@pi3:~$ dbus-monitor --system
signal sender=org.freedesktop.DBus -> dest=:1.28 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.28"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=42 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
string ":1.29"
string ""
string ":1.29"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=43 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
string ":1.29"
string ":1.29"
string ""
The dbus configuration file (which I did install using the .deb package) is as follows:
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="org.neard"/>
<allow send_destination="org.neard"/>
<allow send_interface="org.neard.NDEFAgent"/>
<allow send_interface="org.neard.PHDC.Manager"/>
<allow send_interface="org.neard.PHDC.Agent"/>
<allow send_interface="org.neard.HandoverAgent"/>
</policy>
<policy at_console="true">
<allow send_destination="org.neard"/>
</policy>
<policy context="default">
<allow send_destination="org.neard"/>
</policy>
</busconfig>