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

Porting code from SDK v15.0 to 17 - problem with ble_nus_data_send

I have a working code which implements a UART peripheral written originally with SDK15.0

I would like to port it to the latest SDK 17.02 

I can get advertisement and I can connect with a smartphone. 

I can write data from the smartphone to the UART, but the opposite direction doesn't work

I get error and reset

I found that the problem is in ble_nus_data_send

What could be the reason (difference between SDK15 to SDK17)?

Parents
  • Hello,

    It is as @awneil said, we will need the error message to identify the root cause of your issue.
    Could you make sure that DEBUG is defined in your preprocessor defines, like shown in the included image?

    This will make a debug statement be printed to your logger, when APP_ERROR_CHECK is passed an error code different from NRF_SUCCESS.
    Please make sure DEBUG is defined, and let me know what this error message reads. We may then begin looking into why this error message is generated.

    Looking forward to resolving this issue together!

    Best regards,
    Karl

  • I can see that 

    (conn_id = p_link_ctx_storage->max_links_cnt)

    Both equal to 1 and then it gets NRF_ERROR_NO_MEM

  • Avi said:
    I meant that during debugging of why I don't get response, starting from the ble_nus_data_send, I found that I get ERROR which I described later.

    Yes, I have understood this.
    The reason I would appreciate seeing the full error message is to make sure this in fact is where and why your application resets.
    It is also a great feature to use when developing your application further.

    Avi said:

    The value is:

    #define NRF_SDH_BLE_TOTAL_LINK_COUNT 1 

    Thanks for clarifying.

    Karl Ylvisaker said:
    how many concurrent connections do you intend to hold?


    Looking forward to resolving this issue together!
     
    Best regards,
    Karl

  • In my previous code it was set to 2.

    But if I put this number in SDK17, the code doesn't start. Maybe there are some other changes in the config file?

  • My previous code combined both peripheral and central - each started upon selection during init. So, values were:

    // <o> NRF_SDH_BLE_PERIPHERAL_LINK_COUNT - Maximum number of peripheral links.
    #ifndef NRF_SDH_BLE_PERIPHERAL_LINK_COUNT
    #define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 1
    #endif

    // <o> NRF_SDH_BLE_CENTRAL_LINK_COUNT - Maximum number of central links.
    #ifndef NRF_SDH_BLE_CENTRAL_LINK_COUNT
    #define NRF_SDH_BLE_CENTRAL_LINK_COUNT 1
    #endif

    // <o> NRF_SDH_BLE_TOTAL_LINK_COUNT - Total link count.
    // <i> Maximum number of total concurrent connections using the default configuration.

    #ifndef NRF_SDH_BLE_TOTAL_LINK_COUNT
    #define NRF_SDH_BLE_TOTAL_LINK_COUNT 2
    #endif

    But in my new SDK17 version, when I use  NRF_SDH_BLE_TOTAL_LINK_COUNT 2

    I cannot start the peripheral 

  • Hello again,

    Thank you for clarifying about the differentiation between your previous configuration and the current one. 

    Avi said:
    It maybe an issue of RAM size....

    This might very well be a memory issue. Which SoftDevice were you using in your previous project, and which SoftDevice are you using now?
    Could you share with me the section placement macros of your project, along with any changes to the flash_placement file ( if you have made any )?

    Avi said:
    I cannot start the peripheral 

    Are you getting an error when this happens? I am guessing that an error message is written to your logger output ( if you have DEBUG enabled, as explained previously ) when you attempt to initialize the device with too little memory allocated.
    This error message might also tell you how to resolve this issue.

    Looking forward to resolving this issue together!

    Best regards,
    Karl

Reply
  • Hello again,

    Thank you for clarifying about the differentiation between your previous configuration and the current one. 

    Avi said:
    It maybe an issue of RAM size....

    This might very well be a memory issue. Which SoftDevice were you using in your previous project, and which SoftDevice are you using now?
    Could you share with me the section placement macros of your project, along with any changes to the flash_placement file ( if you have made any )?

    Avi said:
    I cannot start the peripheral 

    Are you getting an error when this happens? I am guessing that an error message is written to your logger output ( if you have DEBUG enabled, as explained previously ) when you attempt to initialize the device with too little memory allocated.
    This error message might also tell you how to resolve this issue.

    Looking forward to resolving this issue together!

    Best regards,
    Karl

Children
No Data
Related