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

Binary from nRF51882_QFAC wont run on QAFF

Hi Guys

I've got a strange problem where a binary that works fine on a nRF51822 QFAC does not run on a QFAA

I know that the difference between these two devices is the RAM size, so I did used some code that malloc's various sizes of memory to determine how much is available and on the QFAA I'm seeing

2304 bytes (allocation in 16 byte steps)

On both devices, because I set the linker (GCC) directive file to specify the device only has 16k memory

MEMORY { FLASH (rx) : ORIGIN = 0x0001C000, LENGTH = 0x24000 RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x1800 }

If I change the RAM size in the linker and recompile and re-run on the QFAC I see that it has more memory, as my RAM test returns 19024 bytes

But.. These figures don't tally

i.e 2304 + 16384 does not equal 19024

BTW. I'm using the S130 SoftDevice, and just running a simple application which advertises and accepts a connection (so that I can send serial data to the device)

If I recompile and upload to the QFAA rather than copying the binary that was running on the QFAC, the application does not run correctly

The Advertising data is not getting setup correctly and although I can see the device I can't connect to it using a test app (Light Blue running on an iPad)

So I suspect I have some sort of RAM allocation issue

But at the moment this isnt making any sense to me at all.

BTW. I thought it may be a Programmer issue (I'm using a JLInk) but I've tried reading back the code and it does seem to program both devices the same.

I do have another SWD programmer I could try, but this does look like a RAM issue to me.

Does anyone have any ideas what is going one ?

Thanks

Roger

Parents
  • Don't think that RAM allocation tests are going to tell you very much. Simplest thing to do would be to put a debugger on the code and see which error handler or fault handler it's ended up int. Have you tried that?

    one possibility is you're overflowing the stack. On the lower memory chip the stack will be close to the end of the heap, and the stack isn't bounds checked, so if you use a lot of it, it's quite easy to corrupt some of your heap or fixed memory, then corrupt the stack and crash. So you could try more stack for a start.

Reply
  • Don't think that RAM allocation tests are going to tell you very much. Simplest thing to do would be to put a debugger on the code and see which error handler or fault handler it's ended up int. Have you tried that?

    one possibility is you're overflowing the stack. On the lower memory chip the stack will be close to the end of the heap, and the stack isn't bounds checked, so if you use a lot of it, it's quite easy to corrupt some of your heap or fixed memory, then corrupt the stack and crash. So you could try more stack for a start.

Children
No Data
Related