I/O Pins

The Propeller has 32 I/O pins, 28 of which are entirely general purpose. Four I/O pins (28 - 31) have a special purpose at Boot Up and are available for general purpose use afterwards; see the Boot Up Procedure section on page . After boot up, any I/O pins can be used by any cogs at any time since I/O pins are one of the common resources. It is up to the application developer to ensure that no two cogs try to use the same I/O pin for conflicting purposes during run-time.

For details of the I/O hardware, refer to the internals of the cogs in Figure 1-2 on page 20 while reading the following explanation.

Each cog has its own 32-bit I/O Direction Register and 32-bit I/O Output Register to influence the directions and output states of the Propeller chip's corresponding 32 I/O pins. A cog's desired I/O directions and output states is communicated through the entire cog collective to ultimately become what is called "Pin Directions" and "Pin Outputs" in the upper right corner of Figure 1 2 on page .

The cog collective determines Pin Directions and Pin Outputs as follows:

  1. Pin Directions are the result of OR'ing the Direction Registers of the cogs together.
  2. Pin Outputs are the result of OR'ing the output states of the cogs together. A cog's output state consists of the bits of its I/O modules (the Counters, the Video Generator, and the I/O Output Register) OR'd together then AND'd with the bits of its Direction Register.

In essence, each I/O pin's direction and output state is the "wired-OR" of the entire cog collective. This allows the cogs to access and influence the I/O pins simultaneously without the need for any resource arbiter and without any possibility of electrical contention between the cogs.

The result of this I/O pin wiring configuration can easily be described in the following simple rules:

  1. A pin is an input only if no active cog sets it to an output.
  2. A pin outputs low only if all active cogs that set it to output also set it to low.
  3. A pin outputs high if any active cog sets it to an output and also sets it high.

Table 1 4 demonstrates a few possible combinations of the collective cogs' influence on a particular I/O pin, P12 in this example. For simplification, these examples assume that bit 12 of each cog's I/O hardware, other than its I/O Output Register, is cleared to zero (0).

Table 1 4: I/O Sharing Examples

 

 

 

 

Bit 12 of Cogs' I/O Direction Register

 

Bit 12 of Cogs' I/O Output Register

State of I/O Pin P12

Rule Followed

Cog ID

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7

 

 

Example 1

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

Input

A

Example 2

1 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

Output Low

B

Example 3

1 0 0 0 0 0 0 0

1 0 0 0 0 0 0 0

Output High

C

Example 4

1 0 0 0 0 0 0 0

0 1 0 0 0 0 0 0

Output Low

B

Example 5

1 1 0 0 0 0 0 0

0 1 0 0 0 0 0 0

Output High

C

Example 6

1 1 1 1 1 1 1 1

0 1 0 1 0 0 0 0

Output High

C

Example 7

1 1 1 1 1 1 1 1

0 0 0 1 0 0 0 0

Output High

C

Example 8

1 1 1 0 1 1 1 1

0 0 0 1 0 0 0 0

Output Low

B

Note: For the I/O Direction Register, a 1 in a bit location sets the corresponding I/O pin to the output direction while a 0 sets it to an input direction.

Any cog that is shut down has its Direction Register and output states cleared to zero, effectively removing it from influencing the final state of the I/O pins that the remaining active cogs are controlling.
Each cog also has its own 32-bit Input Register. This input register is really a pseudo-register; every time it is read, the actual states of the I/O pins are read, regardless of their input or output direction.

Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.