Page 2 of 2

Re: I2S data corruption?

Posted: Mon Oct 30, 2017 8:49 pm
by jsurfage
@ESP_Sprite - Did you find time to get the answers?

Re: I2S data corruption?

Posted: Mon Oct 30, 2017 11:03 pm
by Sprite
Sorry, didn't get around to it earlier... On second look, I'd like to see what your setup looks like. You're shuffling bits and forth at 3MHz; at rates like this the cabling gets somewhat important.

Re: I2S data corruption?

Posted: Tue Oct 31, 2017 3:50 am
by mgleason_3
Thanks ESP_Sprite!

>> I'd like to see what your setup looks like.
Not totally sure what you'd like, but I attached a picture of the setup.

>> You're shuffling bits and forth at 3MHz; at rates like this the cabling gets somewhat important.
I just ran a test at a much slower 8kHs x 16 x 2 = 256KHz.

The data should be:
01,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7...

This is what was actually received:
0,1,1,3,-32766,6,6,7,0,1,2,3,-32766,2,6,7,0,1,2,3,4,5,6,7,0,1,5,20,4100,5,28672,0,-16384,0,17409,1,-32760,3,-32767,0,16452,4,-24574,259,6,7,-14336,0,2,3,4,5,6,7,0,1,2,3,4,5,1,7,0,133,-32762,135,-16384,16385,1,15,2,3,4,5,7,7,2048,1,514,3,-32766,2,-32765,3,0,1,2,3,6,7,0,1,2,3,4,5,6,7,0,1,-32767,1,3,12,8192,16385,-15355,1,0,9,4,4,-32766,2,-32766,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,-32766,4,-32768,512,-32766,2,6,7,0,1,2,3,4,5,6,7,16384,2,1,3,2,5,0,1,2,3,4,5,6,7,0,1,2,3,4,5,-32765,3,-24508,1,16384,3,4096,0,4,5,-32765,7,-32768,512,1,7,1,3,36,277,-32765,3,0,1,2,3,4,5,6,7,0,1,2,3,-32734,2,-32767,65,3,7,2,3,4,5,6,7,-32768,0,2,3,-32766,16386,-32765,2055,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,-32764,5,-32767,3,16448,1,0,0,-24574,2,7,7,0,1,-16384,8192,1,5,1,71,0,8193,2,3,4,5,6,7,0,1,2,3,4,5,6,7,-16128,16385,2,16419,-32767,2,4,5,6,7,-32768,0,2,5,6,7,0,1,-32766,2066,-32765,3,0,1,2,3,4,5,6,7,0,1,2,3,20480,129,-14848,1,8200,0,-32764,5,22,2566,7,57,6,14,10240,0,-32768,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,1,3,6,7,2,7,16385,1,6,7,512,1,2,259,-32766,2,6,7,-32768,0,2,3,4,5,-32768,0,2,3,4,5,6,7,0,1,2,3,4,5,-32767,3,8704,16385,9216,0,24576,3,2055,7,4096,3,2,5,6,30,0,1,6,7,0,1,2,3,4,5,6,7,0,1,2,3,4,5,4,1,31745,-14271,-32767,1,4,5,-32766,3,0,1,0,1,2,3,4,5,-32765,3,0,1,2,3,4,5,-32765,3,0,1,-32767,1,4,5,6,7,0,1,2,3,4,5,6,7,16384,1,133,5,-16384,0,-32767,3,-32759,2,6,3,-32768,1,-32766,2,10,10,-32767,129,2,3,4,5,6,7,0,1,2,3,4,5,6,7,2,4101,-32767,1,-32765,3,1,3,4,5,6,7,0,1,258,3,4,5,-32765,7,-32764,1029,6,7,0,1,2,3,4,5,6,7,0,1,1,3,2,14,-32765,3,0,1,-32768,1,-32637,3,6,28,-28672,-32768,-32764,5,14,206,4,5,6,7,0,1,2,3,4,5,6,7,0,1,30,112,-32768,128,-16384,128,16384,2,6,7,0,1,4,5,6,7,4096,1,8192,16385,6,7,0,1,2,3,4,5,6,7,0,1,2,3,3,5,1046,7,-32767,515,-31741,7,1,3,6,7,6,7,0,1,2,3,4,5,6,7,0,1,2,3,4,7,2,5,2,3,2,517,6,7,0,1,132,5,6,7,0,1,-16384,0,-32766,10,3,7,-32768,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,8,0,8192,1,4098,-32768,16385,-16383,-32768,0,129,515,2,5,-32763,3,-16384,2049,-32764,5,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,2,2,3,4,5,3,7,-32768,0,1,3,-32766,2,6,7,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,3,6,7,16448,1,-32766,2,-32768,3,0,1,2,3,4,5,6,7,0,1,2,3,4,5,1,1,-32745,2556,518,30,258,16389,4,5,6,7,0,1,-32767,1,4,5,-32768,0,-32768,1,-32767,1,0,1,2,3,4,5,6,7,0,1,2,3,3,-32740,19,7,4,-32748,-32767,1,2,5,-32768,0,-32768,1,-16384,2080,4,2051,5,1034,6,7,0,1,2,3,4,5,6,7,0,1,1,3,8192,4096,0,7,-32766,5,4,5,-32765,3,0,1,2,3,-32734,2,134,7,0,1,-16384,1,4,5,6,7,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,9,16386,2,16386,3,0,1,-32768,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,-32767,7,0,257,-32767,2,0,1,8194,131,-32764,5,7,7,2,3,4,5,6,7,4,1,-32768,1,4,5,-32765,3,0,1,2,3,6,7,0,1,2,3,4,5,6,7,0,1,1,3,-32765,3,32,1,-14335,1,-32735,3,20481,258,-32767,3,3,8194,-16381,3,14,32,4,5,-16382,2,3,263,-32767,1,-32766,18,4,5,6,7,0,1,2,3,4,5,6,7,0,1,278,-32744,-16384,68,2,3,4,5,6,7,0,1,257,3,4,5,0,7,-30720,0,-16384,0,-32766,2,-32765,3,0,1,2,3,4,5,6,7,0,1,2,3,4,5,-32637,131,1,8195,-32730,8198,-16384,-32511,6,7,-32767,518,1,259

Re: I2S data corruption?

Posted: Tue Oct 31, 2017 4:46 pm
by Sprite
Thanks, I was looking for such an image. Do you have the grounds of the two boards connected? I can only see three wires there, not sure if the ground is one of them... if you do not have that, the return current needs to go through the big loop of USB cables, hub etc, and any interference picked up there kills your data integrity. To solve it, just use another jumper wire to connect the grounds directly.

Re: I2S data corruption?

Posted: Tue Oct 31, 2017 9:50 pm
by mgleason_3
@ESP_Sprite - thanks again for looking at it.

One quick question - is there a reference which explains I2S_COMM_FORMAT_PCM | I2S_COMM_FORMAT_PCM_LONG (vs I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB)?

WRT Grounding: Oh boy, I should have thought of that :oops:

I'd been trying to figure out why I was seeing such strange data from two I2S microphones which I posted about here: viewtopic.php?f=14&t=1506.

Per your suggestion: added the ground, re-ran the slower 8kHs x 16 x 2 = 256KHz test and got perfect data:
4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,...

Also re-ran the fast 44.1 kHz × 32 × 2 = 2.8224 MHz test and got less perfect data:
-2147483645,3,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,2,-2147483645,3,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,...

So, we know that two ESP32's can communicate with each other via I2S - at least at lower speeds!