Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2S.h: No such file or directory [fixed] #26

Open
silentlit opened this issue May 30, 2024 · 9 comments
Open

I2S.h: No such file or directory [fixed] #26

silentlit opened this issue May 30, 2024 · 9 comments

Comments

@silentlit
Copy link

silentlit commented May 30, 2024

System: MacOS Silicon

If anyone got the error "I2S.h: No such file or directory", just install the esp32 version 2.0.17 to fix it.

"Navigate to Tools > Board > Boards Manager..., type the keyword esp32 in the search box, select the latest version of esp32, and install it."
It seems the latest version do not have this header file or the header file has changed to other name?

@kowyo
Copy link

kowyo commented Jun 7, 2024

I ran the command: arduino-cli core install esp32:[email protected] and got the following output:

Error during install: Platform 'esp32:[email protected]' not found: required version 2.0.17 not found for platform esp32:esp32

How do I fix this?

@aldenpang
Copy link

Any solution with this? I got same error on windows10

@silentlit
Copy link
Author

I ran the command: arduino-cli core install esp32:[email protected] and got the following output:

Error during install: Platform 'esp32:[email protected]' not found: required version 2.0.17 not found for platform esp32:esp32

How do I fix this?

Any solution with this? I got same error on windows10

Follow the readme:
Add ESP32 board package to your Arduino IDE:
Navigate to File > Preferences, and fill "Additional Boards Manager URLs" with the URL: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

I think you might have not add the "ESP32 board package" yet.

@pondchn
Copy link

pondchn commented Jun 16, 2024

[email protected] is fine,but [email protected] or [email protected] doesn't work;because i2s library is changed into esp_i2s;

@kowyo
Copy link

kowyo commented Jun 21, 2024

I ran the command: arduino-cli core install esp32:[email protected] and got the following output:

Error during install: Platform 'esp32:[email protected]' not found: required version 2.0.17 not found for platform esp32:esp32

How do I fix this?

Any solution with this? I got same error on windows10

Follow the readme: Add ESP32 board package to your Arduino IDE: Navigate to File > Preferences, and fill "Additional Boards Manager URLs" with the URL: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

I think you might have not add the "ESP32 board package" yet.

I solved it by following the steps, as well as installing the latest Arduino-cli @1.0.1

@kowyo
Copy link

kowyo commented Jun 21, 2024

Here is an update for anyone who wants to migrate their project to the latest platform

@HaoHoo
Copy link

HaoHoo commented Jul 8, 2024

[email protected] is fine,but [email protected] or [email protected] doesn't work;because i2s library is changed into esp_i2s;

change firmware.ino from i2s.h to esp_i2s.h, or stay on [email protected] 😄

1 similar comment
@HaoHoo
Copy link

HaoHoo commented Jul 8, 2024

[email protected] is fine,but [email protected] or [email protected] doesn't work;because i2s library is changed into esp_i2s;

change firmware.ino from i2s.h to esp_i2s.h, or stay on [email protected] 😄

@Traxmaxx
Copy link

Here's the diff to get it to compile with ESP_I2S. Need to do further testing though:

 index ca000b02..454ce97c 100644
--- a/OpenGlass/firmware/firmware.ino
+++ b/OpenGlass/firmware/firmware.ino
@@ -1,5 +1,5 @@
 #define CAMERA_MODEL_XIAO_ESP32S3
-#include <I2S.h>
+#include <ESP_I2S.h>
 #include <BLE2902.h>
 #include <BLEDevice.h>
 #include <BLEUtils.h>
@@ -9,6 +9,10 @@
 #include "camera_pins.h"
 #include "mulaw.h"

+I2SClass I2S;
+
+
+
 // Audio

 // Uncomment to switch the codec
@@ -287,28 +291,28 @@ static size_t compressed_buffer_size = recording_buffer_size + 3; /* header */
 #endif
 #endif

-static uint8_t *s_recording_buffer = nullptr;
+static char *s_recording_buffer = nullptr;
 static uint8_t *s_compressed_frame = nullptr;
 static uint8_t *s_compressed_frame_2 = nullptr;

 void configure_microphone() {

   // start I2S at 16 kHz with 16-bits per sample
-  I2S.setAllPins(-1, 42, 41, -1, -1);
-  if (!I2S.begin(PDM_MONO_MODE, SAMPLE_RATE, SAMPLE_BITS)) {
+  I2S.setPins(-1, 42, 41, -1, -1);
+  if (!I2S.begin(I2S_MODE_STD, SAMPLE_RATE, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_MONO)) {
     Serial.println("Failed to initialize I2S!");
     while (1); // do nothing
   }

   // Allocate buffers
-  s_recording_buffer = (uint8_t *) ps_calloc(recording_buffer_size, sizeof(uint8_t));
+  s_recording_buffer = (char*) ps_calloc(recording_buffer_size, sizeof(uint8_t));
   s_compressed_frame = (uint8_t *) ps_calloc(compressed_buffer_size, sizeof(uint8_t));
   s_compressed_frame_2 = (uint8_t *) ps_calloc(compressed_buffer_size, sizeof(uint8_t));
 }

 size_t read_microphone() {
   size_t bytes_recorded = 0;
-  esp_i2s::i2s_read(esp_i2s::I2S_NUM_0, s_recording_buffer, recording_buffer_size, &bytes_recorded, portMAX_DELAY);
+  bytes_recorded = I2S.readBytes(s_recording_buffer, recording_buffer_size);
   return bytes_recorded;
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants