There are no Timers in the Edison like in the Arduino. Both boards have different architectures so there are things that cannot be done in the same way you used to do them with Arduino. I believe that it'd be helpful if you could explain what you want to do - the final goal – this way we can provide suggestions so you can try to achieve your goal.
Regarding the external clock signal, what do you mean by that? The GPIOs can be configured as inputs and they can serve as interrupts. Maybe if you can give us more details about what you want do, we can try to give you a couple of suggestions for it.
I want to interface this codec shield with edison.
The codec is first configured using I2C.I think this should be possible by the edison. And then it talks over SPI for the audio data. For this it also sends a clock signal out and the timers are configure to interrupt over this clock signal to do the SPI transfers. I think SPI should be possible. But is it possible to react as per this clock because in the Atmel controller the timer runs as per the external interrupt.Please let me know.
Also one more catch is that the SLAVE SELECT (SS or CS) pin should be turned high just before the transfer and then turned low during the entire transfer. The WM8731 is an I2S device and SPI was used to spoof I2S using the atmel controller.
Some weeks ago another user posted an I2S guide to use the Edison with the WM8731 codec which is the same as yours. I recommend you to check his guide because it might be very useful for you: Intel Edison - Simple I2S Audio Setup - Malinov Family Web Presence
Additionally, there is another thread about external I2S audio codec with Edison that you might find interesting:
You can find and Audio Setup Guide in the following link as well: Intel® Edison Boards — Audio Setup Guide
I hope you find these resources useful, specially the guide about the WM8731 codec.
I want to do the same from the Arduino programming interface. The first link you gave gives shell scripts to configure the audio codec. How do I write a program from the arduino IDE which does the same or say gives access to the audio codec data?
I want to do the following from the Arduino IDE. I also want to get access to the mic and head phone out data like left_in,right_in and left_out,right_out.
# reset codec
i2cset -y 1 0x1a 0x1e 0x00
# disable DAC and output powerdown
i2cset -y 1 0x1a 0x0c 0x07
# set volume for headphone output (both channels)
i2cset -y 1 0x1a 0x05 0x65
# analog audio path control (DAC enabled)
i2cset -y 1 0x1a 0x08 0x12
# digital audio path control
i2cset -y 1 0x1a 0x0a 0x00
# set sample rate (48000Hz, assuming 12.288MHz codec clock)
i2cset -y 1 0x1a 0x10 0x00
# digital audio interface format set (DSP mode, 24 bit)
i2cset -y 1 0x1a 0x0e 0x8b
# activate interface
i2cset -y 1 0x1a 0x12 0x01
You can run the shell commands from the Arduino sketch as follow:
So for example, you could use the following line in your Arduino sketch to run the reset-codec command:
system("i2cset -y 1 0x1a 0x1e 0x00");
I2C is just used to set the codec but to read the actual data from it live we need some sort of an I2S interface or a modified SPI which implements I2S on the low level. So tell me how do I do I2S with this now. The first link you mentioned gives only i2c commands.
You're right. The I2C is used to configure the codec. The I2S specifics are in the Audio Setup Guide that I suggested you before: Intel® Edison Boards — Audio Setup Guide. I don’t have any audio codec to test it, but according to the first guide I mentioned (Intel Edison - Simple I2S Audio Setup - Malinov Family Web Presence) and the thread that I also suggested you before (External I2S wm8958 audio codec information), you can use the "dummy" codec provided in the Edison firmware. This "dummy" codec is described in the Audio Setup Guide.
Also, according to these threads:
There are two ways to setup a codec. One of these options is the one described in the first guide I recommended you, which configures the codec through I2C and then uses the "dummy" codec. The other one consists in writing a machine driver for your codec, which needs kernel modifications. Anyhow, the Audio Setup Guide provides useful information so I recommend you to check it. As of now, that is all the information available about audio and I2S.
As I said, I don’t have the audio codec to test it, but you can also post your doubts in this other thread where there is a discussion about setting up an audio codec using I2S: External I2S wm8958 audio codec information. Other users can also give you their suggestions since they have actually tried working with audio codecs.
There is a timer interrupt example for edison.It uses the Timerone.h library. I tried to use it but I am not getting any proper results with it. I want to turn a pin ON and OFF at 44khz. So I set the timer to 22 microseconds but the ISR does not work at that rate at all. So Timerone.h library is not doing what it is supposed to do. Is it possible to use the MCU SDK and get better results?
Also when I tried to develop a library for arduino Due the digitalWrite function was putting the pin on for 1 microsecond which was too high for my application.So I used direct GPIO control in C and I was getting a 200 ns high time. Is there a way to use fast gpio turn On and Off with the edison. There are some libraries I came across indicating that.
There are many libraries in the core directory which do some thing in fast gpio access. Which one should I use to switch pins at high speed?
Can we use MCU specific code (like its C code in the SDK) in the arduino IDE? I think only then we can get the best out of the micro controller.
I am used the following function
with which I am able to turn the pin ON and OFF at high speed but when I see the output on the oscilloscope it shoots to more than 5V though the J9 jumper is set to 3.3V. This is problematic when we want to interface to 3.3V electronics.
See that each cell is 2V and the peak to peak is 6V !!!