NRF_ERROR_DATA_SIZE when trying to configure/encode adv data in Codec PHY

Hi,

I was trying to configure adv data such us UUID, major, minor and other data using codec PHY in BLE. I am able to send it correctly using 1M PHY, buy I am having many troubles using Codec.

My project is this one:  0167.ble_app_beacon_.zip and using 

SEGGER Embedded Studio for ARM
Release 7.32 Build 2023081802.53976
Windows x64.

With nRF5 SDK v17.1.0

First of all i have defined two compilation settings (needed for compiling, as i used defined variables on them in advertising_init):


I defined the variables in the first two profiles.

As it is shown in the Preprocessor options:

This project is an advertiser that sends BLE advertisements accord the compilation profile defined. And Tx power and PHY mode can be changed using switches 3 and 2 respectively. 

I have the following NRF_ERROR_DATA_SIZE error using the 1adv_seg compilation environment, please use only this one (in which the tx power change works properly):

The error is in this line:

This worked for me before because I had commented those lines, but when I scanned the adv in Codec mode I realised than it did not contain any advertisement data to obtain and analyze, so I uncommented the lines and the error arose.
I also tried to create a new ble_gap_adv_data_t m_adv_data, defining the len of the p_data defined by other buffer for extended advertisers, as is shown in the image:

Therefore, my issue is inside the ble_advdata_encode for extended advertisements using Codec, and I do not know where is the problem, please if you would help me.

Thanks for the support!

  • Hi,

    The advertisement type you have selected is 'non-scannable', which means you cannot send any scan response. Therefore, there is no need to provide a buffer for scan response data either.

    My question comes because i want to implement a system where the central receives advertisements from the peripheral and when i press a button in the central, for example, it sends an advertisement to which the peripheral would respond, all this without connecting the devices. I mean, all communication is using advertisements, I one case undirected (from peripheral to central) and in the other case (when button pressed, from central to peripheral), directed to that peripheral

    Is there a reason you don't want to make it connection-based? The setup you describe means that the devices will need to operate in both a GAP Observer role and a GAP Broadcaster role. It is not going to be very efficient in terms of power usage.

  • Hi, 

    At the moment we are trying to squeeze advertising mechanism and adv/scanner activation/deactivation  in order to modify the communication and sleep intervals.

    In short: A central will send advertisements with a proprietary and known packet structure (for example, requesting a param value o other thing). Then, the peripherarl (that is in rx mode) receives the advertiser, parses the inside adv data fields and, in this case, it will response with the value, by changing to tx when rx cicle ends and sending the corresponding value inside an advertising.

    When tx is done, the peripheral will return to rx mode (or sleep mode, is yet to be defined).

  • I understand the setup you're describing, where the devices will alternate between the observer and advertising roles, but I'm not clear on the motivation for this. Getting good synchronization between the scanner and advertiser is made difficult by the fact that the Bluetooth stack appends a random 1-10 ms delay before every advertising event. In other words, the advertiser does not broadcast at fixed intervals.

  • Right now, we are working on an architecture where there is a central coordinator that communicates in a directional way to around 10 to 30 sensor devices. And we need long range BLE. That is why we are exploring point to point communication between coordinator (central) and sensor (peripherals).

Related