I managed to make a dumb C# program that found the BLE dongles,  Didn’t actually do anything with them, but that would be a good next step.

I also started to mull over all the code fragments that are lying around to see if I could find a single program for which there is both server and client code.  Ao far the only example I have found is on GitHub.  The programs on Nordic all seem a bit broken, or have the other half missing.

I found the S130 softmachine and started reading about it.  It purports to handle both server and client traffic at the same time.

I also made my first server (central) program using the s120 softmachine but it won’t load directly from the Keil IDE.  I tried loading it from nRFGo and it loads, but doesn’t seem to run. Then I tripped over this little note buried deep inside a zip file.

This SoftDevice release has internal changes that requires that the SoftDevice
is programmed onto the chip in a specific way.  The following Nordic tools
handle this:
– nrfjprog version 5.0.1 or higher
– nRFgo Studio version 1.17.0 or higher.  

 So maybe the tools for loading s120 and s130 code from the IDE need upgrading.

For the last two days I have been assembling my new laptop, a rather old T410.  With the SSD drive inside it is reasonably quick, not as fast as the duff IdeaPad, but tolerable.

I have Windows-7 installed, and all the program development stuff, and I managed to compile a standard chunk of Nordic code and get it to run, so I think I am almost back to square one now.

So I’m now back to my twin goals:

  1. Figure out why my own program doesn’t work.
  2. Make windows speak BLE to Nordic.

