After a forced five-day break for family-related stuff I’m back at it,

The Nordic web-site really is poorly organised.  It’s very hard to know where to begin, or how to solve problems.

Today I tried to get the s130 demo app running.  This demo app could be very helpful to us because it allows you to simultaneously be a controller, and a peripheral, which is fundamental for our app.

However, most demos are compiled for Keil uVision-5 but this demo has been generated under uVision-4.  Of course it doesn’t compile, and I had to install uVision-4 so I could figure out what needed to be changed to make it work.  It took all day to downgrade to ‘4’, and I ended up doing a re-install of the whole laptop because the registry got damaged.

Anyway, I manged eventually to install ‘4’, compile it and, <fanfare of trumpets> I managed to get it to output the appropriate diagnostics on the serial port.  At least it is saying that the things that I know can’t work, “are not working”, so that’s kind of progress.

Sadly the program cannot be downloaded in the usual way directly from the IDE.  You have to use a different manual flashing tool, which is awkward.  Worse you can’t debug it with breakpoints and all that stuff.  It’s another bloody mess.

I need to get a bunch more parts of the demo working before I can start to understand if it really works, but at least it was a baby step in the right direction.

On 2 Oct 2014 22:47, “David Carkeek” <dcarkeek@gmail.com> wrote:

“…and I ended up doing a re-install of the whole laptop because the registry got damaged.”

Say it isn’t so. Is it what it sounds like? Did you at least have an image to start from?

By the way, is the T410 working out OK? I hope I didn’t steer you down the wrong path. If you have second thoughts You can get an i7 T420 for about $300.

From the Nordic website: “The S130 is Nordic’s most advanced feature-rich SoftDevice for Bluetooth® Smart (previously called Bluetooth low energy) to date.” If it’s the most advanced why wouldn’t it use uVision-5? 
I didn’t know that Keil is owned by ARM.
It sucks that you’re having to go through this. My fear is that it will happen all over again when we make new hardware.
Oh yes I had an image to roll back to.  Not as bad as I implied.  Sorry.
The T410 is fine so far.  It was a good steer.  Not done enough to stress it really.  The SSD makes so much difference, the rest is in the noise.
I will drag s310 over to uVision5 when I have exhumed the config details from the uV4 project.  It’s not like they are easy to guess.
When I move to new hardware I will have to figure out a new hardware profile, but I expect one of the devkit profiles will be close.
I guess my frustration is how hard it is to find a self-consistent set of examples.  Even now,  the s130 demo doesn’t talk to it’s peer demo device, the heart-rate monitor demo.  The HRM demo talks to my phone just fine, but clearly the two are inconsistent in some unspecified way.  
I have to keep telling myself that each one of these hurdles surmounted, is between us and the folks who may be chasing us.
//Mik (mobile)

————-
I sent a query about the flashing to Nordic:

In the README file packed with s130 demo example your say:
“This SoftDevice release has internal changes that requires that the SoftDeviceis 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.
If you have these updated tools, programming can be done as usual. If these tools are not available, a separate programming tool will be distributed with the release.”
Is this still the case or are there some magic parameters that I can set in uVision-4 that make it possible to flash directly out of the IDE?
Currently I’m getting the garbage in attached file.

Load “C:\Nordic Semiconductor\nRF51 SDK_v6.1.0.0\Nordic\nrf51822\hex\Example\s130_demo_app\build\S130_demo.axf”

Set JLink Project File to “C:Nordic SemiconductornRF51 SDK_v6.1.0.0Nordicnrf51822hexExamples130_demo_appJLinkSettings.ini”
* JLink Info: Device “NRF51822_XXAA” selected (257 KB flash, 16 KB RAM).

JLink info:
————
DLL: V4.92 , compiled Sep 30 2014 09:33:42
Firmware: J-Link OB-SAM3U128 V1 compiled Aug 22 2014 17:25:44
Hardware: V1.00
S/N : 480209391

* JLink Info: Found SWD-DP with ID 0x0BB11477
* JLink Info: Found Cortex-M0 r0p0, Little endian.
* JLink Info: FPUnit: 4 code (BP) slots and 0 literal slots
ROMTableAddr = 0xE00FF003

Target info:
————
Device: nRF51822_xxAA
VTarget = 3.300V
State of Pins:

TCK: 0, TDI: 0, TDO: 1, TMS: 1, TRES: 1, TRST: 1
Hardware-Breakpoints: 4
Software-Breakpoints: 8192
Watchpoints: 2
JTAG speed: 2000 kHz

Include “C:\Nordic Semiconductor\nRF51 SDK_v6.1.0.0\Nordic\nrf51822\hex\Example\s130_demo_app\s130_demo_loader.ini”

LOAD %L INCREMENTAL
SET SRC=.\src
RESET
Insufficient RAM for Flash Algorithms !
Erase Failed!
Error: Flash Download failed – “Cortex-M0”

Hi Michael, 
The newer J-link drivers requires more ram for the flash algorithm which is unfortunately not increased automatically, hence the error in your log file.  Please see attached screen shot of the correct flash configuration. This should let you flash directly from the IDE.
Best regards,
Vidar Berg
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)