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

array size increase causes bluetooth to not connect.

Hello once again Nordic Pro's,

My latest issue, I believe to be related to stack/heap settings, but dont have enough information to track/correct.

I have a couple int array variables that, if their size is increased above 105 elements, bluetooth no longer connect to our central test board.

Not sure where to start chasing this  as I have no compile, build or load error messages, just a failure to connect.

Any help in chasing this down is greatly appreciated.

Device: 51822,

SDK: 12.3,

IDE: Keil 5.28,

App based on app_ble_uart peripheral.

Thanks again,

Robin @ TL

Parents
  • On the 16KB NRF51x variants, you can run out of RAM quite quickly.

    Testing what is actually happening requires debugging, e.g. with a J-Link.

  • Hi,

    Let me add that our SoftDevices has a maximum stack usage of around 1.5 kB. In other words, if at any time SoftDevice + application RAM usage + application stack usage exceeds 14.5 kB then you may get a stack overflow which will result in undefined behavior.

    Debugging will either give you error codes, or, you can have a look at the stack pointer to see if it goes alarmingly high. Remember that each array of a hundred 32 bit integers is 400 bytes, not that far from half a kilobyte, so if you have 16 kB of RAM those arrays quickly takes up a significant portion of available RAM.

    Also, how much RAM is available to the stack? (The way to tell in Keil is that ZI-data and RW-data is the total static ram used by the application, the rest of available RAM is for the stack.)

    Are the arrays in static memory or are they also put on the stack?

    How many arrays are there?

    Regards,
    Terje

Reply
  • Hi,

    Let me add that our SoftDevices has a maximum stack usage of around 1.5 kB. In other words, if at any time SoftDevice + application RAM usage + application stack usage exceeds 14.5 kB then you may get a stack overflow which will result in undefined behavior.

    Debugging will either give you error codes, or, you can have a look at the stack pointer to see if it goes alarmingly high. Remember that each array of a hundred 32 bit integers is 400 bytes, not that far from half a kilobyte, so if you have 16 kB of RAM those arrays quickly takes up a significant portion of available RAM.

    Also, how much RAM is available to the stack? (The way to tell in Keil is that ZI-data and RW-data is the total static ram used by the application, the rest of available RAM is for the stack.)

    Are the arrays in static memory or are they also put on the stack?

    How many arrays are there?

    Regards,
    Terje

Children
No Data