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

Migration nRF51822 -> nRF52832

Hi,

I have an old project running on nRF51822, with SoftDevice SDK v8 - S110 mode. I'm trying to migrate the project to a nRF52832 with SoftDevice SDV v12 - S132 v3 mode.

I'm working with Segger Embedded Studio v3.10e

The device is a peripheral who runs some custom BLE services to transfer data.

I'm trying to code once again all my services using the ble_app_template included in the SDK.

I imported my former services, all is fine.

I swapped device_manager for peer_manager. Unfortunately, during pm_init(), I got an error. More precisely, it happens in pds_init() in peer_data_storage.c, when calling fds_init() I got a NRF_ERROR_NO_MEM error.

I commented the block with pm_init(). Now, my project is running, and the device is advertising.

Here is the corresponding screenshot from LightBlue.

image description

So... I can connect to my device and services appeared in the advertised data ; but I can not see them in details (see the characteristics, read/write them). Of course, with the nRF51822 version, everything works.

Do you know how to solve this? Does the problem come from the fact I can not initialize peer manager? Or is it something with the custom services (something to migrate?)? Maybe something else?

  • FormerMember
    0 FormerMember

    Being able to see the services and characteristics is independent of the peer manager.

    I assume that the service and characteristics have been successfully added to the device? If so, could you use the sniffer to check if the iOS device is doing a service discovery? Could you try do delete all cached information on the iOS device about the nRF52? Does it work with nRF Connect (PC) or Android?

    Regarding pm_init()/fds_init() failing: If you run the chip in debug mode, where exactly is the error code being returned from? Which FDS settings do you use in sdk_config.h?

  • Hi Kristin, thank you for your reply.

    1/ About service and characteristics: same result with nRF Connect / Android or iOS (iOS is indeed making a service discovery). My guess is that it has something to do with the way I implement my custom services (initialization and event management). What worked with SDK 8 seems to be obsolete with SDK12 - S132. Do you know if there is an example where I can fin custom service implementation - currently analysing ble_hrs file?

    2/ Concerning peer_manager : as stated, error happens during pm_init(). To be precise, in pm_init(), a call is made to pds_init(). In pds_init(), everything is fine until fds_init(). Calling fds_init() returns a FDS_ERR_NO_PAGES error that causes the NRF_ERROR_NO_MEM. Memory configuration is the following: FLASH_START=0x1F000 SRAM_START=0x20002128 I paste my FDS settings in sdk_config.h in next comment

  • #ifndef FDS_ENABLED #define FDS_ENABLED 1 #endif #if FDS_ENABLED // FDS_OP_QUEUE_SIZE - Size of the internal queue. #ifndef FDS_OP_QUEUE_SIZE #define FDS_OP_QUEUE_SIZE 4 #endif

    // <o> FDS_CHUNK_QUEUE_SIZE - Determines how many @ref fds_record_chunk_t structures can be buffered at any time. 
    #ifndef FDS_CHUNK_QUEUE_SIZE
    #define FDS_CHUNK_QUEUE_SIZE 8
    #endif
    
    // <o> FDS_MAX_USERS - Maximum number of callbacks that can be registered. 
    #ifndef FDS_MAX_USERS
    #define FDS_MAX_USERS 8
    #endif
    
    #ifndef FDS_VIRTUAL_PAGES
    #define FDS_VIRTUAL_PAGES 3
    #endif
    
    #ifndef FDS_VIRTUAL_PAGE_SIZE
    #define FDS_VIRTUAL_PAGE_SIZE 1024
    #endif
    

    Preprocessor definitions I added: FDS_ENABLED FSTORAGE_ENABLED PEER_MANAGER_ENABLED

  • FormerMember
    0 FormerMember in reply to FormerMember

    1) The example ble_app_uart shows how to implement a custom service.

    2) Which size/length do you use for the flash and RAM settings?

  • 1/ Thx, I'll have a look on this service

    2/ I use a PCA10040 v1.1.0

    Global settings for the device : Flash: START_ADDRESS 0x0 / SIZE 0x00080000 (512 kb) RAM: START_ADDRESS 0x20000000 / SIZE 0x00010000 (64 kb)

    Due to the fact that SoftDevice (SDK12 / S132 v3.0) will use part of this space, settings for the project are the following Flash: START_ADDRESS 0x1F000 / SIZE 0x61000 (approximately 390 kb) RAM: START_ADDRESS 0x20002128 / SIZE 0xDED8 (approximately 55 kb)

    Does it look right?

Related