John Tarasidis
/
VGA
I2S speed test wip
Diff: main.cpp
- Revision:
- 1:3c1ad60f5cf3
- Parent:
- 0:b847a1ffc64f
- Child:
- 2:8008da2bb047
diff -r b847a1ffc64f -r 3c1ad60f5cf3 main.cpp --- a/main.cpp Mon Apr 13 14:01:48 2020 +0000 +++ b/main.cpp Sat Apr 25 18:55:54 2020 +0000 @@ -1,8 +1,7 @@ #include "mbed.h" //#include "SDFileSystem" -//#include "FastIO.h" -#include "MODDMA.h" - +#include "FastIO.h" +//#include "MODDMA.h" void pllfeed() { __disable_irq(); @@ -37,7 +36,7 @@ DigitalOut led1(LED1); DigitalOut led2(LED2); -MODDMA dma; +//MODDMA dma; void TC0_callback(void) { led1 = 1; @@ -45,47 +44,60 @@ Serial test(p13, p14); +FastOut<p21> pixel; +void pixelout(void) { + pixel = 1; + wait(0.1); + pixel=0; + wait(0.1); +} + int main() { setpll(); pllfeed(); - - char s[] = "I2S CCLK/4 Verification Test"; + pixelout(); + //char s[] = "I2S CCLK/4 Verification Test"; //turn on i2s periph - LPC_SC -> PCONP |= (1 << 27); + //LPC_SC -> PCONP |= (1 << 27); + //set PCLK_peripheral = CCLK/2 so that serial tx CCLK/4 + //LPC_SC -> PCLKSEL1 |= (2 << 22); + //assign clock pin and probe - //set PCLK_peripheral = CCLK/2; such that bitstream is CCLK/4 - LPC_SC -> PCLKSEL1 |= (2 << 22); + //LPC_I2S -> I2STXRATE |= (4 | (1 << 8)); + //monaural format; master mode - LPC_I2S -> I2SDAO |= (0x8); + //LPC_I2S -> I2SDAO |= (0x8); //connect i2s channel 0 tx to dma - LPC_I2S -> I2SDMA1 |= (0x80002); + //LPC_I2S -> I2SDMA1 |= (0x70002); //select p5 pin for i2s tx - LPC_PINCON -> PINSEL0 |= (1 << 18); + //LPC_PINCON -> PINSEL0 |= (1 << 18); + //LPC_PINCON -> PINSEL0 |= (1 << 14); - MODDMA_Config *config = new MODDMA_Config; - config - ->channelNum ( MODDMA::Channel_0 ) - ->srcMemAddr ( (uint32_t) &s ) - ->dstMemAddr ( 0 ) - ->transferSize ( sizeof(s) ) - ->transferType ( MODDMA::m2p ) - ->transferWidth ( 8 ) - ->srcConn ( 0 ) - ->dstConn ( MODDMA::I2S_Channel_0 ) - ->dmaLLI ( 0 ) - ->attach_tc ( &TC0_callback ) - ; + //MODDMA_Config *config = new MODDMA_Config; + //config + // ->channelNum ( MODDMA::Channel_0 ) + // ->srcMemAddr ( (uint32_t) &s ) + // ->dstMemAddr ( LPC_I2S -> I2STXFIFO ) + // ->transferSize ( sizeof(s) ) + // ->transferType ( MODDMA::m2p ) + // ->transferWidth ( 8 ) + // ->srcConn ( 0 ) + // ->dstConn ( MODDMA::I2S_Channel_0 ) + // ->dmaLLI ( 0 ) + // ->attach_tc ( &TC0_callback ) + //; - dma.Setup(config); - dma.Enable(config); + //dma.Setup(config); + //dma.Enable(config); while(1) { - printf("%d ;", LPC_I2S -> I2SSTATE); - wait(0.5); + //printf("%d ;", LPC_I2S -> I2SSTATE); + //wait(0.5); + pixelout(); } }