Packing 8 16bit channels into one serial port
Hello! I'm designing V2 of my digital mixer, which uses an ADAU1466, ADCs, DACs, and an ESP32-S3 for the web interface.
So far so good. V1 is working great, but for V2 I'd like to add multitrack recording to an SD card.
I basically under-researched the ESP32 I2S capabilities, and I can't use the 8ch/32bit I was hoping to use to fit the 8 channels on a single output serial port (the ESP is limited to 128 bits per frame).
I knew I'd be limited to 16 bits, which is good enough, except for the little missing detail that I cannot configure the serial port that way in SigmaStudio. For 8 channels I can only choose 32 bit/channel.
So, since I've already sent the PCBs for fabrication (silly me, I know) I thought of packing two 16-bit channels into one 32-bit word in the schematic, but I'm kinda lost on how to do it, or even if it is possible.
Any resources or hints would be greatly appreciated.
Thanks in advance!
software
packing
processors and dsp
sigmastudio
Processors and Microcontrollers
3.3.0
16bit
adau1466
Show More
SigmaStudio has bit-shifters, but I do not recall whether it can truncate binary numbers.
Basically, you would take two channels, run each of them through a block that truncates to 16-bit, then pick one to shift by 16 bits, after which it could be added to the other channel to create a 32-bit value. The critical part is to truncate before mixing, because if there are any more than 16 bits in either source, then adding the two channels will end up mixing them. But if you can ensure that one has the upper 16 bits set, and the other has the lower 16 bits set, then adding will product 32 bits with two independent signals.
I suspect that the shifting operation may extend the sign bit to the upper bits, which would corrupt the mix, but maybe you can truncate after the bit shift and remove the sign extension.
Good luck.
p.s. You missed one of the fun parts of design, which is to identify the hardware peripheral interface requirements of the processor, and then select the most appropriate chip. There are so many options besides the ESP32, and many of those have high-bandwidth serial audio ports that would be perfect for your application without jumping through hoops.
Thanks for the reply. Yeah, the sign and the masking is what worries me the most. I saw the shift cell, but no bit mask, and I'm also not sure about what to do with the sign...
There's a "Pack16bitAudio" which states "This module accepts stereo audio channels and packs them into a single 16 bit audio stream at the output. " which isn't exactly a detailed explanation about what it does bitwise, and also takes two inputs somehow, but might be of use. The output should never exceed 16 bits and should be safe to shift I guess.
Regarding the MCU choice, yeah... My first goal was having built-in WiFi and a capable processor to generate the web interface and handle multiple clients without any audio handling, but after v1 I thought "hey, an SD card connector costs pennies. I'll add it and see what can I do with it afterwards. I have a couple free serial ports in the DSP" and here we are haha
Momoib said:
hey, an SD card connector costs pennies. I'll add it and see what can I do with it afterwards. I have a couple free serial ports in the DSP
Ah, yes. Feature Creep (meant in the positive sense, not the negative)
I don't know whether you spent money on the EVAL-ADAU1466, but you could maybe convince yourself that your V1 and V2 boards were really just evaluation phases. Yes, it's expensive to design and fabricate a couple of revisions, but you're learning a lot with these.
Then you can eventually design V3 with a more appropriate main processor with full serial audio interface support. Yeah, I know, that would start over at the beginning, in a sense, because you'd be tossing the ESP32 firmware, but it's just a way to not feel too bad about the tradeoffs of rapid prototyping.
I designed my board, based on the ADAU1463, but without any main processor. I included a header on the board so that a separate board can be stacked and plug in to that header and have access to the SigmaDSP control port. I can thus test the SigmaDSP without committing to a main processor. If the main processor has to evolve, that won't affect the SigmaDSP (with A2B) board. In my situation, the client has big plans for the main processor, so it's likely that they don't even know yet what processor will be appropriate.
Momoib said:
I basically under-researched the ESP32 I2S capabilities, and I can't use the 8ch/32bit I was hoping to use to fit the 8 channels on a single output serial port (the ESP is limited to 128 bits per frame).
Does the ESP32 have the ability to allocate 2 data bits per serial port? ... or is there a second serial port that could share bit clock and framing?
I ask because the ADAU146x has 8 spare pins, SDATAIO0 through SDATAIO7, that can be used to enhance any Serial Port from 1-bit width to 2-bit or 4-bit width. There might be a way to have the SigmaDSP output 256 bits per frame on two data pins, and convince the ESP32 to see those as a pair of 128 bit frames on separate ports.
This suggestion is inspired by the A2B evaluation boards from Analog Devices that connect one 32-channel A2B chip to two 16-channel SigmaDSP serial ports. The A2B chip sees this as one stream with 2-bit data width. The SigmaDSP sees this as two streams with 1-bit data width. Clocking and framing is shared between the two serial ports.
I'm using the reverse technique to connect the ADAU1463 to an Asahi Kasei DAC that doesn't support the bit rates and channel counts that I want when using 1-bit data widths, but by adding an SDATAIOx pin, I can use the necessary clock rates and still get the channel counts I need. The ADAU145x Family cannot handle this, and would be stuck with limited sample clock rates.
Sorry for the rapid posting, but if you figure out how to truncate to 16-bit, you will certainly want to dither the original samples before truncating, otherwise your recordings will sound harsh.
I haven't bought development boards, went directly to my own PCB. I did base my design in their schematic though. I saw some designs doing what you did of separating the DSP and MCU boards. It is a good idea for cheaper prototypes. All the audio ICs add up quick. Even more so with 8ch in and 12ch out as I have. I'm my own client though haha
That's an interesting approach. I do have two I2S ports on the ESP32, but I'm planing on using them as "full duplex". I believe I'll be able to use the "Pack16bitAudio" block, which also includes dithering, and the corresponding unpacking later. If that doesn't work I'll implement 4 channels for now and evaluate a MCU replacement for future versions, but as you said, that would mean starting the firmware from scratch, and also add cost since I still need a WiFi capable module.
Thanks for the ideas!
Please log in to reply.