EC_M031_Play_Wav_file_from_SPI_Flash_V1.00.zip
(2.11 MB)
int32_t main(void)
{
uint32_t MidDid;
TCHAR sd_path[] = { '0', ':', 0 }; /* SD drive started from 0 */
/* Unlock protected registers */
SYS_UnlockReg();
/* Init System, IP clock and multi-function I/O. */
SYS_Init();
/* Init UART to 115200-8n1 for print message */
UART_Open(UART0, 115200);
QSpiInit();
MidDid = QSpiReadMidDid();
printf("\nMID and DID = 0x%x\n\r", MidDid);
printf("\nstart to play test.wav file");
f_chdrive(sd_path); /* set default path */
/* Init I2C1 to access NAU8822 */
I2C1_Init();
/* Reset NAU88L25 codec */
NAU88L25_Reset();
/* Set PE.13 low to enable phone jack on NuMaker board. */
SYS->GPE_MFPH &= ~(SYS_GPE_MFPH_PE13MFP_Msk);
GPIO_SetMode(PE, BIT13, GPIO_MODE_OUTPUT);
PE13 = 0;
/* Initialize NAU88L25 codec */
CLK_SysTickDelay(20000);
NAU88L25_Setup();
/* Configure PDMA and use Scatter-Gather mode */
PDMA_Init();
WAVPlayer();
while(1);
}
|