Synchronising Clocked I/O on Multiple Serial Ports

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
User avatar
lilltroll
XCore Expert
Posts: 955
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Synchronising Clocked I/O on Multiple Serial Ports

Postby lilltroll » Wed Dec 16, 2009 6:14 pm

How do you combine the chapter 5.2 (Programming XC on XMOS Dev)
Synchronising Clocked I/O on MultiplePorts with Serialising Output Data correctly ?

How do you know that the statement "a single thread can cause data to be sampled and driven in parallel on these port" will be able to handle it's task in time ? If I would use for an example more and more buffered serial ports in parrallell wouldn't the processor get starved out of time at high speeds? Or is it dedicated HW for that conected to the ports ? For an example communicating with an Audio-Codec with a master clock of ~25 MHz.

after the setup of the ports and the CODEC, I would use the sync(); there after I would just write what communication that I would like to happen in parrallell in the main. In this example, I have
1 clock pin out - Serial_Control_port_Clock
2 data pins out - LeftRightClock and OUT
1 data pin in - IN

And all of four pins have to run in parrallell on one thread

Code: Select all

sync(Serial_Control_port_Clock)

int main(){
//some code

while(1){
LeftRightClock <: 0x8000000;
OUT             <: AUDIO_Right;
IN                :> AUDIO_Right; 
LeftRightClock <: 7FFFFFFF;
OUT             <: AUDIO_Left;
IN                :> AUDIO_Left;

}
return...
It works at 44.1 kHz and a Master clock of 11.268 MHz, but it is getting non-deterministic at higher speeds. (The example is a general one, and does not work for 44.1 kHz)
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
lilltroll
XCore Expert
Posts: 955
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Postby lilltroll » Thu Dec 17, 2009 12:49 am

Well, I made it work for 44.1, 48, 88.2, 96 and 192 kHz.
176.4 kHz is not solved yet since it becomes special then Masterclock and Serial clock has the same speed.

But it's still a little bit 'magic' that happens in the background.
Probably not the most confused programmer anymore on the XCORE forum.

Who is online

Users browsing this forum: No registered users and 5 guests