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

Data is not getting received in nus_data_handler


Hi,

I have created an eclipse based makefile project for nrf51802 module.

The sdk version that i am using is 12.3.0, and softdevice S130 .

Taking reference of ble_app_uart example i have advertised my device and i have connected with nrf android application and sent data.

It is expected that data should come into nus_data_handler. I have not enabled any other services except the default nus service which is initialized in services_init();

I kept a breakpoint in nus_data_handler() but it never reaches that breakpoint.

I also see that, it comes to BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST case in on_ble_evt() and then gets disconnected after that.

I am attaching my project for reference.

Please help me resolve this issue. I'm blocked on it since 3 days.0486.Keybox.zip

3225.My_project.zip

  • What is the difference between "My_project.zip" and "Keybox.zip"?

    As mentioned in your other ticket, we don't support Eclipse or Truestudio, so what I do is that I try to use your main.c in the ble_app_uart project.

    So the first thing I needed to change was to add the nrf_queue.c file to the project, since I don't use the same project file as you do.

    The second thing I needed to do was to change the RAM settings, because softdevice_enable() returned 4.

    I had to set RAM start/origin = 0x20003388 and size =  0xCC78.

    Did you change your RAM settings?

    After those changes, I got an interrupt when I used nRF Connect for Desktop to write to the UART rx service:

    If that doesn't happen in your case, try to debug and see what happens. Does the application crash? I don't have any possibility to help you with projects in formats that we don't support. 

    Does it work if you use the UNMODIFIED ble_app_uart example from the SDK? you can try to port it to your IDE, but I see that you have also done a lot of changes to the main.c file, and you have removed all the logging from main.c. Is there any reason for this? Can you try to do this from scratch with an unmodified SDK?

    Best regards,

    Edvin

  • Hi Edvan,

    log messages are not displaying on console... that is the reason i have removed logging..

    After i changed nus characteristics i was able to transmit and receive data with app not through nus_data_handler but some other handler..

    This issue is solved but now i have another issue.

    I want to use freertos in my project so firstly i am running the pre-compiled hex file in the below path and observed that device is not advertising.

    nRF5SDK\examples\ble_peripheral\ble_app_hrs_freertos\hex

    Can you help here?

    Thanks,

    Swetha.

  • Your module probably doesn't have an LFXTAL. You need to compile the project to match your hardware. Change the LFCLK settings in sdk_config.h. 

    CLOCK_CONFIG_LF_SRC 0

    and in pca10028.h (or the equivalent file you are using), you need to change the clock settings:

    #define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_XTAL,            \
                                     .rc_ctiv       = 16,                                \
                                     .rc_temp_ctiv  = 2,                                \
                                     .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}

  • Hi Edvan,

    In my previous ticket when i said device didnt advertise, then also you suggested the same.. But without changing anything to LFCLK, it was advertising after flashing softdevice and properly configuring RAM and flash addresses.

    Now again you are suggesting to check this.

    If there was no LFCLK connected to nrf51 module, it is obvious that my device wouldn't have worked with ble_app_uart code.

    Now the issue is again with the freertos example code.

    can you please explain?

  • Sorry. I don't always check the case history before answering a ticket.

    I can't tell whats wrong based only on the fact that the precompiled .hex file doesn't work. Can you please try to compile the project and run it and see if the log says anything?

    BR,

    Edvin

Related