我想寻求一些帮助 我现在在调试 I2S的接受中断 以下是我的 I2S的基本配置
/* CODEC_I2S pins configura
tion: WS, SCK -----------------------------*/
GPIO_InitStructure.GPIO_Pin = CODEC_I2S_WS_PIN | CODEC_I2S_SCK_PIN ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Connect pins to I2S peripheral */
GPIO_PinAFConfig(GPIOB, CODEC_I2S_WS_PINSRC, CODEC_I2S_GPIO_AF);
GPIO_PinAFConfig(GPIOB, CODEC_I2S_SCK_PINSRC, CODEC_I2S_GPIO_AF);
/* CODEC_I2S pins configuration: SDIN -----------------------------*/
GPIO_InitStructure.GPIO_Pin =GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_PinAFConfig(GPIOC, CODEC_I2S_SDOUT_PINSRC, CODEC_I2S_GPIO_AF);
/* CODEC_I2S pins configuration: MCK pin */
GPIO_InitStructure.GPIO_Pin = CODEC_I2S_MCK_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_PinAFConfig(GPIOC, CODEC_I2S_MCK_PINSRC, CODEC_I2S_GPIO_AF);
SPI_I2S_DeInit(CODEC_I2S);
I2S_StructInit(&I2S_InitStructure);
I2S_InitStructure.I2S_AudioFreq = I2S_AudioFreq_48k;
//I2S_Standard_PCMShort
I2S_InitStructure.I2S_Standard =I2S_Standard_Phillips; //I2S_Standard_Phillips
I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_16b;
I2S_InitStructure.I2S_CPOL = I2S_CPOL_Low;
//I2S_Mode_MasterRx;
I2S_InitStructure.I2S_Mode = I2S_Mode_MasterRx;
I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Enable;
I2S_Init(CODEC_I2S, &I2S_InitStructure);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
NVIC_InitStructure.NVIC_IRQChannel = SPI2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority =1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
I2S_Cmd(CODEC_I2S, ENABLE);
SPI_I2S_ITConfig(SPI2,SPI2,SPI_I2S_IT_RXNE ,ENABLE);
就是这样配置的 但是 I2S一使能 就直接跳到 接收中断里去了 但是 我什么数据也没有 输入啊?
一周热门 更多>