CodeLess AT+GAPSCAN finds nothing....

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at https://www.dialog-semiconductor.com/support . We’ll be fixing bugs / optimising the searching and tagging over the coming days.
13 posts / 0 new
Last post
janosN
Offline
Last seen: 1 year 3 months ago
Joined: 2020-11-16 14:59
CodeLess AT+GAPSCAN finds nothing....

Dear Support Team,

I installed the SDK with daughter board with the DA14531MOD dev.kit. I successfully flashed codeless_531_set_two_standalone.bin

Issuing commands:

AT+ADVSTOP
AT+CENTRAL
AT+GAPSTATUS
1,0
OK

AT+GAPSCAN
SCANNING

SCAN COMPLETE
OK

It does not discover anything, however we have 3-4 Blutooth devices around.

One of the device which we wanted to read is a Ruuvi tag BLE Beacon:

https://ruuvi.com/ruuvitag-specs/

Thanks....

PM_Dialog
Offline
Last seen: 2 months 2 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi janosN,

Hi janosN,

Thanks for your question online and for your interest in out TINY module BLE solution.

It seems that the sequence of the AT commands is correct. Can you find those devices in a BLE Generic application?

Would it be possible to check this with another DA14531?

Thanks, PM_Dialog

janosN
Offline
Last seen: 1 year 3 months ago
Joined: 2020-11-16 14:59
Hi Dialog Staff,

Hi Dialog Staff,

Thanks for your answer. Regarding your first question: yes, I can find my devices with another scanner. I took my Raspberry Pi and installed a BLE-scanner. Here is the result:

pi@raspberrypi:~ $ sudo blescan
Scanning for devices...
    Device (new): 64:1c:b0:89:2b:0e (public), -94 dBm (not connectable)
        Manufacturer: <75004204018060641cb0892b0e661cb0892b0d01b91baea59500>
    Device (new): 28:39:5e:3f:79:8e (public), -48 dBm
        Short Local Name: '[TV] Samsung 5 Series (43)'
        Flags: <1a>
        Manufacturer: <7500420401014128395e3f798e2a395e3f798dff000000000000>
    Device (new): df:c7:96:0d:31:89 (random), -57 dBm (not connectable)
        Flags: <06>
        Manufacturer: <990405146e4272beeafc48010cff40adb6013940dfc7960d3189>
pi@raspberrypi:~ $

As you see, it finds three devices, whereas my DA14531MOD_devkit finds none.

Regarding your second question checking with other DA14531 modules; we have ordered 10 pieces of DA14531 TINY Modules. I want to flash a few modules to test the AT+GAPSCAN function. I will try all three CodeLess fw. I shall report you about the result....

Thank you for your support.

PM_Dialog
Offline
Last seen: 2 months 2 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi janosN,

Hi janosN,

Yes please, try to configure a TINY module as a GAP peripheral and let me know if the module acting as GAP Central can find it over the air.

Thanks, PM_Dialog

janosN
Offline
Last seen: 1 year 3 months ago
Joined: 2020-11-16 14:59
Dear PM_Dialog,

Dear PM_Dialog,

 

Now, as I can program the TINY modules (thanks to user: cole), I configured as you suggested; one as central and one as peripheral and now the central can scan the peripheral module:

AT+GAPSCAN
SCANNING

(*) 48:23:35:00:72:77,P, Type: ADV, RSSI:-24

(*) 48:23:35:00:72:77,P, Type: ADV, RSSI:-21

(*) 48:23:35:00:72:77,P, Type: ADV, RSSI:-22

SCAN COMPLETE
OK

So, DA14531 Module to another module works. But still it can not scan anything else. As I mentioned earlier, I need to scan BLE sensors advertising temperature, pressure, humidity coded in Manufacture's code like this:

pi@raspberrypi:~ $ sudo blescan
Scanning for devices...
    Device (new): df:c7:96:0d:31:89 (random), -57 dBm (not connectable)
        Flags: <06>
        Manufacturer: <990405146e4272beeafc48010cff40adb6013940dfc7960d3189>
pi@raspberrypi:~ $

The sensor protocol is described on:

https://github.com/ruuvi/ruuvi-sensor-protocols/blob/master/dataformat_0...

