2019-07-26 10:57 AM
Hi,
I am working on STM32F746.
I am facing problem with Echo Cancellation lib, I refered fd-aud-smartmic1
uint32_t EC_Init(void)
{
EchoHandlerInstance.tail_length= 512;
EchoHandlerInstance.preprocess_init = ACOUSTIC_EC_PREPROCESS_ENABLE;
EchoHandlerInstance.ptr_primary_channels=1;
EchoHandlerInstance.ptr_reference_channels=1;
EchoHandlerInstance.ptr_output_channels=1;
AcousticEC_getMemorySize(&EchoHandlerInstance);
EchoHandlerInstance.pInternalMemory = (uint32_t *)malloc(EchoHandlerInstance.internal_memory_size);
if(EchoHandlerInstance.pInternalMemory == NULL)
{
while(1); /*Error Management*/
}
error_value = AcousticEC_Init((AcousticEC_Handler_t *)&EchoHandlerInstance);
if(error_value != 0)
{
while(1); /*Error Management*/
}
EchoConfigInstance.preprocess_state =ACOUSTIC_EC_PREPROCESS_ENABLE;
EchoConfigInstance.AGC_value =0;
EchoConfigInstance.noise_suppress_default = -15; /* Default: -15 */
EchoConfigInstance.echo_suppress_default = -40; /* Default: -40 */
EchoConfigInstance.echo_suppress_active = -15; /* Default: -15 */
EchoConfigInstance.residual_echo_remove = 1; /* Default: 1 */
error_value = AcousticEC_setConfig((AcousticEC_Handler_t *)&EchoHandlerInstance, (AcousticEC_Config_t *) &EchoConfigInstance);
if(error_value != 0)
{
while(1); /*Error Management*/
}
//Internals.AudioOutRdPtr = 0;
return error_value;
}
1> If I use __CRC_CLK_ENABLE() before EC_Init, sw is stucked here:
if(EchoHandlerInstance.pInternalMemory == NULL)
{
while(1); /*Error Management*/
}
I try to extand heap but not work
2> If I do not use __CRC_CLK_ENABLE() before EC_Init, sw is stucked after AcousticEC_Init : return value ACOUSTIC_LOCK_ERROR
Do you have any idea?
Thank You
2019-07-26 11:24 AM
>>Do you have any idea?
Look at how much memory it is requesting, and why your malloc() isn't providing that.
AcousticEC_getMemorySize(&EchoHandlerInstance);
printf("Requesting %d\n", EchoHandlerInstance.internal_memory_size));
>>I try to extand heap but not work
If malloc() returns a NULL, then clearly not sufficiently. Review where the heap is situated, and why the allocator fails at it's task. For GNU/GCC likely an issue with __sbrk()
2019-07-26 08:18 PM
Hi,
EchoHandlerInstance.internal_memory_size is 53988. Something wrong with AcousticEC? The filterlength setting is 512 only.
2019-07-26 08:33 PM
Make sure to zero out EchoHandlerInstance
You have that much memory, humour it, I don't know what the overhead/requirements are.
2019-07-26 09:08 PM
Hi,
Thank You for your answering.
I am going to implement EC by myself rather than working on bug lib.
Many times I faced problem with audio Lib from ST. They should open the source for community or no one will use their Lib.