cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H747 - Use SVC (SmartVolume control) from X-CUBE-AUDIO lib

KBéla.1
Associate III

I know that the library X-CUBE-AUDIO is not compatible with H7 series (only F4 and F7 is supported), but it can be very useful on the H7 mcu, too.

Is there any way to make it run on the H747 cpu on M7 core?

I want to use mainly SVC (SmartVolume) functionality, but CDC, SCR236, GAM, SDR.

Are there any way to run any of these functionalities on H7 cpu?

1 ACCEPTED SOLUTION

Accepted Solutions

The problem was in CRC setup.

So

 

hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_ENABLE;

 

must be enabled.

My full CRC setup is (which works for SVC):

 

 

 

hcrc.Instance = CRC;

hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_ENABLE;

hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_ENABLE; // InitValue must be enabled, when working with SVC DSP lib, why?

hcrc.Init.CRCLength = CRC_POLYLENGTH_32B;

hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_BYTE;

hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_ENABLE;

hcrc.InputDataFormat = CRC_INPUTDATA_FORMAT_BYTES;

if (HAL_CRC_Init(&hcrc) != HAL_OK)

{

Error_Handler();

}

__HAL_CRC_DR_RESET(&hcrc);

 

 

View solution in original post

9 REPLIES 9
tjaekel
Lead

What is "SVC"?
SVC is used on ARM processors as "System Vector Call", an assembly instruction to "call the OS" for a function to execute from a user program.

What is "SmartVolume"?

Porting the X-Cube-Audio over to a H7 series should be possible. Potentially, there are not so many dependencies, except the one needed for low level initialization of HW, e.g. I2S interfaces.

KBéla.1
Associate III

Hello,

SVC is Smart Volume Control functionality, from library X-Cube-Audio. This can control audio volume level by some Smart functionalities (e.g. AGC, audio compressor).

 

When I try to call any function from this library on H7 CPU, than they always return error.

For example the call of function svc_reset () returns SVC_BAD_HW.

I have included library:

SVC_32b_CM7_GCC.a

, and before function call, and I have also enabled CRC clock by

_HAL_RCC_CRC_CLK_ENABLE();

I do not have source codes for SVC_32b_CM7_GCC.a, so I do not know how to port it to H7 cpu.

Hello,

Did you reset the CRC calculation unit by setting the bit CRC_CR[RESET] after enabling the RCC CRC clock?

What about the input buffers used by svc_reset(), dynamic allocation? if yes did you check if they are not NULL?

I don't see a reason that this library cannot work on H7 product.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
KBéla.1
Associate III

Hello,

After enabling crc peripheral by

 

 

 

__HAL_RCC_CRC_CLK_ENABLE();

 

I have tried to call

 

 hcrc.Instance->CR |= CRC_CR_RESET;

 

or

 

__HAL_RCC_CRC_FORCE_RESET();

 

 but function

 

pSvcPersistentMem = malloc(svc_persistent_mem_size);
pSvcScratchMem = malloc(svc_scratch_mem_size); 

if ((pSvcPersistentMem != NULL) && (pSvcScratchMem != NULL))
{
  /* SVC effect reset */
  error = svc_reset(pSvcPersistentMem, pSvcScratchMem);
  if (error != SVC_ERROR_NONE)
  {
    return error;
  }
}

 

,svc_reset() still returns an error: -7 (SVC_BAD_HW).

 

pSvcPersistentMem and pSvcScratchMem are both allocated correctly, they are not NULL.

p.s. I am also using library AcousticBF_CM7F_wc32_ot.a on the same processor (STM32H747), and this works.

Could you please replace 

 

hcrc.Instance->CR |= CRC_CR_RESET;

 

by

CRC->CR |= CRC_CR_RESET;

 

 

?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I replaced that, but it still not works. 

Did you try to include the library SVC_CM7_GCC.a instead of SVC_32b_CM7_GCC.a?

PS: in the example running on STM32746G-Discovery SVC_CM7_GCC.a was included.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
KBéla.1
Associate III

I have tried this, but still not works.

And I have tried to initialize the SDR (Sound Detector) from the same X-Cube-Audio library pack, but it also returns the same error.

The problem was in CRC setup.

So

 

hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_ENABLE;

 

must be enabled.

My full CRC setup is (which works for SVC):

 

 

 

hcrc.Instance = CRC;

hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_ENABLE;

hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_ENABLE; // InitValue must be enabled, when working with SVC DSP lib, why?

hcrc.Init.CRCLength = CRC_POLYLENGTH_32B;

hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_BYTE;

hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_ENABLE;

hcrc.InputDataFormat = CRC_INPUTDATA_FORMAT_BYTES;

if (HAL_CRC_Init(&hcrc) != HAL_OK)

{

Error_Handler();

}

__HAL_CRC_DR_RESET(&hcrc);