input port buffer full

Technical questions regarding the XTC tools and programming with XMOS.
pasau
Experienced Member
Posts: 77
Joined: Fri Dec 06, 2013 7:05 pm

input port buffer full

Post by pasau »

Hi, what happens if you use an input buffered port (lets say with an 8 bit buffer with a 1 bit port) but the program doesnt input data fast enough

a) the port blocks until the buffer is read by the program, not inputting any data on the pins during that time
b) the port clears the buffer and starts over
c) the port overwrites every FIFO values, starting from the oldest, so that the data when input is not guaranteed to be byte aligned, or buffer-size aligned
d) something else

i know that for output buffered ports, the program blocks until the buffer is available for output, not so sure when its the other way around.

The information found there https://www.xmos.com/published/how-use- ... t?secure=1 to me seems to contradict itself, saying:
The XMOS architecture provides buffers that can improve the performance of programs that perform I/O on clocked ports. A buffer can hold data sampled by a port until the processor is ready to input it.
then
At most one value is sampled by the port and inserted to the FIFO per period of its clock. If the FIFO is full, the oldest value is dropped to make room for the most recently sampled value.


User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am

Post by segher »

d).

Values are taken from the port pins and inserted into the
shift register; if the shift register is full (contains 8 bits,
in your example) and the transfer register is empty, the
shift register content is copied to the transfer register.

Whether or not data is copied to the transfer register, the
shift register shifts.

So if you do not read data from the port fast enough, you
get the oldest data (from the transfer register), and after
that the first (aligned) data that managed to make the
shift register full again (in your case, the first group of 8
bits that finishes after you read the old data from the
transfer register).
pasau
Experienced Member
Posts: 77
Joined: Fri Dec 06, 2013 7:05 pm

Post by pasau »

good answer! thats clarified for me now thanks