These days the press is full of articles with rumors about NFC in the new Samsung phone as well as the upcoming Apple products. I actually was missing detailed reviews of the Nexus S but also the claimed NFC functionality of the Nokia C7. So colleague of mine —Christian Kantner — and I, we spent some time on playing around with the phones and built a firmware for the Nexus S, that fully supports all NFC features, such as SWP.
Let’s start off with the Nokia phone. We took the phone apart (see the pictures) to figure out, which chipset they use. The Nokia C7 comes with a PN544 from NXP. The device is ready for Single Wire Protocol support in order to use the UICC as the secure element.
In order to enable this functionality, Nokia only needs to provide a firmware that comes with the according software stack. In this case, Nokia will use NXP’s FRI (Forum Reference Implementation), which is also used in the Google phone. Nokia has to provide the JSR257 (Java layer) in order to manage the reading/writing functionality of tags as well as the peer-2-peer mode. Depending on the configuration of the FRI, the phone can support SWP (= card emulation using a UICC). The C7 already provides JSR177 for J2ME applications to communicate with the UICC. So hopefully we will see a Nokia firmware update on the device soon.
So the Nokia looks fine, but what we found out about the Nexus S is even better. The Nexus S comes with a PN65N from NXP. This chip is a combination of the PN544 and an embedded secure element (actually it’s a SmartMX).
You can see this on the picture in the Tear-Down of iFixit.com (=> Step 7, most right picture) very well. So the phone comes with everything we do need for card emulation – SWP and even a secure element within the phone.
But what about the software? Now, the good thing about Android is that everything is open source. This is also true for NXP’s FRI, which is a library in the GIT-Repository of Android. There you can follow the implementation of the NFC Stack and how it is glued into the operating system. When browsing the source code you can see that the flags for the internal secure element as well as SWP are disabled. The same is true for some very interesting APIs such as “mNfcAdapter.getSecureElementList()” in the Java Layer.
DIY-NFC Phone using the Nexus S
What did we do next: download the source (actually cyanogen mod 7), make the appropriate changes to the code, recompile everything and put it back into the phone and – tatata – it works: Nexus S supports card emulation with SWP. This took about some evenings/weeksends to understand how to setup the build environment and build the firmware.
We are now able to control the PN65N from an Android-App, very nice – but not enough. We need more, actually an API for accessing the UICC (secure element) – from an Android API. Luckily G&D already supports the development of a smartcard stack on Android (SEEK – Secure Element Evaluation Kit). This one is available for Android 2.2 and requires some adaption in Gingerbread to fit. After these changes we can have a fully featured NFC phone using the Nexus S Hardware. Nice isn’t it?
G^2 = G&D and Google
Now here is something interesting as well. When Android switched from 2.3.1 to 2.3.2, Google made some changes in the telephony API, which are required by G&D’s smartcard stack. The telephony API is used to send the APDUs through the RIL (Radio Interface Layer) to the UICC. (Actually Android 2.3.3 is not yet available on GIT, therefore we could not check what additionally changes there are). Out of these changes we assume, that Google is planning to integrate G&D’s smartcard stack in one of the upcoming version (2.4 or so).
We are happy to give a live demo of the device next week at the MWC 2011 in Barcelona.