I am using CS43L22 with STM32F4 discovery board. I generate sounds by sending I2S messages to CS43L22 using circular DMA buffer (32 size array). However, chip creates a constant beep whether it's playing a sound or not. What I also noticed is that if I decrease the buffer to 16, beep gets doubled in frequency, if I send 8, it gets doubled again like that and It is a pulse wave. Thus I have concluded that it is DMA related with I2S operation and It changes the the signal after the buffer is finished sending, or it accidentally sends 1 bit of information at the end of every DMA operation. What might be causing this?
Assuming you are talking about audible noise from the board, not noise in the recreated audio stream, the noise could be caused by modulating the load on the power supply at the frequency of the DMA loop.
Below are some snippets from a good article about diagnosing audio noise from power supplies that explains the effect.
The most common source of audible noise in a flyback supply is a noisy component. Typically, ceramic capacitors or ferrite transformer cores generate this noise.
Noise in a ceramic capacitor is usually a product of the reverse piezoelectric effect. When a voltage is applied across a dielectric structure, it can induce a mechanical stress or strain that causes the material to deform. As the material deforms, it displaces the air around it and generates noise.
Noise generated by transformer cores, on the other hand, typically is caused by magnetostriction, a process similar to the reverse-piezoelectric effect. That is, many ferromagnetic materials change shape when they’re subjected to a magnetic field. As the magnetic field changes the transformer core, it can cause the core to physically vibrate.