Multi I/O serial communication - tx bytes on each data line Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Multi I/O serial communication - tx bytes on each data line

Post by DemoniacMilk »

Hey everyone,

I read quite a lot of application notes on using Ports up to this point (yes, another topic on ports..).

But theres some questions that I still couldnt answer.
What i need is the following:
  • 2+n bit wide, unidiretional bus with n data signals, frame sync and clock.
  • The data signals are each transmitting bytes in parallel (not bits of a byte! Complete, serialized bytes)
wavedrom (1).png
possible solutions I see are:
  1. using lots of 1 bit ports
  2. using a 4/8/16 bit port (whatever is wide enough to fit, the bus width will be fixed)
Method 1) seems to be handy to serialize bytes onto a single pin, but consumes a lot of ports. I do get the signals I want on the different pins, but some of the signals are off by one bit or two (prolly due to the CPU time needed to put values onto the ports?). Is there a way to 'couple' multiple ports and have them start to output data at the same time?

Method 2) should not generate any timing problems and need less ports, but I think this approach requires to heavily modify the incoming data and mix bytes to generate the signal wanted? For two data signals id need to create a byte with clock info on bit 0 and 4, a data bit of byte1 on 1 and 5 etc and put that onto the port, what doesnt seem very nice to handle for different bus widths and would require quite some cpu time.

Do you have an idea/approach/hint on how to solve this?
You do not have the required permissions to view the files attached to this post.
View Solution
henk
Verified
Respected Member
Posts: 347
Joined: Wed Jan 27, 2016 5:21 pm

Post by henk »

Is n a power of 2?
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Post by DemoniacMilk »

Is n a power of 2?
Yes. its probably 2, maybe 4, with a very low chance of being 8.
henk
Verified
Respected Member
Posts: 347
Joined: Wed Jan 27, 2016 5:21 pm

Post by henk »

Hi DemoniacMilk,

XCORE200 parts support a ZIP/UNZIP instruction that enables you to take bytes and zip them up; if you do that four times on four words, you will end up with four words that you can put into a 4-bit port to be serialised out, pushing out the 4 words as desired. That leaves you with a 1-bit port for the clock, and a 1-bit port for the sync

The sync you will need to use a buffered one bit port where you drive 0x01 out, which will go high once and then stay low.

Cheers,
Henk
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Post by DemoniacMilk »

Hello Henk,
thats a nice hint. Thank you!

edit: In case anyone ever needs this again, I found an application note on exactly this topic!