This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2340R5: Obtaining the advertisment data when detected a device in observer mode

Part Number: CC2340R5
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hello,

I am programming the CC2340R5 launchpad with the basic_ble example using the SimpleLink Low Power F3 SDK 8.40.00.61. The main objective I want to reach when using this example is to detect a certain BLE beacon that is sending advertisment data and obtain its payload. 

I have been able to detect the device, but I am not been able to see the payload in the advertisement data. I have reached the part of the code in the picture below, which is inside app_observer.c, i can see that there is a advReport variable in which the information of the device is stored.

When going through this variable the structure of the variable is the one in the next picture:

I can see that there is a pointer to advertising data, however this pointer is not being updated, as in the sysconfig there is no option of adding pData to the report as shown below:

In the picture below can be seen the data in the structure advReport:

The pData is pointing to a memory address that does not correspond to where the payload actually is. Can you help me accessing the the part of the memory where the payload of the advertisment is stored?

Thank you in advance.

Regards,

Eñaut

  • Hi Eñaut,

    Thank you for reaching out. Can you share where you have placed the breakpoint in your application that is used to monitor the advReport struct?

    Best Regards,

    Jan

  • Hi Jan,

    Thank you for reaching out. The breakpoint is placed in line 205 in app_observer.c, as you can see in the picture below. I've only changed the device role to observer in sysconfig, the rest of the project remains the same. If you have any other question ask it without hesitation.

    Best Regards,

    Eñaut

  • Hi Eñaut,

    Are you performing any output or calculation based on the advertising report data? Its possible if the adv report data is not used for anything that it is being optimized out. Can you try adding a MenuModule_printf statement that prints a portion of the advertising data to see if we can see it print?

    Best Regards,

    Jan

  • Hi Jan, 

    I've added the printf as you have said but the pointer continues being a pointer to direction 0x00000000, I have added a random parameter of the advReport, the rssi and the pointer itself, in case it was optimizing the pointer. However, it is not the case, I attach you the photo of the two lines I have added to the code and the screenshot of the menuModule in tera term.

    Best Regards, 

    Eñaut

  • Hi Eñaut,

    Can you try adding the BLEAPPUTIL_ADV_REPORT event mask and event to your code and attempting to see the advertising data when that event is received instead of the scan disabled?

    Best Regards,

    Jan

  • Hi Jan,

    Thank you for your help, I've already solved the issue. It was an optimization issue but not with the advReport variable, as the funcion GapScan_getAdvReport() does not copy the pointer into advReport variable. However, the pointer it is available in scanMsg when stopping in the event 

    BLEAPPUTIL_ADV_REPORT. But the optimizations of the project have to me removed in order to see this variable, by default the optimizations are in level z, I have changed them to level 0 and I can see it.
    Thank you again for your help.
    Best Regards,
    Eñaut