I got my introduction to using Classic Bluetooth Serial Port Protocol (SPP) on the Nano 33 Iot here:
That thread ended up having a lot of conflicting and confusing posts, but I found a better summary of the process here:
Basically somebody decided not to expose the Classic Bluetooth functionality of the ESP32 chip on the Nano 33 Iot (or any of the other Arduino devices, for that matter), so the chip has to be re-programmed. The above posts describe the process. I was able to do this successfully such that I can pair with the Nano from Windows. However, what I really need to do is put the Nano in the role of master so that I can pair it with a Bluetooth GPS receiver. So far, I've been unable to get the devices to pair and I'm not getting enough feedback from the Bluetooth code to understand why. The documentation for the Arduino-ESP32 Bluetooth libraries is pretty dismal. For example, I can register a number of callback functions but it's not clear what the purpose of said callbacks is or how to interpret the parameters that are being passed in the callbacks. What I'm wondering at this point is if it's possible to re-compile the Arduino-ESP32 Bluetooth libraries (found here: https://github.com/espressif/arduino-esp32/tree/master/libraries/BluetoothSerial/src) and link the re-compiled libraries into the code for the ESP-32. Has anyone done this? Would like to add additional debug code to the libraries so I can understand why the devices aren't pairing/connecting correctly.
BTW, seems to me a bit of false advertising for Arduino to suggest that the devices are Classic Bluetooth ready when clearly they are not.
Yes, I definitely agree with you there. I've been trying to sort out this issue for weeks now, and Arduino (the company) has not been helpful in the least.
As to your issue: I'm not familiar enough with master/slave configuring in BT to advise on this. However, I have found there is a Classic Bluetooth bandwidth problem on the Nano 33 IoT. Even once you get Classic BT to work, the ability to send anything but miniscule amounts of data is not possible. The issue is so bad that if there is not a prolonged enough delay within the Nano 33 IoT sketch, the Nano will not connect with the device it is previously paired to.
To be explicit, I am connecting the Nano 33 IoT with my Android phone, and using a SerialBluetooth app which allows it to receive information from the Nano. Once I install the 'SerialToSerialBT.ino' on the W102 (ESP32), I can pair the Nano with my phone. But once a sketch is installed on the Nano (not the W102, but the Nano 'itself'), the BT will disappear, UNLESS a significant 'delay(XXX)'; is added. This issue might be linked with the problem you are experiecing.
This delay will depend on the sketch, but usually a 'delay(250)' is sufficient for a barebone sketch. What you can actually do then with such a handicap is another story...
Thanks lepetitrenard! I've given up on Classic Bluetooth and moved on to other solutions. However, all this meddling with the Esp32 seems to have broken the WiFi capability of the Nano 33 Iot. When I call WiFi.status() I get WL_NO_MODULE as the result. Any idea how to restore my Nano?
No worries, and only wish I could've been more helpful with the above
Here is how you can restore the Nano. I preface this by saying I haven't yet tested the BLE/WiFi since doing this, but this should restore everything:
Connect the Nano 33 IoT to your computer, and select the correct port in the Arduino IDE. The board selection should be "Arduino Nano 33 IoT".
Open the 'FirmwareUpdate.ino' by going to File >> Examples >> WiFiNina >> Tools >> 'FirmwareUpdate.ino'
2b) If you do not have this example, you must go to your boards manager and install the WiFiNina library first
Upload this sketch to the Nano 33 IoT
Go to Tools >> 'WiFi101 / WiFiNINA Firmware Updater'
Under section '1.' select the correct port for your Nano 33 IoT, under section '2.' choose the firmware (probably the latest) then select 'Update Firmware'
Let me know if this works. I did have an issue the first time I ran it where it lost the connection with the Nano 33 IoT, but I just retried it and it works flawless. There is this link in case you find my directions confusing