Chip-cn-dat/NSIWAY-dat/NS4150-dat/NS4150-dat.md
... ...
@@ -4,6 +4,8 @@
4 4
5 5
- [[NWI1241-dat]]
6 6
7
+- datasheet == [[NS4150.pdf]]
8
+
7 9
8 10
http://inder.cn/WJXZ/nsiway/InderNS4150EN.PDF
9 11
... ...
@@ -29,6 +31,17 @@ Look for beads with DC resistance in the range of 10-100 mΩ.
29 31
30 32
The ferrite bead must handle the maximum current of your speaker system without saturating. For the NS4150, consider the peak output current, which depends on the amplifier’s load and power rating.
31 33
34
+
35
+## function
36
+
37
+CTRL terminal function
38
+
39
+Table7.Working mode
40
+- CTRL Mode
41
+- H Open
42
+- L Shutdown
43
+
44
+
32 45
## SCH 2
33 46
34 47
Chip-cn-dat/NSIWAY-dat/NS4150-dat/NS4150.pdf
... ...
Binary files /dev/null and b/Chip-cn-dat/NSIWAY-dat/NS4150-dat/NS4150.pdf differ
Chip-cn-dat/everest-semi-dat/ES8311-dat/ES8311-SDK-dat/ES8311-SDK-dat.md
... ...
@@ -2,6 +2,14 @@
2 2
3 3
- [[ES8311-SDK-dat]] - [[ES8311-dat]] - [[everest-semi-dat]] - [[ES7201-dat]] - [[codec-audio-dat]] - [[I2S-dat]]
4 4
5
+- [[NS4150-dat]]
6
+
7
+
8
+
9
+ I2C device found at address 0x18 !
10
+
11
+ "Chip ID: 0x8311": If you see this, your I2C wiring (SDA/SCL) is correct.
12
+
5 13
## Example 1: Music Playback
6 14
7 15
This example demonstrates how to play music using an ESP32-C3 development board. If you are using an ESP32-S3, you simply need to switch the target chip in the project configuration. This guide is based on modifications to the official ESP-IDF example.
... ...
@@ -93,3 +101,6 @@ https://github.com/pschatzmann/arduino-audio-tools
93 101
https://gitlab.informatik.uni-bremen.de/fbrning/esp-idf/-/blob/v5.0-dev/examples/peripherals/i2s/i2s_es8311/main/i2s_es8311_example.c?ref_type=tags
94 102
95 103
https://github.com/pschatzmann/arduino-audio-tools
104
+
105
+
106
+- [[ES8311]]
... ...
\ No newline at end of file
Chip-cn-dat/everest-semi-dat/ES8311-dat/ES8311-SDK-dat/test/ES8311-code-mic2/ES8311-code-mic2.ino
... ...
@@ -1,21 +1,19 @@
1 1
#include <Wire.h>
2
-#include <ESP_I2S.h> // Uses the standard ESP32 Arduino I2S library
2
+#include <ESP_I2S.h>
3 3
4
-// Define your board's pin layout (Change these values to match your specific board schematic)
4
+// PIN CONFIGURATION
5 5
#define I2C_SDA 18
6 6
#define I2C_SCL 17
7
-
8 7
#define I2S_BCLK 5
9 8
#define I2S_LRCK 4
10 9
#define I2S_DOUT 6
11 10
#define I2S_DIN 7
12 11
#define I2S_MCLK 2
13 12
14
-#define ES8311_ADDR 0x18 // Default I2C Address for ES8311
13
+#define ES8311_ADDR 0x18
15 14
16 15
I2SClass i2s;
17 16
18
-// Helper to write to ES8311 registers over I2C
19 17
void writeReg(uint8_t reg, uint8_t value) {
20 18
Wire.beginTransmission(ES8311_ADDR);
21 19
Wire.write(reg);
... ...
@@ -24,49 +22,56 @@ void writeReg(uint8_t reg, uint8_t value) {
24 22
}
25 23
26 24
void init_ES8311() {
27
- // Resets and wakes up the chip sequence
28
- writeReg(0x00, 0x80); // Reset system
29
- delay(100);
30
- writeReg(0x00, 0x00); // Clear reset
31
-
32
- // Clock configurations
33
- writeReg(0x01, 0x30); // Enable master clock (MCLK)
34
- writeReg(0x02, 0x00); // Digital calibration clock
25
+ // 1. Reset
26
+ writeReg(0x00, 0x80); delay(50);
27
+ writeReg(0x00, 0x00);
28
+
29
+ // 2. Clock Management (Slave Mode)
30
+ writeReg(0x01, 0x30); // Enable MCLK and Clocks
31
+ writeReg(0x02, 0x10); // ADC Clock
32
+ writeReg(0x03, 0x10); // DAC Clock
35 33
36
- // ADC setup
37
- writeReg(0x03, 0x70); // Power up analog core & ADC
38
- writeReg(0x13, 0x40); // Select Mic-1 input
39
- writeReg(0x14, 0x1A); // Set ADC PGA gain (24dB or similar)
40
- writeReg(0x17, 0xBF); // ADC Digital Volume (0dB)
34
+ // 3. I2S Format (Phillips 16-bit)
35
+ writeReg(0x0A, 0x00); // Phillips Mode
36
+ writeReg(0x0B, 0x0C); // 16-bit word length (0x0C)
41 37
42
- // I2S configuration for ADC
43
- writeReg(0x0A, 0x0C); // ADC I2S format, 16-bit
38
+ // 4. Power & Analog Path
39
+ writeReg(0x0D, 0x03); // Power up Analog core
40
+ writeReg(0x0E, 0x02); // Enable ADC Analog
41
+ writeReg(0x13, 0x41); // Mic1 Input + Bias
42
+ writeReg(0x14, 0x12); // Medium Gain (+15dB)
43
+ writeReg(0x15, 0x40); // ADC Power Digital
44
+ writeReg(0x16, 0x00); // ALC Off
45
+ writeReg(0x17, 0x00); // Volume Max
44 46
45
- Serial.println("ES8311 Registers Configured for Microphone.");
47
+ // 5. Digital Enable
48
+ writeReg(0x45, 0x01);
49
+ Serial.println("ES8311 Configured (Phillips, 16-bit, +15dB)");
46 50
}
47 51
48 52
void setup() {
49 53
Serial.begin(115200);
50
- while(!Serial);
51
-
52
- // 1. Fire up I2C Bus
54
+ delay(1000);
53 55
Wire.begin(I2C_SDA, I2C_SCL);
54 56
init_ES8311();
55 57
56
- // 3. Initialize I2S peripheral
57
- i2s.setPins(I2S_BCLK, I2S_LRCK, I2S_DOUT, I2S_DIN, I2S_MCLK); // BCLK, LRCK, DOUT, DIN, MCLK
58
- if (!i2s.begin(I2S_MODE_STD, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_MONO, I2S_STD_SLOT_LEFT)) {
59
- Serial.println("Failed to initialize I2S!");
58
+ // STABLE I2S CONFIG
59
+ i2s.setPins(I2S_BCLK, I2S_LRCK, I2S_DOUT, I2S_DIN, I2S_MCLK);
60
+
61
+ // Use Phillips mode and 16-bit. Read both slots.
62
+ if (!i2s.begin(I2S_MODE_STD, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO, I2S_STD_SLOT_BOTH)) {
63
+ Serial.println("I2S Init Failed");
60 64
while (1);
61 65
}
62
- Serial.println("I2S initialized for Microphone.");
66
+ Serial.println("I2S Ready (Stereo 16-bit).");
63 67
}
64 68
65 69
void loop() {
66
- int16_t sample = 0;
67
- size_t bytes_read = i2s.readBytes((uint8_t*)&sample, sizeof(sample));
70
+ int16_t samples[2]; // [0] = Left, [1] = Right
71
+ size_t bytes_read = i2s.readBytes((char*)samples, sizeof(samples));
68 72
69
- if (bytes_read == sizeof(sample)) {
70
- Serial.println(sample);
73
+ if (bytes_read == sizeof(samples)) {
74
+ // If you talk into the mic, these numbers should JUMP wildly
75
+ Serial.printf("L:%6d R:%6d\n", samples[0], samples[1]);
71 76
}
72 77
}
... ...
\ No newline at end of file
Chip-cn-dat/everest-semi-dat/ES8311-dat/ES8311-SDK-dat/test/ES8311-code-spk/ES8311-code-spk.ino
... ...
@@ -1,76 +0,0 @@
1
-#include <Wire.h>
2
-#include <ESP_I2S.h> // Uses the standard ESP32 Arduino I2S library
3
-
4
-// Define your board's pin layout (Change these values to match your specific board schematic)
5
-#define I2C_SDA 18
6
-#define I2C_SCL 17
7
-
8
-#define I2S_BCLK 5
9
-#define I2S_LRCK 4
10
-#define I2S_DOUT 6
11
-#define I2S_DIN 7
12
-#define I2S_MCLK 2
13
-
14
-#define ES8311_ADDR 0x18 // Default I2C Address for ES8311
15
-
16
-I2SClass i2s;
17
-
18
-// Helper to write to ES8311 registers over I2C
19
-void writeReg(uint8_t reg, uint8_t value) {
20
- Wire.beginTransmission(ES8311_ADDR);
21
- Wire.write(reg);
22
- Wire.write(value);
23
- Wire.endTransmission();
24
-}
25
-
26
-void init_ES8311() {
27
- // Resets and wakes up the chip sequence
28
- writeReg(0x00, 0x80); // Reset system
29
- delay(10);
30
- writeReg(0x00, 0x00); // Clear reset
31
-
32
- // Clock configurations
33
- writeReg(0x01, 0x30); // Enable master clock (MCLK)
34
- writeReg(0x02, 0x00); // Digital calibration clock
35
-
36
- // ADC/DAC powering setup
37
- writeReg(0x03, 0x10); // Power up analog core
38
- writeReg(0x04, 0x10); // Power up DAC
39
- writeReg(0x0D, 0x02); // Configure DAC standard resolution (e.g., 16-bit I2S)
40
-
41
- // Volume Controls
42
- // 0x32: DAC Digital Volume (0x00 to 0xFF, 0xBF is 0dB, 0xFF is maximum gain)
43
- writeReg(0x32, 0xFF);
44
-
45
- // 0x14: System Control (PGA and Analog Gain)
46
- // Bits [3:0] are analog gain. 0x0B sets high analog gain.
47
- writeReg(0x14, 0x1B);
48
-
49
- Serial.println("ES8311 Registers Configured for Maximum Volume.");
50
-}
51
-
52
-void setup() {
53
- Serial.begin(115200);
54
-
55
- // 1. Fire up I2C Bus
56
- Wire.begin(I2C_SDA, I2C_SCL);
57
- init_ES8311();
58
-
59
- // 3. Initialize I2S peripheral
60
- i2s.setPins(I2S_BCLK, I2S_LRCK, I2S_DOUT, I2S_DIN, I2S_MCLK); // BCLK, LRCK, DOUT, DIN, MCLK
61
- if (!i2s.begin(I2S_MODE_STD, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_MONO, I2S_STD_SLOT_LEFT)) {
62
- Serial.println("Failed to initialize I2S!");
63
- while (1);
64
- }
65
- Serial.println("I2S initialized successfully.");
66
-}
67
-
68
-void loop() {
69
- // Array filled with your raw PCM audio sample data
70
- // Loop feeds the I2S hardware buffer continuously
71
- uint16_t dummy_audio_buffer[512] = {0};
72
-
73
- size_t bytes_written;
74
- i2s.write((uint8_t*)dummy_audio_buffer, sizeof(dummy_audio_buffer));
75
- delay(10);
76
-}
... ...
\ No newline at end of file
Chip-cn-dat/everest-semi-dat/ES8311-dat/ES8311-SDK-dat/test/ES8311-code-spk2/ES8311-code-spk2.ino
... ...
@@ -0,0 +1,103 @@
1
+#include <Wire.h>
2
+#include <ESP_I2S.h> // Uses the standard ESP32 Arduino I2S library
3
+
4
+// Define your board's pin layout (Change these values to match your specific board schematic)
5
+#define I2C_SDA 18
6
+#define I2C_SCL 17
7
+
8
+#define I2S_BCLK 5
9
+#define I2S_LRCK 4
10
+#define I2S_DOUT 6
11
+#define I2S_DIN 7
12
+#define I2S_MCLK 2
13
+
14
+#define ES8311_ADDR 0x18 // Default I2C Address for ES8311
15
+
16
+I2SClass i2s;
17
+
18
+// Helper to write to ES8311 registers over I2C
19
+void writeReg(uint8_t reg, uint8_t value) {
20
+ Wire.beginTransmission(ES8311_ADDR);
21
+ Wire.write(reg);
22
+ Wire.write(value);
23
+ Wire.endTransmission();
24
+}
25
+
26
+void init_ES8311() {
27
+ // Resets and wakes up the chip sequence
28
+ writeReg(0x00, 0x80); // Reset system
29
+ delay(10);
30
+ writeReg(0x00, 0x00); // Clear reset
31
+
32
+ // Clock configurations
33
+ writeReg(0x01, 0x30); // Enable master clock (MCLK)
34
+ writeReg(0x02, 0x00); // Digital calibration clock
35
+
36
+ // ADC/DAC powering setup
37
+ writeReg(0x03, 0x10); // Power up analog core
38
+ writeReg(0x04, 0x10); // Power up DAC
39
+ writeReg(0x0D, 0x02); // Configure DAC standard resolution (e.g., 16-bit I2S)
40
+
41
+ // Volume Controls
42
+ // 0x32: DAC Digital Volume (0x00 to 0xFF, 0xBF is 0dB, 0xFF is maximum gain)
43
+ writeReg(0x32, 0xFF);
44
+
45
+ // 0x14: System Control (PGA and Analog Gain)
46
+ // Bits [3:0] are analog gain. 0x0B sets high analog gain.
47
+ writeReg(0x14, 0x1B);
48
+
49
+ Serial.println("ES8311 Registers Configured for Maximum Volume.");
50
+}
51
+
52
+void setup() {
53
+ Serial.begin(115200);
54
+
55
+ // 1. Fire up I2C Bus
56
+ Wire.begin(I2C_SDA, I2C_SCL);
57
+ init_ES8311();
58
+
59
+ // 3. Initialize I2S peripheral
60
+ i2s.setPins(I2S_BCLK, I2S_LRCK, I2S_DOUT, I2S_DIN, I2S_MCLK); // BCLK, LRCK, DOUT, DIN, MCLK
61
+ if (!i2s.begin(I2S_MODE_STD, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_MONO, I2S_STD_SLOT_LEFT)) {
62
+ Serial.println("Failed to initialize I2S!");
63
+ while (1);
64
+ }
65
+ Serial.println("I2S initialized successfully.");
66
+}
67
+
68
+void loop() {
69
+ const int sample_rate = 16000;
70
+ const float frequency = 440.0; // 440Hz (A4 note)
71
+ const int ramp_duration_ms = 3000; // 3 seconds ramp
72
+ const int hold_duration_ms = 2000; // 2 seconds hold at max
73
+ const int buffer_size = 512;
74
+ int16_t audio_buffer[buffer_size];
75
+
76
+ static uint32_t sample_index = 0;
77
+ uint32_t ramp_samples = sample_rate * (ramp_duration_ms / 1000.0);
78
+ uint32_t hold_samples = sample_rate * (hold_duration_ms / 1000.0);
79
+ uint32_t total_samples_in_cycle = ramp_samples + hold_samples;
80
+
81
+ for (int i = 0; i < buffer_size; i++) {
82
+ uint32_t current_pos = sample_index % total_samples_in_cycle;
83
+ float volume;
84
+
85
+ if (current_pos < ramp_samples) {
86
+ // Phase 1: Ramp from 0 to 1 over 3 seconds
87
+ volume = (float)current_pos / ramp_samples;
88
+ } else {
89
+ // Phase 2: Hold at 1 for 2 seconds
90
+ volume = 1.0f;
91
+ }
92
+
93
+ // Generate sine wave
94
+ float sin_val = sin(2.0 * PI * frequency * sample_index / sample_rate);
95
+
96
+ // Scale to 16-bit range
97
+ audio_buffer[i] = (int16_t)(sin_val * volume * 32767);
98
+
99
+ sample_index++;
100
+ }
101
+
102
+ i2s.write((uint8_t*)audio_buffer, sizeof(audio_buffer));
103
+}
... ...
\ No newline at end of file
Chip-cn-dat/everest-semi-dat/ES8311-dat/ES8311-dat.md
... ...
@@ -98,6 +98,8 @@ DAC `PLAYBACK` FUNCTIONS
98 98
99 99
![](2026-04-14-19-30-55.png)
100 100
101
+digital microhpone
102
+
101 103
![](2026-04-14-19-30-38.png)
102 104
103 105
## APP 1.
... ...
@@ -106,6 +108,9 @@ DAC `PLAYBACK` FUNCTIONS
106 108
107 109
![](2026-04-14-19-33-23.png)
108 110
111
+
112
+
113
+
109 114
![](2026-04-14-19-33-44.png)
110 115
111 116
## SCH 2