I'm programming the tm4c1232c3pm and have attached an I2C DAC and a small speaker.
I got the audio example to work (after porting from older example), but the example has 48kHz samplerate and is stereo. I changed the samplerate to 16kHz mono, since the 400kHz I2C device needs 18 clocks per sample and that gives a maximum samplerate of 22.2kHz. I don't want to waste cycles downconverting and anti-aliasing on the micro.
The device now recognizes correctly as a 16kHz device, and volume and mute controls work, but I don't get any data. I debugged this a bit and found the reason in uDMAUSBTransfer(), it returns from this code at the beginning of the function:
if((ui32Size < 64) || ((uint32_t)pvBuffer & 0x3))
{
return(0);
}
Since 16kHz mono at 16bits only requires 32 bytes per frame, the check "ui32Size < 64" is true. What is the reasoning behind this check?
Furthermore, I was browsing through this function and found this:
if((psUSBDMAInst->pui32Config[ui32Channel - 1] & UDMA_SIZE_32) ==
UDMA_SIZE_32)
{
ui32TransferCount >>= 2;
}
else if((psUSBDMAInst->pui32Config[ui32Channel - 1] & UDMA_SIZE_32) ==
UDMA_SIZE_32)
{
ui32TransferCount >>= 1;
}
The conditions on the if and else if branches are exactly the same, so the else if branch will never be executed.