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 Reply Children
  • 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

  • I don't know why it isn't working. What changes did you do when the previous project didn't work, and I suggested the clock config changes? We don't support Eclipse, so if the issue is related to that I don't know what the issue may be.

  • For the previous project RAM address was wrong. After i changed them, it started advertising... Other than that nothing..

    Can you please flash the precompiled hex of freertos example in nrf51802 module and check if it is advertising for you?

    Irrespective of ide, the precompiled hex should work.. but its not happening.

  • swetha Paladugu said:
    Irrespective of ide, the precompiled hex should work..

     I agree that the precompiled hex files should work irrespective of IDEs, but not irrespective of HW. What are the buttons and LED pins connected to? Try to comment out the bsp_init() function.

    I see you have DEBUG in your preprocessor definitions (CFLAGS). Try to set a breakpoint on line 76 in app_error.c. Is that hit?

    /*lint -save -e14 */
    void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * p_file_name)
    {
        error_info_t error_info =
        {
            .line_num    = line_num,
            .p_file_name = p_file_name,
            .err_code    = error_code,
        };
        app_error_fault_handler(NRF_FAULT_ID_SDK_ERROR, 0, (uint32_t)(&error_info));    // <-- Breakpoint here
    
        UNUSED_VARIABLE(error_info);

    I can try the 51 DK on Monday, but I am working from home now, and I don't have a 51 DK plugged into my computer (remote desktop). 

Related