I hardly believe that there is no CodeLess AT command solution for this. We don't even need BLE-connection to these sensors, just scan them. For CodeLess AT there are only 3 fw-versions and I tried all of them.

If no CodeLess scan possible, then what next?

Thank you very much in advance.

PM_Dialog
Offline
Last seen: 2 months 2 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi janosN,

Hi janosN,

Could you please do a small change on the CodeLess firmware, re-build and run it?

In the user_on_adv_report_ind() please do the following change in the if-statement : remove the show &&

Initial : 

if (show &&(param->report.evt_type == 0x00 || param->report.evt_type == 0x04)) // Only ADV_IND and SCAN_RESPONSE

Modified : 

if ((param->report.evt_type == 0x00 || param->report.evt_type == 0x04)) // Only ADV_IND and SCAN_RESPONSE

Thanks, PM_Dialog

janosN
Offline
Last seen: 1 year 3 months ago
Joined: 2020-11-16 14:59
Dear PM_Dialog,

Dear PM_Dialog,

Thanks to the suggestion. I modified the file: user_codeless.c

Compiled the project without error. But the Linker reported error that the code size exceeded the limit.

linking...
.\out_531\codeless_531_datapump.axf: error: L6050U: The code size of this image (32792 bytes) exceeds the maximum allowed for this version of the linker.
Not enough information to produce a SYMDEFs file.
Finished: 1 information, 0 warning, 0 error and 1 fatal error messages.

I compiled with maximum optimization O3 (Level 3).

Either I need a license from Keil, or another option would be that Dialog is so kind and sends me the hex file.

Thank you very much in advance.

PM_Dialog
Offline
Last seen: 2 months 2 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi janosN,

Hi janosN,

Let me check it and I’ll get back to you.

Thanks, PM_Dialog

sfuentes-digi
Offline
Last seen: 1 year 3 months ago
Joined: 2021-01-18 09:26
Any solution?

Any solution?

PM_Dialog
Offline
Last seen: 2 months 2 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi sfuentes-digi,

Hi sfuentes-digi,

Please see my previous comment. A modification should be done in the user_on_adv_report_ind().

Thanks, PM_Dialog

sfuentes-digi
Offline
Last seen: 1 year 3 months ago
Joined: 2021-01-18 09:26
Hi PM_Dialog,

Hi PM_Dialog,

Thank you for responding so quickly but I mean if there is any solution to compile the file.

I have the same error, there is another program for compilation or other way?

Thank.

janosN
Offline
Last seen: 1 year 3 months ago
Joined: 2020-11-16 14:59
Dear PM-Dialog,

Dear PM-Dialog,

Dear Sfuentes-digi,

Below I write in more details about CodeLess AT+GAPSCAN issue. My problems at the beginning were the following:

  1. It scanned nothing else but only other Dialog-peripheral devices
  2. After receiving modification suggestion from Dialog it scanned much more peripheral devices. But it did NOT scan certain beacon devices I needed for telemetry data.
  3. It did NOT show the actual raw-data where measurement data coded. It listed only addresses, types and RSSI data.
  4. How to compile the project with Keil-demo license, even the original CodeLess project was too large for Keil linker.

Nr.1 solved: what Dialog suggested to leave out show && like:

if (show &&(param->report.evt_type == 0x00 || param->report.evt_type == 0x04)) // Only ADV_IND and SCAN_RESPONSE*/

to:

if ((param->report.evt_type == 0x00 || param->report.evt_type == 0x04)) // Only ADV_IND and SCAN_RESPONSE*/

 

To solve Nr.2:

examining the code above it was clear that param->report.evt_type is responsible what kind of advertising is accepted by AT+GAPSCAN. So, I was looking for another file which describes these types. It was really hard to locate the following header file: ...\common\api\co_bt.h ; Here the lines 1340-1355:

///Advertising HCI Type

enum

{

    ///Connectable Undirected advertising

    ADV_CONN_UNDIR                = 0x00,

    ///Connectable high duty cycle directed advertising

    ADV_CONN_DIR,

    ///Discoverable undirected advertising

    ADV_DISC_UNDIR,

    ///Non-connectable undirected advertising

