Hello everybody.
First I'd like to thanks everyone for the help in this forum. That's being really helpful.
I'm working with the TIVA TM4C1294XL. I ran the spi_master.c example code and modified it a little bit to fit for that TIVA. So now, I found this article explaining how to emulate I²S on TIVA TM4C123x (http://goo.gl/tmwjEu). For this, I'm using the PCM 1807 A/D converter http://goo.gl/xtdK90.
So I was reading about I²S and the I²S bus specification says that I need at least three lines in order to make I²S happens:
1. Continuous Serial Clock
2. Word Select
3. Serial Data.
These three lines are drawn on page 2 of the first document. There I have SSI CLK hooked to BCLK, SSI TX hooked to DIN and SSI FSS hooked to WCLK, and another configuration lines for other purposes.
However, I want my TIVA to be the master, so I did this drawing (in advance apologies for the quality)
So I did that associations taking as example the I²S emulation on the first document. So my first question.
I believe I'd have a problem hooking SSI0CLK and SSI1CLK together, right? I mean, since the TIVA will dictate the CLK, I don't need both SSI0 and SSI1 to send clock, right?
Another detail is that in the PCM 1807 datasheet, page 14, I have that if the PCM is working as SLAVE, LRCK and BCK are INPUT pins.But I believe that LRCK "says" right or left side, so that should be coming OUT of the ADC, or not?
For now, my last question is regarding the MC, MD and MS configuration pins. On the pages 22/23/24 of the ADC datasheet, I have the detailed explanation of how to work with MC, MD and MS in order to configure the ADC. So I planned to use three GPIOs from TIVA to set LOW and HIGH on MC, MD and MS. Considering correct previous PIN configuration, I did this:
uint32_t MD_bits[16]; //Control bits to Serial Control Format uint32_t MC_bits[32]; //Fake clock uint32_t MS_bit = 0xff; int i, j = 0; // // Initializing MD and MC arrays // MD_bits[16] = {0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; for(i = 0; i < 32; i++){ if(i%2 == 0) MC_bits[i] = 0x00; else MC_bits[i] = 0xff; } // Sending Serial Control Format - SPI MS_bit = 0x00; GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_3, MS_bit); //Put MS to low to start transmitting MD and MC. for(i = 0; i < 16; i++){ GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_1, MD_bits[i]); //Writes MD first GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_2, MC_bits[j]); //Writes MC - Driven to LOW j++; //Increments j that is the MC counter since MC has twice MD's size SysCtlDelay(100); //Waits 100 clock cycles GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_2, MC_bits[j]); //Writes MC again - Driven to HIGH j++; //Increments j again SysCtlDelay(100); //Waits 100 more clock cycles } MS_bit = 0xff; GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_3, MS_bit); //Not necessary in the future
Would that work for this purpose? Or I can't use GPIO to write on MC, MD and MS?
I did a test last week and I got this (MC is wrong)
Thanks again!
Alex.