Reputation: 91
I've been struggling with finding a solution for the following in a personal hobby project of mine for the last six months and really starting to run out of ideas. I've been trying to create a modification of sorts for a Sony XDR-F1HD HD Radio, which is a radio that's famously good at picking out distant signals. As part of the HD radio feature, the main module exposes the digitized RF baseband with a pair of I2S lines carrying the digital samples. I'd like to piggyback off of these lines and write the raw samples to an SD card.
The interface I'd like to capture consists of the I2S word select and bit clock lines as well as a pair of I2S data lines each carrying one channel of PCM samples. The bit clock runs at 10.4 MHz and the word select line runs at 325 kHz. Since each I2S data line is carrying one channel, this gives a sample rate of 650,000 samples/sec at 16 bits/sample. With two channels of this, the effective data rate is 20.8 megabit/sec or 2.6 MB/s. Additionally, the bit clock and word select clock is generated by the module, so whatever I use to capture must work as a "rx slave" device and not generate the clock itself.
Here is a timing diagram I modified to show how this works.
I'd like to take this parallel I2S stream and continuously stream it onto an SD card's filesystem as a file so it could be read as a two channel, 16 bits/sample, 650 ksps audio file on a computer later. Any modern decent SD card should be able to handle 2.6 MB/s pretty easily over SDIO, but likely not via SPI. I'm looking for a microprocessor or chip of some sort (that I'll refer to as a controller from here) that could accomplish this task. Ideally I'd be able to send the controller a command via i2c or something similar to "start recording to " and another command to "stop recording". I'd also like the controller to support at least a FAT32 filesystem, although I'd be more ideal to have a (Windows) filesystem that can handle files >2 GB. It's also come to my attention that SD cards can sometimes stall for up to 250ms at a time, so whatever controller I go with would need to be able to buffer 250ms (0.65 MB) of data in RAM as it's waiting to be written.
First, I tried purchasing an ESP32 microprocessor to use. Unfortunately, while the datasheet claims it supports bit clocks up to 80 MHz, that apparently only applies in master mode where the ESP32 is generating the clock and not in slave mode where it needs to lock onto the external clock as is required for this project. Otherwise, it'll drop bits and just read in junk. This is unfortunate, as I've found that the ESP32 has a fast enough SD card interface to accomplish this data rate if it could only clock in the bits fast enough. Additionally, it doesn't seem to have any support for the strange "parallel" I2S I have.
Next, I purchased a Raspberry Pi Pico and ran into essentially the opposite problem. With some cleverly crafted PIO (programmable IO) assembly code I was able to pretty easily capture the signal. However, it can't write to an SD card nearly fast enough, so I can only really capture as much that'll fit into RAM. Since I need recording to be continuous, this doesn't work for me. However, I was at least able to run an FFT using fftw3 (which ran surprisingly well!) and confirm that the data over these I2S lines is what I'm after.
Additionally, I tried a full size Raspberry Pi (which isn't really ideal for this project) but the GPIO isn't quite fast enough for my needs. It has the RAM and SDIO speed for it, but I couldn't find a way to clock in bits fast enough. I'd also like this to be as "bare metal" as possible so I'd like to avoid running on top of an OS if I don't have to.
In summary, I'm looking to find a microcontroller or chip of some sort that'll help me accomplish the following:
I have programming experience so I'd be happy to write the software myself, I just need to find hardware that'll be capable of such a thing. I don't have any experience with hardware language for something like an FPGA though, so I'd have no clue what to do if I needed one of those. I really liked the "programmable IO" feature on the Raspberry Pi Pico, so maybe I'm looking for something like that but with a lot more RAM and an SDIO interface?
Thanks, I really appreciate it. I've been banging my head against this problem for months and months, haha.
Upvotes: 0
Views: 755