Bidirectionality of a XU316-1024-QF60B-C24 pins

Technical discussions around xCORE processors (e.g. xcore-200 &
User avatar
New User
Posts: 3
Joined: Tue Nov 14, 2023 7:46 pm

Bidirectionality of a XU316-1024-QF60B-C24 pins

Post by elektron314 »

Hello everyone!

I'm developing a board based on XU316-1024-QF60B-C24 and I see this sentence in the datasheet, 4 Signal Description and GPIO
All pins of a port provide either output or input, but signals in different directions cannot be mapped onto the same port

But as I'm trying to interconnect everything a question arrises.
How bidirectional busses work? I2C is the simplest pin to have this question. SDA pin is bidirectional but according to the statement above it's not possible to implement this stuf.

Who can explain this to me?
Any help and advises are appreciated!
User avatar
XCore Addict
Posts: 213
Joined: Mon Jan 08, 2018 4:14 pm

Post by fabriceo »


in fact, say for a 4 or 8 bits port, you cannot specify the direction at the bit level. The whole port is either out or in.
but you can set it as output drive high or output drive low, with pull down or pullup respectively.
this is the trick for I2C which is drive-low with (external) pull-ups .
then to read the pin values you can use the peek() function.

hope this helps
Posts: 27
Joined: Mon Nov 21, 2022 5:38 pm

Post by lmariotti »

Be sure not to confuse ports with pins, ports are a grouping of pins (1-4-8-16-32) and as fabriceo said each pin in the same port must have the same direction.

Anyway I've already posted a question on this forum to better understand how to use pins, I hope it will help: ... pio#p40198
Experienced Member
Posts: 124
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

elektron314 wrote: Tue Nov 14, 2023 7:53 pm
How bidirectional busses work? I2C is the simplest pin to have this question.
Simple explain is semantic code

Code: Select all

set port 4E as input
all pins is input check somethink on it
switch port 4E to output open drain or based on your schematics
write out data for SDA ACK on one bit
set port 4E back to input mode...
Active Member
Posts: 41
Joined: Sun Dec 13, 2009 1:12 am

Post by Joe »

The statement in the datasheet is just trying to emphasise that all bits of a port will be set to the *same* direction of input or output. i.e. say for a 4 bit port you cannot have say bits 0 and 1 as output and bits 2 and 3 as input at the same time. You must have all four bits as output or input at any given time. Obviously they can be input or output at different times, so they can input a word and then output a word which makes the port bidirectional.

For your example of I2C SDA line, this is typically connected to a 1-bit port which obviously only has one bit so this point isn't relevant. This port is turned around from output to input at the times required by the I2C spec etc.
Principal Hardware Engineer