Go Down

Topic: Can the NANO IOT 33 run Full Bluetooth (NOT BLE)? (Read 4642 times) previous topic - next topic

MadCompSci

I am hooking up a GPS receiver to my Nano 33 IOT and I need it to broadcast the data on Bluetooth so I can pick it up on an Android device that does not have GPS.  The Android device can run software that will make the BT data look like it's an installed GPS device.

From what I am seeing, the ESP32 chip is fully capable of Standard Bluetooth but the Nano IOT doesn't configure this out of the box and the ArduinoBLE library only supports BLE.

Is there, is someone working on, or is there a reasonable approach to getting the Nano 33 IOT to get its ESP32 chip to communicate standard BT?

tbaumg

I am interested in the same thing.  From what I can tell the Nano IoT is based on the U-Blox NINA-W102 and according to the data sheet it supports Bluetooth v4.2 (Bluetooth BR/EDR and Bluetooth low energy) communications.

Data sheet here:
https://www.u-blox.com/sites/default/files/NINA-W10_DataSheet_%28UBX-17065507%29.pdf

So as I understand it the hardware is capable of both, but the current 'released' libraries only support BLE.  I don't have a lot of time but I'd be interested in helping/testing/contributing to the development of the library if anyone else is working on it.




danielkopiec

Hi guys,

is possible to make BT Classic with IoT33, but the programmingo of NINA W102 module is neded. Tests pad on the bottom side of IoT33 are usefull for programming what you want.  
Nina W102 is compatible with ESP32 DEV module. If you want I can made some tutorialhow to do.

tbaumg

I'd love to see a tutorial if you have one (or can make one).

danielkopiec

I don't have it, yet. Today I finished making experiments and successfully programming NINA W102 and Iot 33 as a standard Bluetooth. In the next post I will send a step by step instructions how to do.

tbaumg


danielkopiec

#6
Mar 09, 2020, 06:45 pm Last Edit: Mar 09, 2020, 10:16 pm by danielkopiec
The Arduino IoT33 is very intresting module. On one small PCB are integrated Cortex M0 SAMD21 microcontroller and communication module NINA W102. In originnal version of ARDUINO NANO IoT33 standard serial Blueotooth is not supported but only BLE (Low Enegy). This is no limited by hardware but only by the software implemented in NINA module.
When I carefully read the datasheet of NINA 102, I've realized that the module is based on ESP32 processor and when I've diged on the web I found the information that it is compatible with ESP32 Dev Module in Arduino IDE.

https://www.u-blox.com/sites/default/files/NINA-W10_DataSheet_%28UBX-17065507%29.pdf

https://www.u-blox.com/sites/default/files/NINA-W1_SIM_%28UBX-17005730%29_1.pdf

From datasheet: „It is possible to use Arduino electronics platform on the NINA-W10. The Arduino platform and open source community provides the possibility to accessa lot of third party hardware such as displays and sensors." - good news  :)

Let's start:

1. First, the ESP32 module should be added to Arduino IDE, please do it according to instructions publicated here:

https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/

If you do not have installed Arduino Nano IoT33 in your Arduino IDE please find it in board manager and install.

2. The Arduino NANO IoT33 board is very good designed, tests point of serial Communications with NINA 102 module are led out on the bottom side.

The Eagle Project of it is possible to download from the link below:

https://download.kamami.pl/p576016-Nano33IoT.zip



When you localized all test points, you should connect it for any serial converter to TX and RX line. In my case I used standard CH340  chip, USB to serial converter. The GPIO 0 line should be connected to GND but only for programming (using a switch is good idea).

a) Programming the ESP32 (NINA W102) with Arduino:
From Tools select board: ESP32 DEV MODULE
Rest of settings are here:



As a Communications port you should select the external serial port connected to test points, is not a serial port of Arduino IoT

b) Software for NINA W102
For making a test I suggest using a code from the side listed below:

https://randomnerdtutorials.com/esp32-bluetooth-classic-arduino-ide/

c) Programming
From Arduino IDE please select „load program" and when you see in the window … connecting:



• PUSH and HOLD RESET on the Arduino NANO IoT33 board
• Connect GPIO 0 to GND all the time

After about 90 seconds the programming is done …. and you can release the RESET and GPIO 0



d) Checking the results of programming

• run from ARDUINO IDE ->TOOLS -> Serial Port Monitor
• PUSH and HOLD RESET on the Arduino NANO IoT33 board

To start NINA module is nedded to push and hold RESET button of IoT33 board becasue the RESET pin of NINA 102 module is controlled directly by CORTEX M0 chip. But in the next part of this tutorial I show you how to program Cortex for cooperation with NINA. On the Serial Port Monitor you should see several messages from ESP32 (NINA) bootloader and from program:
The device started, now you can pair it with bluetooth!
And now is possible to pair BT device „ESP32test" with phone or computer and test it.

3. IoT33 programming to communicate with NINA W102

On this site:

https://github.com/arduino/ArduinoCore-samd/blob/master/variants/nano_33_iot/variant.cpp

I found some information about pin maps and internal connection between CORTEX M0 and NINA W102.
The next step is a programming CORTEX M0 chip and send data to NINA W102 module.
From Arduino IDE please select Arduino NANO IoT33 compile and load program as below.

Code: [Select]
void setup() {

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

void loop() {

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

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


After successfully programming you can pair with BT device as a serial communication device and read the data sending from CORTEX M0 to NINA W102.

Guys, I know that the tutorial is not a perfect but together we can improve it.
Good luck :)



tbaumg

This is awesome!  Well done!  I'll go thru it step by step and note anything I find. 

Thank again!

tbaumg

I went through this process a couple of times and it worked well, I didn't have any significant problems!   

I did discover that when updating the NINA W102 you only need to hold the reset button down for a few seconds (until it starts updating), it will still finish correctly after a minute or so.  Then I disconnect the GPIO 0 pin (from GND) and I cycled power to the whole board to make sure the changes took.

I updated one of my Nano IoT's to run BT4 classic and it seems to be working well (so far).  I also increased the baud rates to 1Mbps (SerialNina.begin(1000000)).  Next, I will test streaming large amounts of data at high rates.

Thanks for your help and creating this tutorial, I'm sure this will help others in the future as well!

Juraj

you can flash NINA over the SAMD with SerialNINAPassthrough.ino sketh of WifiNINA library

danielkopiec


drhalftone

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

tbaumg

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.

drhalftone

#13
May 01, 2020, 03:28 am Last Edit: May 01, 2020, 04:00 am by drhalftone
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.

drhalftone

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?

Go Up