Can the NANO IOT 33 run Full Bluetooth (NOT BLE)?

Thanks Juraj it is very good information.

Can someone post a step by step guide to do this and maybe an example sketch to prove that it works?

drhalftone:
Can someone post a step by step guide to do this and maybe an example sketch to prove that it works?

Step by step instructions (and working code) is posted above...

Read and follow the post by danielkopiec.

So here is where I am at. I set up the Arduino IDE for the ESP32 following the directions above. I then loaded the SerialtoSerialBT example and compiled it to a bin file. I placed this bin file in the same directory as my esptool.exe (on Windows). I then opened the SerialNINAPassthrough sketch and compiled and loaded the sketch onto my NANO 33 IOT. While it was running, I ran the following command line:

esptool --port com3 write_flash -fm dout 0x00000 SerialToSerialBT.ino.esp32.bin

Now notice that the instructions for setting up the Arduino IDE for the ESP32 was not written in English. So I didn't know what the setting is for "Core Debug Level", so I left it as "NONE." So then I unplugged the board and replugged it in. And then I ran the SerialPassthrough sketch compiled for and run on the NANO 33 IOT as:

void setup() {
pinMode(NINA_RESETN, OUTPUT);
digitalWrite(NINA_RESETN, HIGH);
Serial.begin(115200);
SerialNina.begin(115200);
}

void loop() {
if (Serial.available()) { // If anything comes in Serial (USB),
SerialNina.write(Serial.read()); // read it and send it out Serial1 (pins 0 & 1)
}

if (SerialNina.available()) { // If anything comes in Serial1 (pins 0 & 1)
Serial.write(SerialNina.read()); // read it and send it out Serial (USB)
}
}

And then when it starts up, I immediately see a never ending stream of the following message:

rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57

Any help would be greatly appreciated.

More info to help diagnose my issue. I did download a version of the NINAWIFI firmware in bin format. And I successfully used the Serialpassthrough sketch along with the esptool, and it worked. I ran the firmware check sketch and saw the correct firmware version. So I have total faith in the process for reprogramming the ESP32. The issue really seems to come down to how the SerialToSerialBT project is compiled for the ESP32.

Is there any chance that the compiler settings need to be changed when using the esptool to program the board with passthrough?

Juraj gave me the needed guidance to get this working without soldering to the ESP32 chip. So first, I set the Arduino IDE for programming the NANO 33 IOT. I opened the SerialNINAPassthrough sketch; compiled it; and then uploaded it to the NANO 33 IOT using the COM3 port (which is the recognized port for the NANO 33 IOT). I then going changed the device in the Arduino IDE to target the SAMD ESP32 device as described by danielkopiec above. I then opened the SerialToSerialBT sketch; compiled it; and used the "upload" bin functionality of the Arduino IDE. This caused the Arduino IDE to upload the bin file to COM3. What I understand from Juraj, this upload to the "ESP32" on the COM3 port was recognized by the NANO 33 IOT to be passed through to the ESP32 and not reprogram the NANO 33 IOT itself. After this, I then set the Arduino IDE to again target the NANO 33 IOT and ran the SerialPassthrough sketch described by danielkopiec, which after compiling and uploading caused the NANO 33 IOT to show up as a Bluetooth device in the Windows 10 Bluetooth control panel.

I am very happy that I did all of this without soldering and only because of the help I received from this group.

Thanks everyone.

1 Like

so super simple. I wondered when I read about soldering in this thread.

the esp32 Arduino upload is done withe esptool. the SAMD requires a 1200 baud 'touch' to reset to bootloader. esptool doesn't do it. so the SAMD will only relay the data to the esp32 as when you used the esptool from command line.

I don't have a NINA board, but I have the first Uno WiFi with 328p and esp8266 and the esp8266 there is too accessible only over the ATmega with a similar passthrough sketch which resets the esp8266 into flashing mode.

(If I want to test the WiFiNINA library I wire together a MKR Zero or Nano Every with an esp32 dev board.)

I got the connection to work following drhalftone’s instructions, but it seems I can’t quite get the data that is transmitted over bluetooth.

I am running a terminal app on my mobile. If I type in any text into the arduino serial monitor and press enter, the mobile receives and displays is.

If, however, I send a text from the mobile terminal, the arduino logs the following to serial:

