|
5 | 5 |
|
6 | 6 | (See the README.md file in the upper level 'examples' directory for more information about examples.) |
7 | 7 |
|
8 | | -I2S on `ESP32S3` and `ESP32C3` supports [TDM mode](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/i2s.html#tdm-mode), in which multiple slots can be transmitted by standard I2S connection. |
| 8 | +The targets that listed on the top support [TDM mode](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/i2s.html#tdm-mode), in which multiple slots can be transmitted by standard I2S connection. |
9 | 9 |
|
10 | 10 | This example demonstrates how to use I2S TDM mode to record 4 MICs connected to [ES7210](http://www.everest-semi.com/pdf/ES7210%20PB.pdf) codec. ES7210 has 4 TDM modes, which are `ES7210_I2S_FMT_I2S` `ES7210_I2S_FMT_LJ` `ES7210_I2S_FMT_DSP_A` and `ES7210_I2S_FMT_DSP_B`, and they are all supported by I2S TDM driver. Relation between ES7210 TDM modes and I2S Driver TDM modes is shown in the following table. |
11 | 11 |
|
@@ -91,6 +91,63 @@ I (10431) gpio: GPIO[4]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulld |
91 | 91 | I (10431) example: You can now safely remove the card, recorded file is /RECORD.WAV |
92 | 92 | ``` |
93 | 93 |
|
| 94 | +## Application Notes |
| 95 | + |
| 96 | +TDM mode is widely used in multi-channel scenario. Some ADC/DAC (e.g., ES7210 and ES7243) that supports TDM can be cascaded to sample more channels synchronously. |
| 97 | + |
| 98 | +Take ES7210 for example, it is a 4-channel audio ADC that supports TDM. And we can chain upto four ES7210 to form a 16-channel recorder, meanwhile it only needs one I2S port. |
| 99 | + |
| 100 | +You can refer to the connection as follow: |
| 101 | + |
| 102 | +``` |
| 103 | +┌───────────────┐ |
| 104 | +│ ESP │ |
| 105 | +│ │ |
| 106 | +│ MCLK ├───────────┬──────────────────────────────┬──────────────────────────────┬──────────────────────────────┐ |
| 107 | +│ │ │ │ │ │ |
| 108 | +│ BCLK ├────────┬──┼───────────────────────────┬──┼───────────────────────────┬──┼───────────────────────────┐ │ |
| 109 | +│ │ │ │ │ │ │ │ │ │ |
| 110 | +│ WS ├─────┬──┼──┼────────────────────────┬──┼──┼────────────────────────┬──┼──┼────────────────────────┐ │ │ |
| 111 | +│ │ │ │ │ │ │ │ │ │ │ │ │ │ |
| 112 | +│ DOUT │ │ │ │ ┌───────────────┐ │ │ │ ┌───────────────┐ │ │ │ ┌───────────────┐ │ │ │ ┌───────────────┐ |
| 113 | +│ │ │ │ │ │ ES7210_0 │ │ │ │ │ ES7210_1 │ │ │ │ │ ES7210_2 │ │ │ │ │ ES7210_3 │ |
| 114 | +│ DIN │◄─┐ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ |
| 115 | +└───────────────┘ │ │ │ └───►│ MCLK │ │ │ └───►│ MCLK │ │ │ └───►│ MCLK │ │ │ └───►│ MCLK │ |
| 116 | + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ |
| 117 | + │ │ └──────►│ SCLK │ │ └──────►│ SCLK │ │ └──────►│ SCLK │ │ └──────►│ SCLK │ |
| 118 | + │ │ │ │ │ │ │ │ │ │ │ │ │ |
| 119 | + │ └─────────►│ LRCK │ └─────────►│ LRCK │ └─────────►│ LRCK │ └─────────►│ LRCK │ |
| 120 | + │ │ │ │ │ │ │ │ │ |
| 121 | + └─────────────┤ TDMOUT │ ┌──────────┤ TDMOUT │ ┌──────────┤ TDMOUT │ ┌──────────┤ TDMOUT │ |
| 122 | + │ │ │ │ │ │ │ │ │ │ │ |
| 123 | + ┌───►│ TDMIN │ │ ┌───►│ TDMIN │ │ ┌───►│ TDMIN │ │ │ TDMIN │ |
| 124 | + │ │ │ │ │ │ │ │ │ │ │ │ │ │ |
| 125 | + │ └───────────────┘ │ │ └───────────────┘ │ │ └───────────────┘ │ └───────────────┘ |
| 126 | + │ │ │ │ │ │ |
| 127 | + └────────────────────────┘ └────────────────────────┘ └────────────────────────┘ |
| 128 | +``` |
| 129 | + |
| 130 | +### How A Frame Formed in This Cascaded Case |
| 131 | + |
| 132 | +Generally, all the ES7210 will send the data that sampled by itself at the beginning of a frame, and then catenate the backward ES7210 data behind. In another word, ES7210_0 will send the data in the order ES7210_0 -> ES7210_1 -> ES7210_2 -> ES7210_3. |
| 133 | + |
| 134 | +See the detailed steps as follows: |
| 135 | + |
| 136 | +1. First 4 channels of the 16 channels: |
| 137 | + - ES7210_3 send data that sampled by itself to ES7210_2; |
| 138 | + - ES7210_2 send data that sampled by itself to ES7210_1, store the data sent from ES7210_3; |
| 139 | + - ES7210_1 send data that sampled by itself to ES7210_0, store the data sent from ES7210_2; |
| 140 | + - ES7210_0 send data that sampled by itself to ESP, store the data sent from ES7210_1; |
| 141 | +2. Second 4 channels of the 16 channels: |
| 142 | + - ES7210_2 send the stored data (i.e., sampled by ES7210_3) to ES7210_1; |
| 143 | + - ES7210_1 send the stored data (i.e., sampled by ES7210_2) to ES7210_0, and store the data from ES7210_2 (i.e., sampled by ES7210_3); |
| 144 | + - ES7210_0 send the stored data (i.e., sampled by ES7210_1) to ESP, and store the data sent from ES7210_1 (i.e., sampled by ES7210_2); |
| 145 | +3. Third 4 channels of the 16 channels: |
| 146 | + - ES7210_1 send the stored data (i.e., sampled by ES7210_3) to ES7210_0; |
| 147 | + - ES7210_0 send the stored data (i.e., sampled by ES7210_2) to ESP, and store the data from ES7210_1 (i.e., sampled by ES7210_3); |
| 148 | +4. Last 4 channels of the 16 channels: |
| 149 | + - ES7210_0 send the stored data (i.e., sampled by ES7210_3) to ESP; |
| 150 | + |
94 | 151 | ## Troubleshooting |
95 | 152 |
|
96 | 153 | For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon. |
0 commit comments