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

Arduino encryption nRF51822

Hi there!

I use RedBearLabs Nano (nRF51822) for at setup where I've developed BLE code in Arduino to communicate with apps on both iOS and Android.

Now I need to ensure the communication with encryption.

I've read these to threads for encrypting stuff with nRF51822:

devzone.nordicsemi.com/.../ devzone.nordicsemi.com/.../

I'm not sure how to use your C-based SDK from the Arduino environment - can you please enlighten me?

If this is not possible or advisable, can you please tell me which environment you'll recommend for OSX? I've looked at both mbed, CrossStudio for ARM and tried to use the stand alone GCC compiler (so far no luck - I seem to be missing the make files from the SDK 9 download). But no options is as easy to use as Arduino.

Or perhaps Bluetooth Developer Studio Beta is the way forward (and where do I get my hands on that)?

Looking forward to hearing your reply, hoping that you can tell me that using your SDK from Arduino is easy! :)

Best regards, Henrik, Denmark

Files in folder: /sdk9/examples/peripheral/blinky/pca10028/blank/armgcc: image description

hrs.hex

  • Hi Henrik,

    I'm not very familiar with the RedBearLab nRF51822 Library for Arduino and how you can have AES encryption with the library. However, I don't see any reason that board should not work with the nRF51 SDK provided by us.

    You can follow this guide.

    GCC is fully supported with our current SDK (from SDK v8.0) , make sure you have matched the GNU_INSTALL_ROOT in Makefile.windows at \components\toolchain\gcc with your GNU installation. You mentioned that you missed the makefile from the SDK, could you tell me more about that ? The makefile is at each example project folder in armgcc.

    Make sure you have downloaded the latest SDK from here.

  • If you want to encrypt all traffic, you may want to use Bluetooth Low Energy's "Bonding" mechanism. Typically bonded devices exchange encryption keys on their first connection (creating the "bond" between devices). Successive connections use these keys to encrypt traffic. It looks like there is support for Bonding from Red Bear Labs. You may just have to increase the security level on a single characteristic (via the requireSecurity() method with an argument like SECURITY_MODE_ENCRYPTION_NO_MITM). When you try to access that characteristic you will create a bonding request (your mobile device will probably pop up a dialog asking if you want to Pair with the device). Note that the bonding request only happens once unless you go into your mobile devices settings and erase it.

    The Bluetooth Developer Studio Beta may not be what you need (yet). It allows you to build services in a GUI and then export them to Nordic's C-based API (rather than doing all the details programmatically). You have to be a Bluetooth SIG member to get access, but it's available at the free level of membership. I think the Developer Studio will drastically improve the creation and documentation of new services. It will also improve development time (by avoiding simple programming errors). The last time I tried it, it just wasn't quite ready for regular use.

  • Thanks for your replies, I'll work a bit longer with it and revert.

    Until then:

    @hungbui, It's been a long while since I did any "real" C programming. I looked for the Makefiles in the example project folders themselves, but didn't see any. I'll try it once more, and revert!

    @bsiever, OK I'll forget Bluetooth Developer Studio for now. I tried once to include the nRF API in Arduino but with no luck. The code simply didn't compile. It'd be really helpful if someone had a sample project or step-by-step guide on how to use a C-based SDK like nRF51822 together with the Arduino tool - for newbies like me!?

    Best, Henrik

  • @Henrik: Next time please reply as comment under the answers, don't create separate answer, because "answer" should be used as the answer for the question you ask, not as the reply to others.

    Could you take a screenshot of an nRF51 SDK v9.0 example folder and update it to your question ? For example screenshot of this folder \examples\peripheral\blinky\pca10028\blank\armgcc ?

  • @hungbui - got it, updated the question with a screendump. I thought PCA10028 was a specific board, but that isn't so?

    I if somehow can build/use the SDK as a library with Arduino (www.arduino.cc/.../libraries) it'd be perfect! :)

Related