Can't increase PDM audio sample rate from 16KHz to 44.1KHz on Redboard Artemis

The PDM example file “Example4_RecordToWav” is configured with a decimation rate of 48 and PDM clock frequency of 1.5MHz, which gives a sampling frequency of 16kHz for the PDM microphone. I am able to run this example with no problems. I want to record at a better quality audio sampling frequency of 44.1kHz, and have set the decimation rate to 32 and PDM clock frequency to 3MHz per the article “How to Set up the PDM to achieve 48/16/44.1 KHz Audio data” from support.ambiqmicro.com. When I upload the program to the board it will execute for maybe 1 sec and then stop. Some data will show up in the Serial Monitor of the Arduino IDE before it stops. If I reset the board it will again execute briefly and then stop. This behavior can also be seen in the example problem “Example1_MicrophoneOutput” if PRINT_PDM_DATA is set to 1 (by default it is 0) so as to request the data buffer to be printed to the serial monitor. If I restrict the printing to only 10% of the data buffer the program will continue running. The PRINT_PDM_DATA for loop takes about 50 ms to print 10% of the buffer. This example uses the default decimation rate of 64 and PDM clock frequency of 6MHz, which gives a sampling rate of 46.875KHz. The RecordToWav example, using the same parameters or the 32/3MHz ones I previously used, will also continue to run if I limit the Serial.write to 50% of the pdmDataSize. I have concluded that the problem is related to the amount of time it takes for Serial.write or Serial.print to send the entire data buffer. I’m guessing that this time interval results in a lost connection or maybe the PDM module going to sleep. I have no idea as to how to keep the connection alive or the PDM awake during this time so as to receive the entire buffer.

I answered my own question with additional experimentation. While I had previously calculated a required serial baud rate of 48kHz*(16bit PCM data + 1 start bit + 1 stop bit) = 864Kbs and had tried using 1Mbs, this didn’t resolve the problem so I continued looking elsewhere. However, when I set the baud rate to 1.5Mbs, it worked perfectly. Apparently there is quite a bit of additional overhead in transmitting data that I’m not aware of.