ESP32 HFP_AG
Posted: Tue Nov 11, 2025 9:48 am
Hello folks,
I have a project that sends voice from ESP32 to headphone with hands free profile mSBC codec.
I used example from esp-idf that name is hfp_ag.
I used HCI directly instead of PCM. So I generated a tone to listen it at headphone.
I did every step which was explained in example's readme file.
I successfully connect to headphone and listen to that tone.
However, there are random spikes/noise inside sound. When I keep my headphone very close to esp32, that spikes are gone.
What did I do to prevent that spikes:
1 - Used ping pong buffer with hardware timer for 7.5ms periods,
2 - Changed module with external antenna one,
3 - Setted tx power +9 dbm,
4 - Changed compiler optimization for performance and increased frequency to 240 Mhz which is maximum.
But I still get that spikes even if remote device 20 cm far away.
Do you have any suggestion to eliminate that noise?
Best regards
I have a project that sends voice from ESP32 to headphone with hands free profile mSBC codec.
I used example from esp-idf that name is hfp_ag.
I used HCI directly instead of PCM. So I generated a tone to listen it at headphone.
I did every step which was explained in example's readme file.
I successfully connect to headphone and listen to that tone.
However, there are random spikes/noise inside sound. When I keep my headphone very close to esp32, that spikes are gone.
What did I do to prevent that spikes:
1 - Used ping pong buffer with hardware timer for 7.5ms periods,
2 - Changed module with external antenna one,
3 - Setted tx power +9 dbm,
4 - Changed compiler optimization for performance and increased frequency to 240 Mhz which is maximum.
But I still get that spikes even if remote device 20 cm far away.
Do you have any suggestion to eliminate that noise?
Best regards