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

Advertising Name

I am trying to find an example to do a BLE pairing. This is my first BLE experience and working with nRF52832 using SDK15.2 and softdevice API 6.1

I am trying to do a base station keyfob connection

i would like to make 1 item go into pair mode and advertise OTA with a specific advertising name. I am trying to work with the ble_app_template example, but i cannot find how to change the advertising name from DfuTarg to what i want it to be.

What are the examples that are recommended to do the pairing i should review?

Also what is buttonless dfu? And if i want it to auto pair when near is that considered buttonless? endgame i would want to initiate a pairing sequence, but once paired, the paired device should remain paired and if within range, be able to communicate./ It is a key fob type situation.

Any informaiton would be helpful with this

Parents
  • I have been working with this how-to https://devzone.nordicsemi.com/tutorials/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial and it seems to be very helpful. I made it to the last page and i have a few issue with the operation

    #define BLE_UUID_OUR_BASE_UUID              {0x23, 0xD1, 0x13, 0xEF, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00} // 128-bit base UUID
    #define BLE_UUID_OUR_SERVICE                0xABCD // Just a random, but recognizable value
    
    void our_service_init(ble_os_t * p_our_service)
    {
    
        // Declare 16 bit service and 128 bit base UUIDs and add them to BLE stack table     
        uint32_t   err_code;
        ble_uuid_t        service_uuid;
        ble_uuid128_t     base_uuid = BLE_UUID_OUR_BASE_UUID;
        service_uuid.uuid = BLE_UUID_OUR_SERVICE;
        service_uuid.type = BLE_UUID_TYPE_BLE;  // Had to add this and comment out below lines to make work
        //err_code = sd_ble_uuid_vs_add(&base_uuid, &service_uuid.type);
        //APP_ERROR_CHECK(err_code);
      
        // Add service
        
        err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                        &service_uuid,
                                        &p_our_service->service_handle);
       
        APP_ERROR_CHECK(err_code);
    }

    The sd_ble_uuid_vs_add() was not working right and when i tried to use it it would break. So i could not use vendor specific base UUID. which makes the other parts kinda of sketchy to get operating.

    Is there some reason when i try and use the vendor specific base UUID it is not working?

    Also in these turtorials there is not good example of how i can connect a second nRF52 module to this one. I am assuming something like the following:

    Scan for Device Name -> if device name "X" is found then pair -> after pairing, send info from A to B and then B to A

    This info was so far really good so far. I am hoping there is another similar tutorial on setting up pairing between 2 nRF52832 modules.

Reply
  • I have been working with this how-to https://devzone.nordicsemi.com/tutorials/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial and it seems to be very helpful. I made it to the last page and i have a few issue with the operation

    #define BLE_UUID_OUR_BASE_UUID              {0x23, 0xD1, 0x13, 0xEF, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00} // 128-bit base UUID
    #define BLE_UUID_OUR_SERVICE                0xABCD // Just a random, but recognizable value
    
    void our_service_init(ble_os_t * p_our_service)
    {
    
        // Declare 16 bit service and 128 bit base UUIDs and add them to BLE stack table     
        uint32_t   err_code;
        ble_uuid_t        service_uuid;
        ble_uuid128_t     base_uuid = BLE_UUID_OUR_BASE_UUID;
        service_uuid.uuid = BLE_UUID_OUR_SERVICE;
        service_uuid.type = BLE_UUID_TYPE_BLE;  // Had to add this and comment out below lines to make work
        //err_code = sd_ble_uuid_vs_add(&base_uuid, &service_uuid.type);
        //APP_ERROR_CHECK(err_code);
      
        // Add service
        
        err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                        &service_uuid,
                                        &p_our_service->service_handle);
       
        APP_ERROR_CHECK(err_code);
    }

    The sd_ble_uuid_vs_add() was not working right and when i tried to use it it would break. So i could not use vendor specific base UUID. which makes the other parts kinda of sketchy to get operating.

    Is there some reason when i try and use the vendor specific base UUID it is not working?

    Also in these turtorials there is not good example of how i can connect a second nRF52 module to this one. I am assuming something like the following:

    Scan for Device Name -> if device name "X" is found then pair -> after pairing, send info from A to B and then B to A

    This info was so far really good so far. I am hoping there is another similar tutorial on setting up pairing between 2 nRF52832 modules.

Children
  • Is there some reason when i try and use the vendor specific base UUID it is not working?

    There's no way to answer this unless you provide more details. What does "not working" mean exactly? What erroneous behavior did you observe? Did sd_ble_uuid_vs_add() return an error? If so, what was it?

    In order to add a vendor-specific UUID, you need to tell the SoftDevice to reserve some storage for it first. This is done by calling sd_ble_cfg_set() with BLE_COMMON_CFG_VS_UUID, e.g.:

    ble_cfg_t cfg;
    uint32_t ram_start = YOUR_RAM_START_ADDR;
    int r;
    
    memset (&cfg, 0, sizeof(cfg));
    
    cfg.common_cfg.vs_uuid_cfg.vs_uuid_count = 1;
    
    r = sd_ble_cfg_set (BLE_COMMON_CFG_VS_UUID, &cfg, ram_start);

    Note that this may also require reserving some additional RAM for SoftDevice. I don't know if you've had to deal with that particular concept yet. Basically, you may need to edit the linker script for the example to change the ORIGIN address and LENGTH for the RAM region. The SoftDevice wants to use RAM starting at address 0x20000000, up to some length. Your application is allowed to use memory _after_ that. The examples are configured to allocate enough memory for what the sample features need, but if you add something else, you'll need to move the ORIGIN address higher and decrease the LENGTH by the same amount.

    -Bill

  • Linker script is new to me but i figured it out within SES. i Added some more memory and assume the ram_start_addr in your example refers to the RAM start addr I set. The error i am getting during debug is when i try to do sd_ble_uuid_vs_add it return err_code = 4 which is NRF_ERROR_NO_MEM. the base RAM location from the proximity example had RAM start at 2218. I modified the RAM address to start at 4000 and changed length to c000. Is this not enough additional memory? I also added your recommended memory allocation for the vs_uuid.

    Also when i run it in debug mode, when i do the APP_ERROR_CHECK(err_code), it seems to lock up in the function within  app_error_weak.c at line 100 NRF_BREAKPOINT_COND.

    Here is my project memory information from the options within SES. I only changed the RAM_START and RAM_SIZE values.

    FLASH_PH_START=0x0

    FLASH_PH_SIZE=0x80000

    RAM_PH_START=0x20000000

    RAM_PH_SIZE=0x10000

    FLASH_START=0x26000

    FLASH_SIZE=0x5a000

    RAM_START=0x20004000

    RAM_SIZE=0xc000

  • Hi.

    You can correct the RAM start address by following step 7 in this tutorial.

    dmleone said:

    RAM_START=0x20004000

    RAM_SIZE=0xc000

    This might not be correct, because 0x4000 + 0xc000 = 0x10000 is 64 kB RAM, and the nRF52832 has either 64 kB or 32 kB RAM, as you can read here.

    For 32 kB it has to be 0x4000 for RAM_SIZE.

    Best regards,

    Andreas

  • i also noticed 10000 is not 64k but that seems to be the values listed in all the examples. i have the 64kB chip. I a,so used that link to do some understanding on memory spacing. what is the value i should use for max ram size if 10000 is not the correct one for this chip per examples?

  • Additional issue i had was the sdk_config file did not have correct settings. The tutorial didnt explain the need to update that. Once i updated NRF_SDH_BLE_VS_UUID_COUNT within the sdk, it did as expected. and increased memory. Your answer was helpful to establish memory for it. thanks

Related