/** ****************************************************************************** * @file Audio/Audio_playback_and_record/Src/main.c * @author MCD Application Team * @brief Audio playback and record main file. ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */
/* Includes ------------------------------------------------------------------*/ #include "waveplayer.h" #include "waverecorder.h"
/** * @brief Main program * @param None * @retval None */ int main(void) { uint32_t x_size, y_size;
/* Configure the MPU attributes as Write Through */ MPU_Config();
/* Enable the CPU Cache */ CPU_CACHE_Enable();
/* STM32H7xx HAL library initialization: - Systick timer is configured by default as source of time base, but user can eventually implement his proper time base source (a general purpose timer for application or other time source), keeping in mind that Time base duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and handled in milliseconds basis. - Set NVIC Group Priority to 4 - Low Level Initialization */ HAL_Init();
/* Configure the system clock to 400 MHz */ SystemClock_Config();
/* Run Application (Blocking mode) */ while (1) { /* USB Host Background task */ USBH_Process(&hUSB_Host);
/* AUDIO Menu Process */ AUDIO_MenuProcess(); } }
/******************************************************************************* Static Function *******************************************************************************/
/* The voltage scaling allows optimizing the power consumption when the device is clocked below the maximum system frequency, to update the voltage scaling value regarding system frequency refer to product datasheet. */ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
while ((PWR->D3CR & (PWR_D3CR_VOSRDY)) != PWR_D3CR_VOSRDY) {}
/* Enable HSE Oscillator and activate PLL with HSE as source */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSIState = RCC_HSI_OFF; RCC_OscInitStruct.CSIState = RCC_CSI_OFF; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
/* Enables the I/O Compensation Cell */ HAL_EnableCompensationCell(); }
/** * @brief This function is executed in case of error occurrence. * @param None * @retval None */ void Error_Handler(void) { /* LED3 On in error case */ BSP_LED_On(LED3); while (1) { } }
/** * @brief Configure the MPU attributes as Write Through for SDRAM. * @note The Base Address is SDRAM_DEVICE_ADDR. * The Region Size is 32MB. * @param None * @retval None */ static void MPU_Config(void) { MPU_Region_InitTypeDef MPU_InitStruct;
/* Disable the MPU */ HAL_MPU_Disable();
/* Configure the MPU as Strongly ordered for not defined regions */ MPU_InitStruct.Enable = MPU_REGION_ENABLE; MPU_InitStruct.BaseAddress = 0x00; MPU_InitStruct.Size = MPU_REGION_SIZE_4GB; MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS; MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE; MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE; MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE; MPU_InitStruct.Number = MPU_REGION_NUMBER0; MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0; MPU_InitStruct.SubRegionDisable = 0x87; MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
#ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t* file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */ while (1) { } } #endif
To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
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.Best regards,FBL
/** ****************************************************************************** * @file Audio/Audio_playback_and_record/Src/waveplayer.c * @author MCD Application Team * @brief This file provides the Audio Out (playback) interface API ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */
/* Includes ------------------------------------------------------------------*/ #include "waveplayer.h"
/* Clean Data Cache to update the content of the SRAM */ SCB_CleanDCache_by_Addr((uint32_t*)&BufferCtl.buff[AUDIO_OUT_BUFFER_SIZE/2], AUDIO_OUT_BUFFER_SIZE/2);
case AUDIO_STATE_WAIT: case AUDIO_STATE_IDLE: case AUDIO_STATE_INIT: default: /* Update audio state machine according to touch acquisition */ AUDIO_AcquireTouchButtons(); break; } return audio_error; }
/** ****************************************************************************** * @file Audio/Audio_playback_and_record/Src/main.c * @author MCD Application Team * @brief Audio playback and record main file. ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */
/* Includes ------------------------------------------------------------------*/ #include "waveplayer.h" #include "waverecorder.h"
/** * @brief Main program * @param None * @retval None */ int main(void) { uint32_t x_size, y_size;
/* Configure the MPU attributes as Write Through */ MPU_Config();
/* Enable the CPU Cache */ CPU_CACHE_Enable();
/* STM32H7xx HAL library initialization: - Systick timer is configured by default as source of time base, but user can eventually implement his proper time base source (a general purpose timer for application or other time source), keeping in mind that Time base duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and handled in milliseconds basis. - Set NVIC Group Priority to 4 - Low Level Initialization */ HAL_Init();
/* Configure the system clock to 400 MHz */ SystemClock_Config();
/* Run Application (Blocking mode) */ while (1) { /* USB Host Background task */ USBH_Process(&hUSB_Host);
/* AUDIO Menu Process */ AUDIO_MenuProcess(); } }
/******************************************************************************* Static Function *******************************************************************************/
/* The voltage scaling allows optimizing the power consumption when the device is clocked below the maximum system frequency, to update the voltage scaling value regarding system frequency refer to product datasheet. */ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
while ((PWR->D3CR & (PWR_D3CR_VOSRDY)) != PWR_D3CR_VOSRDY) {}
/* Enable HSE Oscillator and activate PLL with HSE as source */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSIState = RCC_HSI_OFF; RCC_OscInitStruct.CSIState = RCC_CSI_OFF; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
/* Enables the I/O Compensation Cell */ HAL_EnableCompensationCell(); }
/** * @brief This function is executed in case of error occurrence. * @param None * @retval None */ void Error_Handler(void) { /* LED3 On in error case */ BSP_LED_On(LED3); while (1) { } }
/** * @brief Configure the MPU attributes as Write Through for SDRAM. * @note The Base Address is SDRAM_DEVICE_ADDR. * The Region Size is 32MB. * @param None * @retval None */ static void MPU_Config(void) { MPU_Region_InitTypeDef MPU_InitStruct;
/* Disable the MPU */ HAL_MPU_Disable();
/* Configure the MPU as Strongly ordered for not defined regions */ MPU_InitStruct.Enable = MPU_REGION_ENABLE; MPU_InitStruct.BaseAddress = 0x00; MPU_InitStruct.Size = MPU_REGION_SIZE_4GB; MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS; MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE; MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE; MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE; MPU_InitStruct.Number = MPU_REGION_NUMBER0; MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0; MPU_InitStruct.SubRegionDisable = 0x87; MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
#ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t* file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */ while (1) { } } #endif
To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.