Can I use several pins for the UART with the XMOS?

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
User avatar
mifay
Member++
Posts: 29
Joined: Wed Dec 28, 2011 4:15 pm

Can I use several pins for the UART with the XMOS?

Postby mifay » Wed Dec 28, 2011 6:44 pm

Hello,

My team is working on building an avionic module on a rocket. One of the micro-controllers is an XMOS XK-1A and we're planning to link it to several electronic components.

Some of these electronics are using UART to communicate with the XMOS (Xtend and Xbee transmettors for instance). Besides the hardware TX/RX pins (pins 24 and 25) of the XMOS, is it possible to create software TX/RX pins from digital pins? Such thing is possible with the Arduino : http://www.arduino.cc/en/Reference/SoftwareSerial. Is something similar possible with the XMOS?

Thanks
jagspaul
Experienced Member
Posts: 117
Joined: Tue Oct 18, 2011 3:28 pm

Postby jagspaul » Wed Dec 28, 2011 9:31 pm

XMOS don’t have any serial communication engine. You have to write your serial Rx Tx routine and you can use any 1bit I/O as Rx-Tx pin, however in case of crisis of 1bit I/O you can use 4 or 8 bit port with proper bit masking.

Regarding TX/RX pins (pins 24 and 25), actually in Xtag-2 there is a built in serial to USB converter which is connected to this pin. If any body want to serial communication with PC through Xtag-2 he has to use this two pin as Rx/Tx.

jags
User avatar
mifay
Member++
Posts: 29
Joined: Wed Dec 28, 2011 4:15 pm

Postby mifay » Wed Dec 28, 2011 11:24 pm

Thanks, your reply helped me a lot to figure out about XMOS I/O
Heater
Respected Member
Posts: 296
Joined: Thu Dec 10, 2009 10:33 pm

Postby Heater » Thu Dec 29, 2011 2:00 am

mifay,

Welcome to the forum. Sounds like an interesting project.

Yes, you can make a UART TX/RX pins on other pins than the 24/25.

BUT as you may have noticed XMOS pins come in groups (ports) of 4 pins and 8 pins and so on. Check you device documentation to see what physical pins are available in the various port configurations. Check your board documentation to see what pins are actually available on the connectors.

Here come the little "gotchas":

When you are dealing with a group of pins as say an 8 bit port then ALL the pins are either input or output depending on your programming. So there is no using 6 pins as output and 2 as input in an 8 bit port for example.

For a UART ideally you want to find two pins on the device that can be used as one bit ports. One port as output (Tx) and one port as input (Rx). Then you have be sure those one bit ports come out on the boards connectors.

I don't remember or have the details to hand as to how many such ports/pins exist on the XK-1A. Hopefully there is at least one other usable pair apart from the default UART port. You will have to check the docs.

If no such single bit ports are available then you will have to think about using a 2 or 4 or more bit port. This is a shame as you them waste 1 or 3 etc pins for both TX and RX and/or makes it necessary to modify the UART implementation code to share those pins with other functionality.
User avatar
phalt
Respected Member
Posts: 298
Joined: Thu May 12, 2011 11:14 am

Postby phalt » Thu Dec 29, 2011 4:31 pm

Post moved to more appropriate forum
User avatar
mifay
Member++
Posts: 29
Joined: Wed Dec 28, 2011 4:15 pm

Postby mifay » Thu Dec 29, 2011 10:18 pm

Thanks a lot Heater,

According to the XK-1A hardware documentation, there are several 1 bit digital pins that I could use for UART communication. Then if I understood well, I guess I'll have to use the UART library in order to make this all work.
User avatar
dan
Experienced Member
Posts: 102
Joined: Mon Feb 22, 2010 2:30 pm

Postby dan » Fri Jan 06, 2012 11:34 am

Hello heater and mifay.

Just a quick note to let you know we shall shortly be releasing a 'multi uart' component. This will use two threads and two 8 bit ports which will provide 8 uarts with RX and TX up to 115K baud rate. Likewise we now have some PWM components that can driver multiple PWM channels on an 8 bit port.

Also we are working on multi function serial components that would combine say, 1 uart, 1 I2C master and 1 SPI master in one thread, but using 1 bit ports.

So we recognise the problem of not being able to effectively use multi bit ports for simple serial buses, and also the problem of needing to use a whole thread for something simple like a uart or I2C master.

The first release will be this MUART component but I'd be keen to hear thoughts on what other combos would be useful.

- Dan

Who is online

Users browsing this forum: No registered users and 7 guests