2025-11-11 1:34 PM
Hi,
I am running a code to expect to get a digital ouput (wave file from sd card) using amplifiermax98357a. when i run this code the only thing i got is a noise like burning wood. can i get any help. i am assuming the sd card not beeing read or initiate to get the file play.
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
/* USER CODE END ET */
/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
/* USER CODE END EM */
/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/
#define LED_Pin GPIO_PIN_13
#define LED_GPIO_Port GPIOC
#define BTN_Pin GPIO_PIN_0
#define BTN_GPIO_Port GPIOC
#define BTN_EXTI_IRQn EXTI0_IRQn
#define SD_DET_Pin GPIO_PIN_15
#define SD_DET_GPIO_Port GPIOA
/* USER CODE BEGIN Private defines */
// SDIO Pin Definitions
#define SDIO_CMD_Pin GPIO_PIN_6
#define SDIO_CMD_GPIO_Port GPIOA
#define SDIO_D1_Pin GPIO_PIN_8
#define SDIO_D1_GPIO_Port GPIOA
#define SDIO_D2_Pin GPIO_PIN_9
#define SDIO_D2_GPIO_Port GPIOA
#define SDIO_D0_Pin GPIO_PIN_4
#define SDIO_D0_GPIO_Port GPIOB
#define SDIO_D3_Pin GPIO_PIN_5
#define SDIO_D3_GPIO_Port GPIOB
#define SDIO_CK_Pin GPIO_PIN_15
#define SDIO_CK_GPIO_Port GPIOB
// I2S Pin Definitions for MAX98357
#define I2S_WS_Pin GPIO_PIN_4
#define I2S_WS_GPIO_Port GPIOA
#define I2S_CK_Pin GPIO_PIN_5
#define I2S_CK_GPIO_Port GPIOA
#define I2S_SD_Pin GPIO_PIN_7
#define I2S_SD_GPIO_Port GPIOA
// Add these back - they're needed for BSP_SD_IsDetected()
#define SD_DETECT_PIN SD_DET_Pin
#define SD_DETECT_GPIO_PORT SD_DET_GPIO_Port
#define SD_PRESENT 0
#define SD_NOT_PRESENT 1
/* USER CODE END Private defines */
#ifdef __cplusplus
}
#endif
#endif /* __MAIN_H */
2025-11-11 3:30 PM - edited 2025-11-11 3:31 PM
Take the SD Card out of the equation. Make a sine wave in memory and play that.
A .WAV file has headers and can come in many different data formats, ie mono, stereo, 8-bit or 16-bit, etc.
Check you are managing signing, endian, etc properly.