Please note: Friday June 18 is a holiday celebrating Juneteenth, please allow extra time for your order to arrive and plan accordingly.
0

Not working : Bluetooth with Arduino nano RP2040 connect
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Not working : Bluetooth with Arduino nano RP2040 connect

by Bob_FR on Wed May 26, 2021 4:49 pm

Hello,
I have been trying for a few days to use the bluetooth of the Arduino nano RP2040. This is integrated into the NINA-W102-00B chip.
I can use it in wifi, I use adafruit_airlift and it works fine.

Then for bluetooth: adafruit_ble
But I can't achieve anything! Yet I followed https://learn.adafruit.com/quickstart-r ... cuitpython

The reason ?
The UART pins of Bluetooth are shared with that of the SPI of ESP32: CS and MISO (I believe).
(SPI1_CS/UART1_RX on CS and UART-RX, SPI1_CIPO/UART1_TX on MISO ans UART-TX)
Code: Select all | TOGGLE FULL SIZE
esp32 = ESP32 (
    reset = board.ESP_RESET,
    gpio0 = board.ESP_GPIO0,
    busy = board.ESP_BUSY,
    chip_select = board.CS1,
    tx = board.CS1,
    rx = board.MISO1
)


Send me back:
ValueError: ESP_CS in use

Or
Code: Select all | TOGGLE FULL SIZE
import board
from adafruit_airlift.esp32 import ESP32

esp32 = ESP32 (
    reset = board.ESP_RESET,
    gpio0 = board.ESP_GPIO0,
    busy = board.ESP_BUSY,
    chip_select = board.CS1,
    tx = board.SDA, # A2 A4 D0 D4 SDA, TX
    rx = board.SCL # a3 A5 D1 D5 SCL, RX
)
adapter = esp32.start_bluetooth ()
Mistake
    tx = board.SDA,
    rx = board.SCL


And with
Code: Select all | TOGGLE FULL SIZE
esp32 = ESP32(
    reset=board.ESP_RESET,
    gpio0=board.ESP_GPIO0,
    busy=board.ESP_BUSY,
    chip_select=board.CS1,
    tx=board.TX,
    rx=board.RX
)


I have :
_bleio.BluetoothError: Timeout waiting for HCI response

I use
Adafruit CircuitPython 6.3.0-rc.0 on 2021-05-25; Arduino Nano RP2040 Connect with rp2040

Hope you can help me,I've tried everything and I'm desperate (well almost;)

thanks in advance
Bob
Attachments
2021-05-26 22_40_08-Photos.png
2021-05-26 22_40_08-Photos.png (255.06 KiB) Viewed 246 times

Bob_FR
 
Posts: 3
Joined: Wed May 26, 2021 4:03 pm

Re: Not working : Bluetooth with Arduino nano RP2040 connect

by danhalbert on Wed Jun 09, 2021 2:56 pm

Does the Arduino code that supports the uBlox module communicate via UART or SPI?

We don't have one of these to try yet. We have also only tested our HCI _bleio support with the Adafruit version of nina-wifi.

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

Re: Not working : Bluetooth with Arduino nano RP2040 connect

by Bob_FR on Wed Jun 09, 2021 4:07 pm

Thanks for your reply.
It uses SPI protocol to communicate with u-blox NiNa.

But, we also need uart port for BT communication and, D9 port from RP2040 is uses both for CS and TX.
I think that's where the problem comes from.

rtk

Bob_FR
 
Posts: 3
Joined: Wed May 26, 2021 4:03 pm

Re: Not working : Bluetooth with Arduino nano RP2040 connect

by danhalbert on Wed Jun 09, 2021 5:06 pm

[Deleted my previous response, which was wrong]

It looks like the startup code shares that GPIO5 (ESP_CS) and GPIO3 (TX) on the uBlox module because GPIO5 is only needed when booting up, to choose between WiFi and BLE. You could modify `adafruit_airlift` to allow that: there's nothing sacred about that library. Whether it would work I don't know.

There are many peculiarities of this board, including providing some analog I/O via the ESP32 pins. We haven't tested it. If you want to use CircuitPython and BLE, using one of our supported boards will save further hair pulling.

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

Re: Not working : Bluetooth with Arduino nano RP2040 connect

by Bob_FR on Fri Jun 11, 2021 3:37 am

You know I don't have much hair on my head anymore. :)

I got the idea.
i will try to edit wifinina next week.

Indeed, the use of esp32 to extend the number of ports is surprising. In addition to the analog ports, there is an RGB led which is connected to the wifi circuit.
I'll try to blink it.
I looked at the Arduino source code, pinout and digitalwrite refer to the wifinina library, so to blink this led, the code is identical to any other I/O. The magic of the Arduino language !!!

Thanks again, I'll keep you posted

Bob_FR
 
Posts: 3
Joined: Wed May 26, 2021 4:03 pm

Re: Not working : Bluetooth with Arduino nano RP2040 connect

by danhalbert on Sat Jun 12, 2021 11:21 pm

I've documented this problem here: https://github.com/adafruit/Adafruit_Ci ... t/issues/3.

I've also ordered an Arduino Nano RP2040 Connect to at least have it around to test.

Someone on staff noted that the NINA-wifi currently in the module is missing some root certificates

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

Please be positive and constructive with your questions and comments.