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

Programming nrf5e with accelerometer

Hi guys, I just ordered doc.mokotechnology.com/index.php device which is nrf52 + accelerometer + firmware that is just broadcasting the location over BLE. This is almost what I want, I just need to customize the device a little. What I need is just the BLE to advertise simple encrypted UUID and when the accelerometer detects movement, the device to stop advertising.
I'm new to programming with Microcontrollers and especially with the Nordic spec.
 
So, my questions are:
1. Which example from the SDK examples to use in order to have a min. changes ?
2. Is there a guide that I can read that will give me a clue what I need to change and how to do it ?

Regards,
Milen Yanchev

Parents Reply Children
  • Thanks for sharing this course Amanda. It's really useful for someone new to see the big picture.

    However, the example doesn't work. Following the step by step guide, when I try to compile it, I get - ‘m_cus’ undeclared (first use in this function).

    Then I clone the Git repo and try again, this time I hit another issue with the logging header.

    - /home/components/libraries/experimental_log/src/nrf_log_backend_rtt.c: No such file or directory

    Can you please fix it ?

    Regards,

    Milen Yanchev

  • Hi Milen, 

    Which SDK are you using?

    Did you clone that repo into SDK v15.0.0/examples/ble_peripheral?

    -Amanda H.

  • Hi Amanda,

    I'm using SDK v16.0.0.

    I have installed SDK v15.0.0 and the GIt example is compiled now. However, I'm still getting issues with the step by step guide. I notices that in the Git example, I have nRF_BLE_Serives folder and my ble_cus.c file is there, however, when I'm making the files manually, both files (.c and .h) are in the Application folder.

    Here is when I'm manually creating the files and I hit ‘m_cus’ undeclared (first use in this function) error.

    Here is how it look in the Git example. It is compiled without an issues.

    What else should I configure ? Where this m_cus defined ?

    Regards,

    MIlen Yanchev

  • Hi, 

    The tutorial is developed by SDK_15.0.0. You should Download nRF5_SDK_15.0.0_17b948a from the download page and extract the zip to your drive, e.g. C:\NordicSemi\nRF5_SDK_15.0.0_a53641a.

    yanchevm said:
    What else should I configure ? Where this m_cus defined ?

    add a custom service instance called m_cus, i.e. add the following line below the defines in main.c

    BLE_CUS_DEF(m_cus);

    -Amanda H.  

  • I finally manage to make it compile and work. The problem was in the header file:

    The definition of the macros needs to be at the top of the header file:

    #define BLE_CUS_DEF(_name)                                                                         
    static ble_cus_t _name;        

    That solves my problem with ‘m_cus’ undeclared (first use in this function) error.

    To continue from here, can you please clarify two things to me:

    1. In the example https://github.com/NordicPlayground/nRF52-Bluetooth-Course, I'm creating in step by step new service. Do I need to be connect to the device in order to use this service ?

    2. What I need is without connecting the device, when it advertise to be able to read the data. Is there any example for that ?

    3. Is there any example of how to configure and handle accelerometer events ?

    Regards,

    Milen

Related