2023-05-17 02:53 AM
Hi everyone,
I am developing an IOT solution using the BLUENRG-M0 from ST.
I am coding in C and I use a custom board with SPI communication between the BLUENRG and my MSP430F5255 from T.I . I am using the ACI API to transmit commands to the BLE module.
I have 2 boards, and while one is advertising, I want the other to perform scanning in order to receive an advertising report. (And to get the RSSI after).
My issue is when I want to make another scan. I use the aci_gap_terminate_gap_procedure() with the good opcode link to the function that I use for scanning, but I always receive a BLE_Timeout error. Therefore my primary scan has not ended correctly and I can’t begin a new one.
I have tried increasing the time before TIMEOUT but nothing changes.
I didn’t see people talking about the issue with the gap_terminate function, so I ask this here.
It would be nice if someone could clarify for me the use of this function and why it has this behavior.
Best regards.
2023-05-23 12:09 AM
Update: To simplify my ask, I just want a solution to produce multiple scans. When I scan a second time with the discovery function, I got an error so maybe I have to do something before.
2023-06-01 07:20 PM
Was the radio still busying?
Maybe try to set a smaller Scan window in the first scanning.
2023-06-01 11:21 PM
I have checked the radio with the aci_hal_get_link_status() and all the 8 channel are set to 0 when I call the terminate function.
I have also tried a shorter first scan but the aci_gap_terminate_gap_proc() still return me a timeout status.
2023-06-01 11:38 PM
>I have checked the radio with the aci_hal_get_link_status() and all the 8 channel are set to 0
It means the links are all idling.
> the aci_gap_terminate_gap_proc() still return me a timeout status
It is expected.
The ACI is to terminate some on-going GAP procedure. The request would time out because it could not find the corresponding procedure to terminate. This is true since all links were idling already.
In your case, the GAP termination does not seem to be needed.
I think the following scanning shall succeed.
2023-06-01 11:45 PM
>I think the following scanning shall succeed.
That was my thinking too, but when I call a second time the aci_gap_start_general_discovery_proc(), it returns me also a Timeout status.
2023-06-04 08:13 PM
This sounds ok in case it did not discover a new device.
When the discovery procedure was done, it would generate an ACI_GAP_PROC_COMPLETE_EVENT.
This could be a confirmation that your device worked normally.
Please test again with duplicate filtering disabled when calling aci_gap_start_general_discovery_proc(), and you would see a lot of duplicated reports.
2023-06-04 11:28 PM
I've tested the ACI_GAP_PROC_COMPLETE_EVENT call, and there are none when I run a scan.
Do you agree that there should be some to signify the end of the scan procedure?
>Please test again with duplicate filtering disabled when calling aci_gap_start_general_discovery_proc(), and you would see a lot of duplicated reports.
I did this but it changes nothing and I don't see duplicates. The only scan that works is the aci_gap_start_selective_conn_establish_proc(), but it's not usable in my case, as I have to do without whitelist.
Still, I get the impression that scanner behavior is not good. However, I'm doing the initialization just right and I'm managing to do some advertising. But I still get the same number of advertising reports whether I enable or disable duplicates.
2023-06-05 12:13 AM
Do you have any examples of code implementing a scanner? So I can check if I'm doing things right.
I've looked on github but there are mostly examples of advertising+connexion and often the scanner part is reduced to using the androit ST BLE application.
2023-06-05 10:45 PM
> Do you agree that there should be some to signify the end of the scan procedure?
Agree, and as far as i understand ACI_GAP_PROC_COMPLETE_EVENT would be that event when the procedure is completed.
>The only scan that works is the aci_gap_start_selective_conn_establish_proc(),
This is strange. I don't see differences between these scanning methods, since the radio was actually idling.
Maybe there are more clues from the sample projects.
Please check STSW-BLUENRG-DK:
https://www.st.com/en/embedded-software/stsw-bluenrg-dk.html
and X-CUBE-BLE1: