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

Parents
  • 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.

  • i am not using SES.. i am using eclipse...

    I kept a breakpoint in ble_stack_thread(), and it never reaches there..

  • swetha Paladugu said:
    i am not using SES.. i am using eclipse...

     Ah. That's right.

    Is the main() function reached at all?

  • From scheduler it goes to unknown state, there are no other breakpoints in the code

  • linker_cfg.ld

    4405.FreeRTOSConfig.h

    32653.sdk_config.h

    Attaching my project files for reference.

    Makefile defines:


    # Libraries common to all targets
    LIB_FILES += \

    # C flags common to all targets
    CFLAGS += -D__STACK_SIZE=2048
    CFLAGS += -D__HEAP_SIZE=1024
    CFLAGS += -DBOARD_PCA10028
    CFLAGS += -DSOFTDEVICE_PRESENT
    CFLAGS += -DNRF51
    CFLAGS += -DS130
    CFLAGS += -DFREERTOS
    CFLAGS += -DBLE_STACK_SUPPORT_REQD
    CFLAGS += -DSWI_DISABLE0
    CFLAGS += -DNRF51802
    CFLAGS += -DDEBUG
    CFLAGS += -DNRF_SD_BLE_API_VERSION=2
    CFLAGS += -mcpu=cortex-m0
    CFLAGS += -mthumb -mabi=aapcs
    CFLAGS += -Wall -Werror -O0 -g3
    CFLAGS += -mfloat-abi=soft
    # keep every function in separate section, this allows linker to discard unused ones
    CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
    CFLAGS += -fno-builtin --short-enums

    # C++ flags common to all targets
    CXXFLAGS += \

    # Assembler flags common to all targets
    ASMFLAGS += -x assembler-with-cpp
    ASMFLAGS += -D__STACK_SIZE=2048
    ASMFLAGS += -D__HEAP_SIZE=1024
    ASMFLAGS += -DBOARD_PCA10028
    ASMFLAGS += -DSOFTDEVICE_PRESENT
    ASMFLAGS += -DNRF51
    ASMFLAGS += -DS130
    ASMFLAGS += -DBLE_STACK_SUPPORT_REQD
    #ASMFLAGS += -DSWI_DISABLE0
    ASMFLAGS += -DNRF51802
    ASMFLAGS += -DNRF_SD_BLE_API_VERSION=2

    # Linker flags
    LDFLAGS += -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT)
    LDFLAGS += -mcpu=cortex-m0
    # let linker to dump unused sections
    LDFLAGS += -Wl,--gc-sections
    # use newlib in nano version
    LDFLAGS += --specs=nano.specs -lc -lnosys

Reply
  • linker_cfg.ld

    4405.FreeRTOSConfig.h

    32653.sdk_config.h

    Attaching my project files for reference.

    Makefile defines:


    # Libraries common to all targets
    LIB_FILES += \

    # C flags common to all targets
    CFLAGS += -D__STACK_SIZE=2048
    CFLAGS += -D__HEAP_SIZE=1024
    CFLAGS += -DBOARD_PCA10028
    CFLAGS += -DSOFTDEVICE_PRESENT
    CFLAGS += -DNRF51
    CFLAGS += -DS130
    CFLAGS += -DFREERTOS
    CFLAGS += -DBLE_STACK_SUPPORT_REQD
    CFLAGS += -DSWI_DISABLE0
    CFLAGS += -DNRF51802
    CFLAGS += -DDEBUG
    CFLAGS += -DNRF_SD_BLE_API_VERSION=2
    CFLAGS += -mcpu=cortex-m0
    CFLAGS += -mthumb -mabi=aapcs
    CFLAGS += -Wall -Werror -O0 -g3
    CFLAGS += -mfloat-abi=soft
    # keep every function in separate section, this allows linker to discard unused ones
    CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
    CFLAGS += -fno-builtin --short-enums

    # C++ flags common to all targets
    CXXFLAGS += \

    # Assembler flags common to all targets
    ASMFLAGS += -x assembler-with-cpp
    ASMFLAGS += -D__STACK_SIZE=2048
    ASMFLAGS += -D__HEAP_SIZE=1024
    ASMFLAGS += -DBOARD_PCA10028
    ASMFLAGS += -DSOFTDEVICE_PRESENT
    ASMFLAGS += -DNRF51
    ASMFLAGS += -DS130
    ASMFLAGS += -DBLE_STACK_SUPPORT_REQD
    #ASMFLAGS += -DSWI_DISABLE0
    ASMFLAGS += -DNRF51802
    ASMFLAGS += -DNRF_SD_BLE_API_VERSION=2

    # Linker flags
    LDFLAGS += -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT)
    LDFLAGS += -mcpu=cortex-m0
    # let linker to dump unused sections
    LDFLAGS += -Wl,--gc-sections
    # use newlib in nano version
    LDFLAGS += --specs=nano.specs -lc -lnosys

Children
Related