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

Parents
  • 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.

  • Hi @hungbui - my blinky_gcc_nrf51.ld file looks like this now:

    /* START */ SEARCH_DIR(.) GROUP(-lgcc -lc -lnosys)

    MEMORY { FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x40000 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x4000 }

    INCLUDE "gcc_nrf51_common.ld" /* END */

    1: I've changed the RAM size to 16KB, but I'm not sure if the Origin(s) are correctly set?

    2: Futhermore I'm not sure where to set the GPIO pin?

    3: Thirdly, the folder content from SDK 9 seem much different from the guide found here: redbearlab.com/nrf51822-sdk, perhaps the guide isn't at all usable with nRF SDK 9.x?

    I managed to build the HRS and merge it with s110_softdevice.hex using srec_cat tool. The resulting hrs.hex file results in a fail.txt containing "SWD ERROR". Nothing much to follow :-( The compiled hrs.hex is attached to my initial question.

Reply
  • Hi @hungbui - my blinky_gcc_nrf51.ld file looks like this now:

    /* START */ SEARCH_DIR(.) GROUP(-lgcc -lc -lnosys)

    MEMORY { FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x40000 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x4000 }

    INCLUDE "gcc_nrf51_common.ld" /* END */

    1: I've changed the RAM size to 16KB, but I'm not sure if the Origin(s) are correctly set?

    2: Futhermore I'm not sure where to set the GPIO pin?

    3: Thirdly, the folder content from SDK 9 seem much different from the guide found here: redbearlab.com/nrf51822-sdk, perhaps the guide isn't at all usable with nRF SDK 9.x?

    I managed to build the HRS and merge it with s110_softdevice.hex using srec_cat tool. The resulting hrs.hex file results in a fail.txt containing "SWD ERROR". Nothing much to follow :-( The compiled hrs.hex is attached to my initial question.

Children
No Data
Related