Problem with Nano ESP32 and I2S code

I've tried several available sketches using the I2S audio protocol, for example, for a simple internet radio. None of them work with the Arduino Nano ESP32 processor and the Adafruit MAX98357 audio board. However, when I use another ESP32 processor like the ESP32 WROOM DA, all the sketches work without problems.

Is there something I'm missing in implementing I2S with the Arduino Nano ESP32?

Welcome to the forum

To summarise, you have code that works with an ESP32 WROOM module but not with the Nano Arduino ESP32

That raises the obvious question as to exactly which ESP32 module is in the Nano ESP32 and which board have you got selected in the IDE

The answer to the first question is easy, it is that the Nano ESP32 has the ESP32-S3 processor in it so there is an obvious difference

Which board have you got selected in the IDE when using the Nano ESP32 ?

The board I have selected in the IDE is the "Arduino Nano ESP32". When I mouse over this selection a tooltip appears with "arduino:esp32:nano_nora". I will also add that other sketches not using I2S run okay.

There are some I2S Examples

File
  Examples
    I2S
      SimpleTone

I assume that nothing there works out either ?
And it's not a matter of PinNumbering "by Arduino" vs "by GPIO" ?

( Here, someone with a NanoESP32 has posted in 'Hardware' -- cf. people with non-Nano (viz. wroom etc) almost always post in NanoESP32. How to fix this? )

I've tried several available sketches using the I2S audio protocol, for example, for a simple internet radio. None of them work with the Arduino Nano ESP32 processor and the Adafruit MAX98357 audio board. However, when I use another ESP32 processor like the ESP32 WROOM DA, all the sketches work without problems.

Is there something I'm missing in implementing I2S with the Arduino Nano ESP32?

Thanks for your response. I've followed your final suggestion and reposted my question on the Hardware>Nano Family>Nano ESP32 section.

Duplicate topics merged

in re. Post No.4 - "No Joy" with the Examples (i.e. SimpleTone) then ?

Yes, "Joy" with Simple Tone, still "No Joy" with the internet radio sketch.

Simple Tone includes the I2S.h library, the radio sketch does not, but includes:

#include "Arduino.h"
#include "WiFi.h"
#include "Audio.h"

When I add the I2S.h library, I get the following compile error:

"Multiple libraries were found for "SD.h"

Thoughts?

There's more than one SD.h version in your libraries folder/s.

This may be similar issue / related to --

That is not necessarily an error as the compiler will attempt to resolve the problem

Please post the full message

1 Like

Here are the complete error messages:

In file included from C:\Users\Owner\Favorites\Electronics\Arduino\ESP32\I2S\Internet Radio\esp32-i2s-simple-radio_1-0.ino\esp32-i2s-simple-radio_1-0.ino.ino:16:
C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\esp32\2.0.13\libraries\I2S\src/I2S.h:61:3: error: conflicting declaration 'typedef enum i2s_mode_t i2s_mode_t'
} i2s_mode_t;
^~~~~~~~~~
In file included from C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\esp32\2.0.13/tools/sdk/esp32s3/include/driver/include/driver/i2s.h:16,
from c:\Users\Owner\Favorites\Electronics\Arduino\libraries\ESP32-audioI2S\src/Audio.h:29,
from C:\Users\Owner\Favorites\Electronics\Arduino\ESP32\I2S\Internet Radio\esp32-i2s-simple-radio_1-0.ino\esp32-i2s-simple-radio_1-0.ino.ino:15:
C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\esp32\2.0.13/tools/sdk/esp32s3/include/hal/include/hal/i2s_types.h:127:3: note: previous declaration as 'typedef enum i2s_mode_t i2s_mode_t'
} i2s_mode_t;
^~~~~~~~~~
Multiple libraries were found for "SD.h"
Used: C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\esp32\2.0.13\libraries\SD
Not used: C:\Users\Owner\AppData\Local\Arduino15\libraries\SD
exit status 1

Compilation error: exit status 1

Read the error msg, it is trying to tell you the problem. It is likely brought on by the migration to 3.x. Just eliminate one of the dupes (yes there is a correct one)

Have you put the NANO-EsP32 into ESP32 mode? If so, are you using the ESP32 numbered pins? You also have to put the board into ESP32 mode.
The GREEN numbers are what you must use.

I am not aware that the Nano ESP32 I'm using is in the ESP32 mode. The board I have selected in the IDE is "Arduino Nano ESP32".

The I2S pinouts I'm using are from the Arduino Nano ES32 Cheat Sheet:

image

Here are my #defines:

// Define I2S connections (Arduino Nano ESP32)
#define I2S_DOUT  9
#define I2S_BCLK  7
#define I2S_LRC   8

Ok, those are the NANO pins, if you want the ESP32 pins then the second picture is what you want. Either move the wires to the correct pins, or rename D7, D8, D9 to D4, D5, D6 respectively.
The D7 for the NANO mode is different from the D7 for the ESP32 mode, same for D8 and D9. It would be much easier to use a normal esp32, is there a reason you need this very special NANO-ESP32 board?
Screenshot 2024-07-17 at 10.29.58
Screenshot 2024-07-17 at 10.29.48

Where is that Audio.h from?

"This library only works on multi-core ESP32 chips like the ESP32-S3. It does not work on the ESP32-S2 or the ESP32-C3"

I am 99.999% sure the problem is he is using the wrong pins. The sketch compiles and runs fine showing output on Serial. I have ordered the audio amplifier and speakers to prove it's a wiring error. Should be here Monday. He is using the multi-core NANO-ESP32-S3 as I am.

I asked about which pin numbering convention back in Post No.4
I'll be happy to read your results.

Indeed, you did, but the OP is unable to read or understand and follow directions. I am going to the expense and bother of ordering some hardware I don't need just to prove that it works IF the board is in ESP32 mode and the ESP32 pins are used. I should know by Monday.