STM32H747 - Use SVC (SmartVolume control) from X-CUBE-AUDIO lib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-05 2:37 AM
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?
Solved! Go to Solution.
- Labels:
-
STM32H7 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-09 7:49 AM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-05 7:39 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-06 12:34 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-06 1:06 AM - edited ‎2024-03-06 1:06 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-06 2:45 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-06 3:38 AM - edited ‎2024-03-06 3:39 AM
Could you please replace
hcrc.Instance->CR |= CRC_CR_RESET;
by
CRC->CR |= CRC_CR_RESET;
?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-06 5:17 AM
I replaced that, but it still not works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-06 5:46 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-06 7:56 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-09 7:49 AM
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);