Yay!  A little success on task 2.  I managed to make Windows discover my FitBit.  I think the issue may have been baud-rate after all.  The dongle seems to be driven at 1Mbaud!

    I’ve installed a sniffer and checked to see if I can get any traffic out of the Nordic EVK board.  The sniffer actually uses the new dongle, and I can see packets coming from StickNFinds, FitBit and so forth, so at least that’s working.

    I have loaded the very simplest example programs that advertise into the EVKs and they either hang-up when talking to the softmachine for the first time, or do nothing (hang up, but I don’t know where or why).

    Communications with Nordic have been pretty unhelpful.  Their attitude is that the stuff works out the box, and that it must be something to do with my setup.  Well we know that my laptop is flakey, so perhaps some chunk of software has got mis-installed.  That seems very unlikely, but until I go through the motions, and set up a new platform, it’s a bit hard to argue anything else.

    So the $140 diskless T410 arrived from ebay today.  I unpacked it and stuffed in the disk David lent me.  It fired up just fine, though it is complaining that the license is about to expire.  I copied all the software I have created onto a 128G USB stick, so I ought not to loose anything.

    As a last ditch effort I installed their heart monitor simulator program on the EVK, and it works, so at least I know that it has to be some software issue.

    Tomorrow…

    This example is much spoken of but turns out to be a bugger to find.  It is not kept with the rest of Nordic’s example software but on github at https://github.com/NordicSemiconductor/nrf51-ble-app-lbs .

    It’s quite involved to get this app compiled, and it is described in “Creating Bluetooth Low Energy Applications Using nRF51822  aka nAN-36.

    The software is tested using the Master Control Panel.  The MCP talks to a dongle that has to be pre-loaded with an emulator called the  MEFW (Master Emulator Firmware?).  The firmware is loaded using the MCP itself.  All of these components are obtained here.

    Once the MCP package is downloaded and installed the MEFW is loaded like this:

    This has proved to be an embarrassingly big challenge.  It ought to be easy, but it’s taken me days.  I still can’t get the PCA10001 V2.2 to talk to the PC serial, but at least I have managed it for the PAC10000 V2.2.

    I needed to buy a UART to USB adaptor.  It’s actually a Silicon Labs CP2102.  I got the drivers for W8 from here.

    Silicon Labs CP2102 UART to USB connector
    The connections between the Nordic board and the CP2102 look like this.


    CP2102 Nordic
    DTR    P10 CTS
    RXI    P9  TX
    TXO    P11 RX
    VCC    any VCC e.g. P7
    CTS    P8 RTS
    GND    and GND e.g. P6

    At the Nordic end it is configured as 115200 8N1 CTS/RTS=on

    At the PC end like this

    I’ve struggled all day to read all the information about the PC test application.  This app, called “advertise” runs on the PC, and talk to the Nordic dongle over the serial line.

    My understanding is that Nordic have made a Windows library that is a stub for the soft-machine.  It accepts calls from a PC BLE-speaking application, and translates them into commands that it sends down the serial (USB) line to the dongle.  A corresponding stub in the dongle unpacks the serial commands and calls the appropriate procedure in the soft-machine.  I assume the return values are sent back to the PC using a similar mechanism.  I think it looks like this.

    In principal this is a pretty neat bit of software that let’s you develop new ideas on the PC where it’s easy to bang out code, and then migrate key bits over to the Nordic when they are working.

    My problem

    Yesterday I slogged away trying to get the serial comms to work, and partially succeeded by recompiling code for the V1.0 dongle, which was the only kind of dongle I thought I had.  Today I discovered by accident that the replacement kit I got from Nordic, while in the UK, actually has a V2.2 dongle so everything ought to work just peachy.

    I have burned the dongle with:

    • …/nrf51-ble-driver_win_0.2.0-alpha/nrf51-ble-driver_win_0.2.0-alpha/hex/connectivity_devdongle_115k2.hex
    • …/s110_nrf51822_6.0.0/s110_nrf51822_6.0.0_softdevice.hex 

    I have also tried the 7.0.0 release!

    I have successfully compiled the advertising program, and made sure that:

    1. It is talking to the right com port, in my case COM8
    2. It is successfully launching the dynamic link library.

    But alas no.  I appear to be able to get in touch with the dongle, but at the first attempt to do something it hangs.  So I don’t know if this is really a comms problem, or some configuration issue with the dongle.

    I have debugged the program, and for double measure, added some print statements, and run it from the command line to make sure nobody is getting their fingers in the way.

         sd_rpc_serial_port_name_set(UART_PORT_NAME);    //error_code = sd_rpc_serial_baud_rate_set(57600);    printf(“Using %sn”, UART_PORT_NAME);
        sd_rpc_log_handler_set(log_handler);    printf(“Log handler setn”);
        sd_rpc_evt_handler_set(ble_evt_dispatch);    printf(“Event handler setn”);
        error_code = sd_rpc_open();    printf(“Serial port open (%d)n”, error_code);
        if (error_code != NRF_SUCCESS)    {        printf(“Failed to open the nRF51 ble driver”);        return error_code;    }
        memset(&ble_enable_params, 0, sizeof(ble_enable_params));
        printf(“Enable the bluetooth stackn”);    error_code = sd_ble_enable(&ble_enable_params);
        if (error_code != NRF_SUCCESS)    {        return error_code;    }    printf(“Enabledn”);

    What I get is this:

    Searching the developer zone is not revealing anything helpful. Maybe I am asking the wrong questions?

    Exhausted.

    Background

    Adam was kind enough to give me a Samsung Gear watch her had been given.  He is an Appler and so he couldn’t link it to his phone.
    After about 30 minutes of googling I found the spells to connect it to a non-Samsung device.  A little involved but fairly straightforward providing you know what you are doing.  Not for the average bear.
    I installed some extra apps, but it took me a while to realize that they actually run on the phone, and have some kind of remote UI facility on the watch.  It begs lots of questions.

    Bright screen

    The screen is certainly bright.  So bright in fact that I was challenged to photograph it.

    And as a watch…

    It took me ages to get the clock to work to my satisfaction. You have to act like a spastic to get the watch to appear.  You have to drop your arm to your side, and then raise your wrist into the watch-reading position.

    Email and phone call notifications

    I still have not managed to turn on notifications for phone calls or email.

    UI in general

    The UI is dreadful, on both the watch and the phone.  The whole user interface seems to be designed for text that reads top-to-bottom instead of left-to-right.  Try positioning your arm so that your wrist is in front of you, and vertical.

    Calculator App

    There is a calculator app, but it won’t work away from the phone.  The buttons are so small that you can’t press them without having points whittled onto your fingers.

    Even then it was pretty annoying because it took such a long time to load… by which time the display had shut off, and I had to start over.

    Half way there…
    and…  Aw.  Try again

    Calendar App

    The calendar app (more understandable if it showed your calendar, but actually it only displays a vanilla blank calendar)

    Find me App

    There is an app that make your phone bleep, in case you have lost it.  That seems to work OK over a limited range.

    Pedometer App

    The pedometer did actually count 47 of my 48 steps.  It seems to switch off at the leastt sign of inactivity – presumably to save power.

    HRM

    The heart-rate monitor had some problems.

    Summary

    Nice try… but no banana Judy

    I’ll have to lend you the Samsung Gear to play with.  It has a couple of interesting features, but basically they have managed to snatch failure from the jaws of victory in so many way.

    What positive can I say other than the ID seems pretty good, except for the recharging apparatus which is cumbersome.  You wouldn’t be able to do it in the dark – especially with arthritic fingers, or poor eyesight.  The whole thing isn’t actually ugly, thought the strap is cheap and nasty.

    After an hour of futzing with it the battery had gone down to 88% which seems to suggest that if you don’t use it much it will probably run all day, doing things you don’t care about.

    Adam got given Samsung watch. He is Appler so gave to me.  Not sure can make work sans Samsung ph, but still usefull.  Nice bright display turns on when wrist rotates so watch facing up. Kinda cool design.

    Charging cumbersome.  Battery better last for week's!  So clear to me that unless we offer humongous battery advantage, so we have very infrequent charging, not having display will be issue. 

    Have fitbit and watch on same wrist.  Geeky but ok.  Perhaps TS could be never-unworn "watch companion", if very narrow, or ring, and use BLE to access watch display.

    //Mik (mobile)

    https://devzone.nordicsemi.com/question/701/pca10000-tx/

    I just got stung by this too.
    Turns out I have an earlier version of the PCA10000 board. Check your board to see if you have V1.0 like I do. If so, this fix is easy… once you know anyway.
    Go to Includes/boards/pca10000.h. There is an #if /#else construct for selecting between board versions. Change to #if 0 for V1.0 and away you go.

    So I made a new version of  pca10000.h changing the one critical character from a ‘1’  to a ‘0’!