0

Trying to use BLE Central on a Titano
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Trying to use BLE Central on a Titano

by jasonthenderson on Mon Jul 04, 2022 12:39 am

I am trying to use BLE central on a Titano - unfortunately I cannot get my .ino to compile under Arduino IDE - it complains that it can't find sdkconfig.h which is automatically included by BLEDevice.h. It seems like maybe something is wrong with the Titano/SAMD package that is installed in terms of the ESP32 tools install?

I then did some research to see if CircuitPython was an option for the Titano, but according to this page only BLE Peripheral is supported, and Central is still under development for the Titano - https://learn.adafruit.com/adafruit-pyp ... python-ble

Error in Arduino IDE below:
ESP32_BLE_Arduino\src/BLEDevice.h:10:10: fatal error: sdkconfig.h: No such file or directory
10 | #include "sdkconfig.h"
| ^~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Adafruit PyPortal M4 Titano (SAMD51).


Help would be greatly appreciated, I have been pulling my hair out over this!

jasonthenderson
 
Posts: 23
Joined: Sat Jul 20, 2019 1:12 pm

Re: Trying to use BLE Central on a Titano

by adafruit_support_mike on Tue Jul 05, 2022 9:28 pm

[moved to the CircuitPython forum]

adafruit_support_mike
 
Posts: 64984
Joined: Thu Feb 11, 2010 2:51 pm

Re: Trying to use BLE Central on a Titano

by jasonthenderson on Mon Jul 25, 2022 1:13 am

Any thoughts on this? Super bummed that there doesn’t seem to be any supported way to use Central BLE on Titano…was hoping to control several BLE devices via the Touchscreen.

jasonthenderson
 
Posts: 23
Joined: Sat Jul 20, 2019 1:12 pm

Re: Trying to use BLE Central on a Titano

by adafruit_support_mike on Mon Jul 25, 2022 10:40 pm

The Titano uses a SAMD51 microcontroller, which doesn't have built-in BLE. You need a device like the nRF52840 which has a built-in BLE radio and enough RAM to run the central code to operate as a central device.

adafruit_support_mike
 
Posts: 64984
Joined: Thu Feb 11, 2010 2:51 pm

Re: Trying to use BLE Central on a Titano

by jasonthenderson on Mon Jul 25, 2022 11:14 pm

Hi Mike, but shouldn’t the Esp32 on the Titano be able to do Ble?

The guide here implies that pyportal devices can do Ble… https://learn.adafruit.com/adafruit-pyp ... python-ble

jasonthenderson
 
Posts: 23
Joined: Sat Jul 20, 2019 1:12 pm

Re: Trying to use BLE Central on a Titano

by adafruit_support_mike on Tue Jul 26, 2022 12:01 am

The ESP32 is programmed as a Wifi coprocessor. It can do BLE, but you'd have to reprogram it to provide a useful interface to the SAMD51 while operating as a BLE central.

In practice, it doesn't make much sense to use a BLE central coprocessor unless you've constrained every other part of the system heavily. Otherwise you have to micro-manage almost everything.. deciding when to look for peripherals, choosing the ones to connect, determining the characteristics they use and managing data transfer, etc.

adafruit_support_mike
 
Posts: 64984
Joined: Thu Feb 11, 2010 2:51 pm

Re: Trying to use BLE Central on a Titano

by jasonthenderson on Tue Jul 26, 2022 12:23 am

The scenario I’m trying to enable is creating a display for a pair of 320AH lithium batteries and the solar charger. In this case the peripherals are highly constrained - Ie they are all known to me and they all broadcast Ble, and I’ve used the BLE sniffer to reverse engineer the GATT info I need for the three devices.

I think this is a generally interesting scenario for central - especially in the case of an RV where you want to create a display for your electrical system composed of known BLE capable devices (many are now Ble peripherals)

Do you have any pointers on how to switch the esp32 into the Ble mode?

jasonthenderson
 
Posts: 23
Joined: Sat Jul 20, 2019 1:12 pm

Re: Trying to use BLE Central on a Titano

by danhalbert on Tue Jul 26, 2022 8:11 am

Here is CircuitPython code to switch the AirLift ESP32 into BLE mode: https://github.com/adafruit/Adafruit_Ci ... t/esp32.py
You hold the chip-select pin a certain way while resetting the AirLift. One way is WiFI; the other way is BLE. Then the HCI BLE interface will become available.

I'm not sure if there is a viable Arduino library for doing BLE in this situation. See https://forum.arduino.cc/t/ble-arduino- ... e/893303/3 and probably some other search results about this.

An alternative to this would be not to use a Titano but instead something like a Feather nRF52840 and a large-display TFT FeatherWing, such as https://www.adafruit.com/product/3651. Sadly the TFT display FeatherWing is out of stock, though a display breakout is available: https://www.adafruit.com/product/2050

danhalbert
 
Posts: 3351
Joined: Tue Aug 08, 2017 12:37 pm

Re: Trying to use BLE Central on a Titano

by jasonthenderson on Tue Jul 26, 2022 8:50 pm

Thanks a lot for the pointers Dan! I will see if I can get either of these paths to work.

jasonthenderson
 
Posts: 23
Joined: Sat Jul 20, 2019 1:12 pm

Re: Trying to use BLE Central on a Titano

by jasonthenderson on Tue Jul 26, 2022 8:59 pm

Actually one question - I assume if using ESP32.py I should do something like:

ESP32.reset(2,false)
ESP32.startbluetooth()
//code to run

Is that right?

jasonthenderson
 
Posts: 23
Joined: Sat Jul 20, 2019 1:12 pm

Re: Trying to use BLE Central on a Titano

by danhalbert on Tue Jul 26, 2022 10:19 pm

Code: Select all | TOGGLE FULL SIZE
ESP32.reset(2,false)
ESP32.startbluetooth()
//code to run

You do not need to call `ESP32.reset()` yourself. `ESP32.start_bluetooth()` does that for you.

danhalbert
 
Posts: 3351
Joined: Tue Aug 08, 2017 12:37 pm

Please be positive and constructive with your questions and comments.