- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear,
I hope to get a sample source code for IIS interface working on WICED 2.4.1.
I want to test for audio.
If you have it tested, please let me get it.
Thank you all.
Gideon
Solved! Go to Solution.
- Labels:
-
I2CI2S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Register your specific interrupts for the application. Interrupts are shared with bootload and application. You can build the bootloader without your interrupts and application with your interrupts. Please checkout Re: Custom interrupts.
Hope it helps,
Seyhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now, IIS interface works with below in WCD4 using WICED 2.4.1
But, when I enable Interrupt for I2S after DMA Init, it stops when the boards boot up.
Is there any way to register interrupt handler?
1. DMA Init
#define Audio_DMA_I2S2_Stream DMA1_Stream3
#define Audio_DMA_I2S2_Channel DMA_Channel_0
#define Audio_DMA_I2S2_IRQ DMA1_Stream3_IRQnDMA_InitTypeDef DMA_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1, ENABLE);
// Common initialization
DMA_InitStructure.DMA_BufferSize = AUDIO_BUFFER_SIZE;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;// DMA configuration for input & output if I2S data.
// Configure each DMA channel to use double-buffered mode
// in circular mode.// This allows the software codec read/write operation form the one memory while the DMA
// is reading/writing to the other memory.// I2S2 - DMA configuration for sending data to the codec/speaker
DMA_Cmd(Audio_DMA_I2S2_Stream, DISABLE);
DMA_DeInit(Audio_DMA_I2S2_Stream);
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
DMA_InitStructure.DMA_Channel = Audio_DMA_I2S2_Channel;
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t) &SPI2->DR;
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t) &audio_rx_buffer[AUDIO_BUFFER_0][0];//DMA_DoubleBufferModeConfig(Audio_DMA_I2S2_Stream, (uint32_t) &audio_rx_buffer[AUDIO_BUFFER_1][0], DMA_Memory_0);
//DMA_DoubleBufferModeCmd(Audio_DMA_I2S2_Stream, ENABLE);
DMA_Init(Audio_DMA_I2S2_Stream, &DMA_InitStructure);// Enable DMA SPI RX Stream
DMA_Cmd(Audio_DMA_I2S2_Stream, ENABLE);// trigger interrupt when transfer half complete/complete
DMA_ITConfig(Audio_DMA_I2S2_Stream, DMA_IT_TC, ENABLE);// Enable SPI3 Rx buffer empty interrupt
SPI_I2S_ITConfig(SPI2, SPI_I2S_IT_RXNE, ENABLE);// Enable SPI interrupts to DMA
SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Rx, ENABLE);
2. I2S interrupt enable
// NVIC: Configure the DMA interrupt priority
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannel = Audio_DMA_I2S2_IRQ;
NVIC_Init(&NVIC_InitStructure);
void DMA1_Stream3_IRQHandler()
{if (DMA_GetITStatus(DMA1_Stream3, DMA_IT_TCIF3) == SET)
{
DMA_ClearITPendingBit(DMA1_Stream3, DMA_IT_TCIF3);...
}
}
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Register your specific interrupts for the application. Interrupts are shared with bootload and application. You can build the bootloader without your interrupts and application with your interrupts. Please checkout Re: Custom interrupts.
Hope it helps,
Seyhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Seyhan,
I cannot find interrupts shared in bootloader.
Could you let me know where can I find it?
Thank you for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Seyhan,
Do you know how to register the custum interrupt handler like void DMA1_Stream3_IRQHandler() above?
Thanks