[V][BluetoothSerial.cpp:275] esp_spp_cb(): ESP_SPP_DATA_IND_EVT len=6 handle=129

len is the lenght of the string I send +2 (which I assume is a line break; it works consistently with different texts.)

I have been trying different variants of

if (SerialNina.available()) {
     Serial.write(SerialNina.read());
}

same result. So how can I get to the actual content of the message? Where should I be looking for that kind of information? Googling has failed me, unfortunately. I can’t even seem to find documentation for SerialNina.

Good day

I have been looking at this topic for a few days now and I don't quit follow the procedure, I am new to Arduino and bought the Nano 33 IOT specifically to pair it to a phone via std bluetooth.

I can see you all manage to flash it (without soldering), but I can't seem to figure it out.

Is there anyway to list the steps via the IDE in beginners code?

I am also not sure how you guys are interfacing to it (Bluetooth name and pin).

I have gone through the HC-05 examples and it seems that you do not need any code pushed to the Arduino to connect to the bluetooth once you have set the HC-05 up via terminal.

Any help would be great.

tommy_pap:
.. bought the Nano 33 IOT specifically to pair it to a phone via std bluetooth.

May I ask why? Its not like pairing would make them both happier. :slight_smile: Your app can connect to the Arduino and read/write characteristics.

Maybe what you want can be achieved in another way.

I can’t seem to get this to work on my Arduino UNO WiFi Rev.2. Here are the steps I took:

Connect to the UNO WiFi like normal and upload the SerialNINAPassthrough sketch.

Change the board to the u-blox NINA-W10 Series (E32) board with 115200 baud.

Upload the SerialToSerialBT example sketch with a jumper from 0->RX pin to GND and holding reset when “Connecting…” comes up as danielkopiec said. I also tried with combinations of no jumper and not holding reset as well.

I get this error every time I try to upload:

Arduino: 1.8.13 (Windows 10), Board: "u-blox NINA-W10 series (ESP32), 115200"

Sketch uses 864187 bytes (65%) of program storage space. Maximum is 1310720 bytes.

Global variables use 36112 bytes (11%) of dynamic memory, leaving 291568 bytes for local variables. Maximum is 327680 bytes.

C:\Users\Aidan\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\2.6.1/esptool.exe --chip esp32 --port COM6 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0xe000 C:\Users\Aidan\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/partitions/boot_app0.bin 0x1000 C:\Users\Aidan\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/bin/bootloader_dio_40m.bin 0x10000 C:\Users\Aidan\AppData\Local\Temp\arduino_build_250317/SerialToSerialBT.ino.bin 0x8000 C:\Users\Aidan\AppData\Local\Temp\arduino_build_250317/SerialToSerialBT.ino.partitions.bin 

esptool.py v2.6

Serial port COM6

Connecting......

Traceback (most recent call last):

 File "esptool.py", line 2959, in <module>

 File "esptool.py", line 2952, in _main

 File "esptool.py", line 2653, in main

 File "esptool.py", line 460, in connect

 File "esptool.py", line 440, in _connect_attempt

 File "esptool.py", line 379, in sync

 File "esptool.py", line 322, in command

 File "esptool.py", line 285, in write

 File "site-packages\serial\serialwin32.py", line 323, in write

serial.serialutil.SerialTimeoutException: Write timeout

Failed to execute script esptool

An error occurred while uploading the sketch.

aidanthewiz:
I can’t seem to get this to work on my Arduino UNO WiFi Rev.2. Here are the steps I took:

Connect to the UNO WiFi like normal and upload the SerialNINAPassthrough sketch.

Change the board to the u-blox NINA-W10 Series (E32) board with 115200 baud.

Upload the SerialToSerialBT example sketch with a jumper from 0->RX pin to GND and holding reset when “Connecting…” comes up as danielkopiec said. I also tried with combinations of no jumper and not holding reset as well.

I get this error every time I try to upload:

Arduino: 1.8.13 (Windows 10), Board: "u-blox NINA-W10 series (ESP32), 115200"

Sketch uses 864187 bytes (65%) of program storage space. Maximum is 1310720 bytes.

Global variables use 36112 bytes (11%) of dynamic memory, leaving 291568 bytes for local variables. Maximum is 327680 bytes.

