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

Pairing code examples for an NRF51822 based peripheral.

Hello nRF world,

We have custom peripheral board based on the nRF51822 and need to be able to pair it with a host.  Does anyone have a well documented example of code for doing so?

Thank you kindly,

Robin@TL

Parents
  • An update:  I have taken the advice of a related ticket and merged our code into the ble_app_gls example to attempt pairing. 

    However, although all modules compile independently, there appears to be a memory segmentation problem when linking.  It appears to be associated with the fstorage for fds code, but I cannot determine the fix.  The initial error messages are as follows:

    Output/Debug/Exe/iDrink.elf section `.fs_data' will not fit in region `UNPLACED_SECTIONS'

    Subsequently several errors ensue...

    region `UNPLACED_SECTIONS' overflowed by 16 bytes

    Output/iDrink Debug/Obj/fstorage.o: In function `check_config':

    undefined reference to `__start_fs_data'

    undefined reference to `__stop_fs_data'

    ... and on ad-nauseam...

    What file might I be missing to define this unplaced section in memory?

    Thanks again, in advance,

    Robin@TL

  • You just needed to add one line in flash_placement.xml file in your project

      <MemorySegment name="$(FLASH_NAME:FLASH)">
        ....
        ....
    	<ProgramSection alignment="4" keep="Yes" load="Yes" name=".fs_data" address_symbol="__start_fs_data"  end_symbol="__stop_fs_data" />
      </MemorySegment>

    After that your project compiles fine.

    ...

  • Hello Susheel,

    Thank you for getting me straight on this one.  I guess my old school thinking had me looking for a header or linker directive in an ld file, not in an xml.. Oh well,...

    So now to the next problem:

    There is a "retarget.c" file in the build list that will not compile.  I am not sure what is being retargeted.  Please explain.  I had it excluded to get to where I was.  When I include it here is the error messages:

    storage size of '__stdout' isn't known

    storage size of '__stdin' isn't known

    at these lines:

    FILE __stdout;
    FILE __stdin;

    I am not sure if this file is "needed" for pairing/bonding, but thought I should ask before moving on to test.

    Thanks

    Robin@TL

  • Hello again Susheel,

    In anticipation of your answer regarding the "retarget.c" file necessity for pairing, I did get the app to build,  However, I see no advertisement for pairing, nor does the uart path work any longer.  I can easily go back and forth just by including/excluding the appropriate main.c file, so if you have any suggestions to try, I am prepared.  One of the things I did note is that the RAM definition for the gls app is considerably higher than the for the uart app.  I am not sure if it is required, but it does build and upload at the lower memory setting, but still wont run.

    On a more general point, I am not sure how to determine the memory size requirement and then to make sure that the IDE properly allocates appropriately.  If you can help me learn these details it of of this, it would be greatly appreciated.

    Thanks again,

    Robin@TL

Reply
  • Hello again Susheel,

    In anticipation of your answer regarding the "retarget.c" file necessity for pairing, I did get the app to build,  However, I see no advertisement for pairing, nor does the uart path work any longer.  I can easily go back and forth just by including/excluding the appropriate main.c file, so if you have any suggestions to try, I am prepared.  One of the things I did note is that the RAM definition for the gls app is considerably higher than the for the uart app.  I am not sure if it is required, but it does build and upload at the lower memory setting, but still wont run.

    On a more general point, I am not sure how to determine the memory size requirement and then to make sure that the IDE properly allocates appropriately.  If you can help me learn these details it of of this, it would be greatly appreciated.

    Thanks again,

    Robin@TL

Children
No Data
Related