Hi,
I`m a student and I`m working on Boost5545ulp board. I will configure DMA to read by hardware interrupt an audio sample from codek by I2S to variable named AudioSampleLeft. Communication with codek works properly and I can read a sample in this way.
void aic3206_codec_read(Int16* left_input, Int16* right_input)
{
volatile Int16 dummy;
counter1 = 0;
/* Read Digital audio inputs */
while(!(I2S2_IR & RcvR) )
{
counter1++; // Wait for receive interrupt
}
*left_input = I2S2_W0_MSW_R; // Read Most Significant Word of first channel
dummy = I2S2_W0_LSW_R; // Read Least Significant Word (ignore)
*right_input = I2S2_W1_MSW_R; // Read Most Significant Word of second channel
dummy = I2S2_W1_LSW_R; // Read Least Significant Word of second channel (ignore)
}
DMA should also generate interrupt after transmistion. Unfortunately DMA didn`t work. Both interrupt and sample transfer. So I have several questions:
1) How to set up correctly destination address to varieble?
2) Should the source address be set directly on I2S 2 Receive Left Data 1 Register or on DMA Start Byte Address from table from manual 140 side?
3) Does DMA clear the interrupt I2S flag after transfer or should I take this into account when I`ve configured DMA to autoreload mode?
To configuration I`m using header files from this threads. https://e2e.ti.com/support/processors-group/processors/f/processors-forum/231447/how-to-use-c553x-interrupts-without-csl?fbclid=IwAR3Yb-29HS8t-BCaMU6PSo38Nj5UpZBFth3X4TsSWzvlOQDMhgSFTJ2W0YI https://e2e.ti.com/support/processors-group/processors/f/processors-forum/231388/c553x-hardware-register-header?fbclid=IwAR2_9GJiSI970lD-2lVcJS5NgbEGC61LDH71NYP1IBZxrcjBqUQEA3k-J8Q
This is my whole code:
#include "stdio.h"
#include "BoosterPack5545_led.h"
#include "BoosterPack5545_switch.h"
#include "oled.h"
#include "usbstk5515.h"
#include "PLL.h"
#include "registers.h"
#include "interrupts.h"
Uint32 AudioSampleLeft;
/////////////////////////
interrupt void dma_isr(void);
void main(void){
/* Initialize BSL */
USBSTK5515_init( );
/* Initialize PLL */
pll_frequency_setup(120);
/* DMA CONTROLLER 1 CH 0 I2S2 event and interrupt 1 double word*/
IRQ_hook_func(dma_isr, ISR_DMA);// adding dma_isr function to vector (interrupts.h)
PRCR &= ~(1<<DMA_RST);// setting DMA according to c5545 manual chapter 3.2.13 Initialization side 147
PCGCR2 &= ~(1<<DMA1CG);
DMAIFR= 0xFF;
IFR0 &= ~(1<<9);
DMAIER |= (1<<DMA1CH0IE);
DMA1CH0TCR2 |= (1<<INTEN);
DMA1CESR1= 0x2;
DMA1CH0SSAU=0x0000;// DMA Controller 1 Memory Map I2S, manual side 140
DMA1CH0SSAL=0x2A00;// maybe address of I2S 2 Receive Left Data 1 Register (0x2A29) ???
DMA1CH0DSAU=(Uint16)&AudioSampleLeft;// address of AudioSampleLeft ???
DMA1CH0DSAL=0x0;
DMA1CH0TCR1=0x4;
DMA1CH0TCR2 |= (1<<AUTORLD);
DMA1CH0TCR2 |= (1<<(DSTAMODE+1));
DMA1CH0TCR2 |= (1<<(SRAMODE+1));
DMA1CH0TCR2 |= (1<<SYNCMODE);
DMA1CH0TCR2 |= (1<<DMAEN);
/* Initialise hardware interface and I2C for codec */
aic3206_hardware_init();
/* Initialise the AIC3206 codec */
aic3206_init();
BoosterPack5545_LEDs_init( );
BoosterPack5545_SWITCHes_init( );
/* Initialise the OLED LCD display */
oled_init();
SAR_init();
oled_display_message(" ", " ");
IRQ_globalEnable();
printf("\nSTART\n");
while(1){
aic3206_codec_write(AudioSampleLeft, AudioSampleLeft); //aic3206_codec_write and aic3206_codec_read works properly but AudioSampleLeft is still NULL
}
}
interrupt void dma_isr(void)// this interrupt function is never invoked
{
printf("IT`S WORKING");
DMAIFR= 0xFF;// clearing DMA interrupt flags
}
Thanks in advance for Your help.