C:\Users\Aidan\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\2.6.1/esptool.exe --chip esp32 --port COM6 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0xe000 C:\Users\Aidan\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/partitions/boot_app0.bin 0x1000 C:\Users\Aidan\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/bin/bootloader_dio_40m.bin 0x10000 C:\Users\Aidan\AppData\Local\Temp\arduino_build_250317/SerialToSerialBT.ino.bin 0x8000 C:\Users\Aidan\AppData\Local\Temp\arduino_build_250317/SerialToSerialBT.ino.partitions.bin

esptool.py v2.6

Serial port COM6

Connecting…

Traceback (most recent call last):

File “esptool.py”, line 2959, in

File “esptool.py”, line 2952, in _main

File “esptool.py”, line 2653, in main

File “esptool.py”, line 460, in connect

File “esptool.py”, line 440, in _connect_attempt

File “esptool.py”, line 379, in sync

File “esptool.py”, line 322, in command

File “esptool.py”, line 285, in write

File “site-packages\serial\serialwin32.py”, line 323, in write

serial.serialutil.SerialTimeoutException: Write timeout

Failed to execute script esptool

An error occurred while uploading the sketch.

do nothing with io 0 and reset. the SerialNINAPassthrough sketch does reset NINA into programming mode

Juraj:
do nothing with io 0 and reset. the SerialNINAPassthrough sketch does reset NINA into programming mode

I get the same thing, I flash the SerialNINAPassthrough sketch and then switch board config to u-blox NINA-W10 Series (E32) and try to upload SerialToSerialBT and it gives:

serial.serialutil.SerialTimeoutException: Write timeout
Failed to execute script esptool

One thing I do notice is that when it says "Connecting......" The Arduino's LED blinked 3 times but still fails.

it is possible that on Uno WiFi the esptool can't reset the AVR MCU, because it is behind the programmer chip.
try to reset the board with reset button before uploading with esptool. (the SerialNINAPassthrough sketch in AVR puts NINA in programming mode in setup()).

Tried it a few times, did not seem to work. I also reflashed the latest NINA firmware and uploaded the SerialNINAPassthrough sketch successfully, but the SerialToSetialBT upload using esptool does not seem to want to work for some reason, I continue to get the Write Timeout.

I selected the "u-blox NINA-W10 Series (E32)" ESP32 board because it matches up with what the Arduino UNO WiFi Rev.2 has, is this correct, maybe it has something to do with the board configuration?

did you set the upload baudrate for SerialToSetialBT upload in IDE to 115200 used in SerialNINAPassthrough?

Juraj:
did you set the upload baudrate for SerialToSetialBT in IDE to 115200 used in SerialNINAPassthrough?

Yes, I did, baud is the same between everything.

Does the esp32 .bin file have to be built through the Arduino IDE? I have a project that is a MKRZERO connected to
an esp32 which is running a bluetooth classic application. I'd love to simplify my project by replacing the whole
thing with a Nano33IOT. I developed the esp32 app using esp32-idf and it includes btstack (for HID and BT classic) so its best if I keep it in that environment. But it seems like I should be able to download the resulting bin file to the NINA using the SerialNinaPassthrough.ino method? Or am I missing something?

tozz88:
Does the esp32 .bin file have to be built through the Arduino IDE? I have a project that is a MKRZERO connected to
an esp32 which is running a bluetooth classic application. I'd love to simplify my project by replacing the whole
thing with a Nano33IOT. I developed the esp32 app using esp32-idf and it includes btstack (for HID and BT classic) so its best if I keep it in that environment. But it seems like I should be able to download the resulting bin file to the NINA using the SerialNinaPassthrough.ino method? Or am I missing something?

yes. the NINA esp32 module on NINA boards is flashable over SerialNinaPassthrough

In order to use .bin files built with the esp-idf you must do one of two things as explained in the programming
guide:

if using esp-idf version 4 (e.g. 4.1) you need to set spi flash driver to “compatibility mode”

cd
idf.py menuconfig
Component config → SPI Flash driver → Use the legacy implementation before IDF 4.0
Save
Quit
idf.py build

The other option is to specifically use version 3.3.1 of the esp-idf. If this is what you need follow the
instructions in the manual above.

Without this little fix you get either abort or ASSERT Can’t find spi flash size errors.

Hope this helps