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

Adapting ble_app_blinky_c to work with nRF52840 Dongle

Using this \nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\ble_app_blinky and nRF5_SDK_17.0.2_d674dde\examples\ble_central\ble_app_blinky_c

As described in \examples\ble_central\ble_app_blinky_c 

I am using win 10, VS Code and a Dongle!!!

The \examples\ble_peripheral\ble_app_blinky works fine and I can use the Android app BlinkyTest to flash the dongle (using nrfutil, not nrfjprog) to test it and it works ok, so I assume I have a working toolchain.

Basically I want to make one dongle (the server, aka ble_app_blinky) turn the light on and off on the other dongle (the client akak ble_app_blinky_c)  (and for the server to recognise that a button was pressed on the client dongle). At least that is how I read the documentation says it should work.

I realise that I will have to make adjustments to at least main.c to re-assign the leds and buttons, but first I need to get the thing to build.

Because you don't have a dongle version of the examples\ble_central\ble_app_blinky_c I am trying to adapt it to work with the dongle pca10059. To do this I have copied over the code from the pca10056 folder. I have adjusted the Makefile and c_cpp_properties.json which tells the compiler where to look for the include files. (I am a bit of a noob with C, but I'm getting there).

So my first problem is that I am getting problems with intellisense telling me that in main.c


90  NRF_BLE_SCAN_DEF(m_scan);
and some other stuff isn't defined.        
So if I go to the definition I locate nrf_ble_scan.h   I have referenced this in my include files
However, at about line 137 I am getting a strange error where it is saying it doesn't like a "const"!!!
typedef struct
{
    ble_gap_scan_params_t const * p_scan_param;    
And at this point I'm stuck.
I'm assuming that ble_gap_scan_params_t
 is defined somewhere, but the IDE is telling me that it is defined in 17 out of 20 files. I'm thinking I'm on a lost trail here.
Any ideas please.
By the way any thoughts on what else I might need to look at (like removing any Segger stuff) that I should consider?
Of course the ideal solution for me would be for Nordic to provide an actual version for the dongle!!!!! I mean, you sell it after all Slight smile
Thanks
Gordon.

Parents
  • So I went and checked the ble_blinky app that is set up for the dongle and now I see that there were problems with that code in main.c as well that I'd never noticed. So there must be something wrong with my VS Code setup. I have no idea what. This is driving me nuts! Disappointed   Yet it builds and runs!!!!

    For example in main.c pn the ble_blinky, similar to ble_blinky_c

  • Uhmmm, so I found that adding the following to the "defines" section of c_cpp_properties.json (a part of vscode c/c++ extension) gets rid of ost errors:

                    "NRF_SDH_BLE_ENABLED",
                    "NRF_BLE_GQ_DATAPOOL_ELEMENT_SIZE=20",
                    "NRF_BLE_GQ_DATAPOOL_ELEMENT_COUNT=8",
                    "BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST",
    But why I need to do this I don't get, especially as they are in sdk_config.h ???
    How do I figure out/know what defines I need???
    One last error remain, I hope!
    union "<unnamed>" has no field "conn_param_update_request"
    referring to 

     

            case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST:
            {
                // Accept parameters requested by peer.
                err_code = sd_ble_gap_conn_param_update(p_gap_evt->conn_handle,
                                            &p_gap_evt->params.conn_param_update_request.conn_params);
                APP_ERROR_CHECK(err_code);
            } break;
     
    in the 
    static void ble_evt_handler(ble_evt_t const * p_ble_evtvoid * p_context)
    {
    function.
    ???
  • So this seems related to the last define I added : "BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST",

    In ble_gap.h there is an error in the enum BLE_GAP_EVTS at the point where it is listed

    line 132 

    BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST   = BLE_GAP_EVT_BASE + 15,
    So something isn't right with my define perhaps?? Does it need a value?
Reply Children
No Data
Related