Comments (8)
What is the I2S input module you're using? I've seen in other posts here that there are some MEMS mikes which don't actually follow the I2S spec in terms of when they shift/when you're supposed to sample. With a name we can double check a datasheet and see if it's something simple like that.
Alternatively, there could be a 1-bit shift in the I2S input PIO program. But just thinking about this I have trouble seeing how anything would work since I2S is a signed signal and for negative you'd have the MSB as a 1....shifting that out wrong would make simple, low-amplitude signed signals look like noise. I've used a stereo mike set (the one from the GOOG AIY kit since it's got a nice header) and didn't see this in my testing (but it has been a while).
from arduino-pico.
On the bottom of the board there is a label saying CJMCU 1808. In about week, I should have an SDR using the PCM1808 for which I have the exact schematic. Here is a link to a photo of the back, and here is a photo of the front.
from arduino-pico.
I just hooked up the MEMS mike I use and did some basic sanity with the current release and it's still OK as far as I can see. What I did notice, though, on looking at your specific chip's datasheet is that there is FMT
pin (12) which can shift the output by 1 bit, which is exactly what you're seeing:
Can you confirm you're at FMT=0 mode (or that the board isn't shorting it high for you)?
from arduino-pico.
Thanks for looking at this @earlephilhower. I did just reconfirm that FMT is indeed low, both on the input labeled on my evaluation board, and on the actual IC at pin 12. I have two different setups that I tested this on and they both are low and both behave the same way. I am happy to make more hardware measurements for you though.
from arduino-pico.
Would you be able to capture the I2S bus with pulseview
so I can see how things look on the wires? If you could post the raw data (as opposed to a screenshot) that would be most helpful. It would let me confirm the timings and at least let me think through the I2S.pio program and see if we're sampling on a wrong edge or something.
from arduino-pico.
Thanks @earlephilhower! Here is the pulseview file.
PCM1808.zip
Let me know if this is enough data. It seems like it should be. The schematic and software I have been working on is available here. Let me know if you need more measurements. This was sampling at 48 kHz. The setup code is below.
// These are things you might want to change for your situation.
const int RATE = 48000; // Your network needs to handle this, but 96000 should also work, but misses some packets.
const int BITS_PER_SAMPLE_SENT = 32; // 24 or 32, python can make 32 faster.
const int MCLK_MULT = 256; //
void setup1()
{ // This runs on Core1. It is the I2S setup.
i2s.setDATA(2); // These are the pins for the data on the SDR-TRX
i2s.setBCLK(0);
i2s.setMCLK(3);
// Note: LRCK pin is BCK pin plus 1 (1 in this case).
i2s.setSysClk(RATE);
i2s.setBitsPerSample(24);
i2s.setFrequency(RATE);
i2s.setMCLKmult(MCLK_MULT);
i2s.setBuffers(32, 0, 0);
i2s.begin();
mutex_enter_blocking(&my_mutex); // This should syschornize the cores, so one doesn't fill the buffer
// before the other is ready.
mutex_exit(&my_mutex);
}
Thanks,
Rob
from arduino-pico.
Got it, and it looks good. Pulseview's I2S decoder sees no issue on the bitstream and I see both positive and negative values at the right bit length. Looks like the I2S input PIO program's off by one somewhere!
from arduino-pico.
@frohro it looks pretty straightforward. The I2S input program shifts one bit in every BCLK, leaving the HW to do a push of data every 24/32 bits. Since the LRCLK changes 1 cycle before the actual data, this means it was shifting in one garbage bit into the MSB before the actual data. This shift would last for all time since there's no resync. Pre-shifting in 23/31 bits should fix it, putting that 1 extra bit into the 1st returned sample and aligning everything else for all time...
Can you give #2121 a try, since you have a working app and ADC all wired up?
from arduino-pico.
Related Issues (20)
- Unable to silence warnings from the framework/pico-sdk HOT 4
- My code doesn't see rp2040.rebootToBootloader(); HOT 6
- Error in Project configuration on PlatformIO HOT 1
- The function rp2040.fifo.available() does not work as advertised. HOT 6
- W25Q64JV SPI Flash weird behavior
- UnknownPackageError: Could not find the package HOT 2
- Ethernet with interrupt hangs sporadically HOT 21
- Feature Request: dmadison ArduinoXInput support HOT 1
- FYI: Build on Windows HOT 4
- Flashing settings for Listfiles-USB - Docs HOT 4
- Version 3.8.0 Compiler Error HOT 1
- I2S Right Channel is One Sample Shifted in Time from Left HOT 1
- Feature Request: Integration of class MacAddress from arduino-esp32? HOT 2
- Fix enum redeclaration issue when using WiFi and Ethernet HOT 14
- WiFiServer and FreeRTOS - Repeatedly accepting connection eventually causes freeze HOT 4
- Joystick library - please update submodule HOT 1
- LittleFS file not opening on Pico HOT 3
- Question: What limits lwip usage within a FreeRTOS environment to setup/loop and not tasks?
- When using platformio, earlephilhower-based firmware doesn't run after reboot-to-bootloader (but does after hard BOOTSEL+RESET) HOT 4
- Hang with Pico W when using a W5500 and WiFi at the same time.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-pico.