Basically, I'm trying to use the I2S to output data in parallel. It's not very well documented, but using TobleMiner's library it's not too hard - or so I thought.
It seems to work just fine, except that my data gets corrupted. I've managed to work it down to a very simple proof-of-concept:
- uint16_t total_count = 100
- uint16_t pattern_a = 0b10;
- uint16_t pattern_b = 0b01;
- for (int i = 0; i < total_count; i++) {
- buffer[i] = pattern_a;
- }
- uint8_t b_count = 3;
- for (int i = 0; i < b_count; i++) {
- buffer[total_count - (i + 1)] = pattern_b;
- }
The crucial part here is the "b_count". Attached at the end are scope captures for values 1-8.
As you can see, for every odd number above 1, a spurious pulse is inserted! This happens both for a normally-low and normally-high value.
If you want to try it for yourself, I've uploaded my code in a Github repository at https://github.com/Crote/esp32-i2s-poc.
My own code is absolutely trivial, and I can't see anything obvious wrong in the I2S component either.
What is happening here? Am I missing something obvious?