Skip to main content
Graduate
March 5, 2024
Solved

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

  • March 5, 2024
  • 4 replies
  • 2997 views

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?

    This topic has been closed for replies.
    Best answer by KBéla.1

    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);

     

     

    4 replies

    Visitor II
    March 6, 2024

    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.1Author
    Graduate
    March 6, 2024

    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.

    Technical Moderator
    March 6, 2024

    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.

    KBéla.1Author
    Graduate
    March 6, 2024

    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.

    Technical Moderator
    March 6, 2024

    Could you please replace 

     

    hcrc.Instance->CR |= CRC_CR_RESET;

     

    by

    CRC->CR |= CRC_CR_RESET;

     

     

    ?

    KBéla.1Author
    Graduate
    March 6, 2024

    I replaced that, but it still not works. 

    KBéla.1Author
    Graduate
    March 6, 2024

    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.

    KBéla.1AuthorAnswer
    Graduate
    September 9, 2024

    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);