BLE Scanner



  • We're trying to implement a BLE Scanner with the WiPy 2.0 but we are not receiving all the expected beacon data.
    We've read that the advertising data is stored in a FIFO and that it only stores 8 elements. If we are surrounded by lots of beacons, it's possible that we're missing lots of data, right?
    Couldn't this limit of 8 be raised? Or at least provide a way of filtering the advertising data that's stored in the FIFO?
    Has anyone been working with beacons and WiPy and can point us in the right direction?



  • @jmarcelino Thanks! We have managed to flash the board and seems to work better now, but I think that we're still missing some data.
    The 32 for the queue... could be raised without problem or it would be risky?



  • @spicado
    Setting up the board for custom firmware is exactly the same as the firmware upgrade process, except it doesn't use the Firmware Upgrade app.

    1. Remove power (or USB)
    2. Connect P2 to GND
    3. Re-connect power

    ... the board should be ready to flash with the make ... flash command. The LED will not be on or blinking. If LED is still on for some reason try pressing the small reset button.

    Once the make flash is complete remove the P2 to GND connection and press the reset button (or cycle power)



  • @livius said in BLE Scanner:

    @spicado
    look at doc - P2 is for programing mode (Low Level Bootloader)
    https://www.pycom.io/wp-content/uploads/2016/11/wipy_pinout.pdf

    And should the led be in any color or just off? We're trying to flash the modified files as described in the doc, and it says that the board must be in programming mode:
    Make sure that your board is placed into programming mode, otherwise flahing will fail. To do this, connect P2 to GND and then reset the board.



  • @spicado
    look at doc - P2 is for programing mode (Low Level Bootloader)
    https://www.pycom.io/wp-content/uploads/2016/11/wipy_pinout.pdf



  • @jmarcelino Do you know in the WiPy 2.0 which is the P2 pin?
    I think that's the G23 pin, with the GND to enter programming mode, but I'm not sure as the led is not blinking...



  • @spicado
    Sure, go to https://github.com/pycom/pycom-micropython
    And follow the section titled "The ESP32 version"



  • @jmarcelino Sounds promising...
    Could you guide me on how to make those changes (don't know where the sources are), how to recompile and flash?



  • This post is deleted!


  • I suspect we have to tune the stack ourselves to improve BLE scanning performance. Given the way the BT stack is structured at the moment it's difficult to be good at everything, from scanner, peripheral, central...

    I managed to get more advertisements by changing modbt.c in the pycom-micropython/esp32/mods namely:

    #define BT_SCAN_QUEUE_SIZE_MAX (8)
    changed to
    #define BT_SCAN_QUEUE_SIZE_MAX (32)

    and changed the scan type from ACTIVE to PASSIVE

    static esp_ble_scan_params_t ble_scan_params = {
        .scan_type              = BLE_SCAN_TYPE_ACTIVE,
    

    to

    static esp_ble_scan_params_t ble_scan_params = {
        .scan_type              = BLE_SCAN_TYPE_PASSIVE,
    

    Once those were in I recompiled and flashed my LoPy (same for WiPy)

    This is not well tested and YMMV.


Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.