    ADV_NONCONN_UNDIR,

    ///Connectable low duty cycle directed advertising

    ADV_CONN_DIR_LDC,

    ///Enumeration end value for advertising type value check

    ADV_END

};

In this enumeration from 0x00-0x05 there are different types we can choose. So, I needed only ADV_NONCONN_UNDIR (0x03 value) because the telemetry beacons advertise non-connectable undirected packets. You can read more about advertising types on:

https://www.novelbits.io/bluetooth-low-energy-advertisements-part-1/  (scroll to the middle of the page…) So, I further modified the function to:

if ((param->report.evt_type == 0x03)) // Only ADV_NONCONN_UNDIR

Now all beacon devices were listed and others are filtered out.

The last problem: where is my raw-data what the beacons supposed to transmit like temperature, air-pressure, humidity, x-y-z acceleration, battery-voltage?

To solve Nr.3:

For this you need to further modify the function to

 

                           char adv_rep_str[260];              /* original 40*/

                          

                           /*orig*/

                           /* "(%c) %02X:%02X:%02X:%02X:%02X:%02X,%c, Type: %s, RSSI:%d\r\n" */

                           /*changed*/

                           /* "(%c) %02X:%02X:%02X:%02X:%02X:%02X,%c, Type: %s, RSSI:%d\r\nRawData-length:\r\n %d\r\n" */

        arch_sprintf(adv_rep_str, "(%c) %02X:%02X:%02X:%02X:%02X:%02X,%c, Type: %s, RSSI:%d, RawData-lenght:%d\r\n"

                                                                     "    RawData(hex): %02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;"

                                                                     "%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X;%02X"

                                                                     "\r\n",

                     codeless_service, param->report.adv_addr.addr[5],

                     param->report.adv_addr.addr[4], param->report.adv_addr.addr[3],

                     param->report.adv_addr.addr[2], param->report.adv_addr.addr[1],

                     param->report.adv_addr.addr[0], address_type, type_str,

                     param->report.rssi - 255, sizeof(param->report.data),

                                                                      param->report.data[0], param->report.data[1], param->report.data[2], param->report.data[3],

                                                                      param->report.data[4],  param->report.data[5],  param->report.data[6],  param->report.data[7],

                                                                      param->report.data[8],  param->report.data[9],  param->report.data[10], param->report.data[11],

                                                                      param->report.data[12], param->report.data[13], param->report.data[14], param->report.data[15],

                                                                      param->report.data[16], param->report.data[17], param->report.data[18], param->report.data[19],

                                                                      param->report.data[20], param->report.data[21], param->report.data[22], param->report.data[23],

                                                                      param->report.data[24], param->report.data[25], param->report.data[26], param->report.data[27],

                                                                      param->report.data[28], param->report.data[29], param->report.data[30]

                                                                      );


        send_to_local(adv_rep_str);

 

 

You see here the param->report.data[30] is the last byte in raw-data array. Of course, the original size of adv_rep_str[40] was not enough, it is now 260

char adv_rep_str[260];       /* original 40*/

The above code is a bit ugly; I could have written in more elegant way in a loop, but it works, I do it later…

To solve Nr.4:  I had a 30-day license from Keil which expired. I needed a way to reduce the code-size. See my previous topic: CODELESS Project Size Reducing - Problem Solved....

Here I found 2 lines user_at_commands.h that you can comment out to gain more room:

//#define USE_AT_CONPAR and //#define USE_AT_BND was effective and after linking, the code-size reported is: 27812 (for codeless_531_datapump). So, I can compile the project now without extra Keil license.”

It was a long explanation, but I think you can solve your AT+GAPSCAN problem. The whole modified function I zipped and enclosed together with the scree-shot showing the result.

 

Thanks to Dialog for the support.

Good luck and good health!

 

Regards,

Janos N.

 

Attachment: 
sfuentes-digi
Offline
Last seen: 1 year 3 months ago
Joined: 2021-01-18 09:26
Thanks so much for the help.

Thanks so much for the help. Now I can see my devices.

In order to compile I have had to comment more lines within the user_at_command.h, commenting only the two that you indicate increases the size of the program.
I highly appreciate the time you have taken to reply with your message, it was helpful.

Regards.