Change the "Select" type for pins in PSoC Designer firmware

Question: How can I switch between "StdCPU" to "Global In" or "Global Out" bus within firmware?

 

Answer:

The Global Select Register be changed for the above purpose. The PRTxGS register decides if a GPIO pin is under the control of the CPU or is connected to the Global In or Global Out bus.

1. When the bit in PRTxGS register is cleared, the pin is under the CPU control (i.e. "StdCPU") and hence the pin state is modified by writing to the PRTxDR register.

2. When the bit in PRTxGS register is set, the pin is connected to the Global bus and connects to the internal hardware blocks."Global output or Global input" is decided by the drive mode of this pin. If GPIO drive mode is set to digital High Z state (DM[2:0] = 010b), then it is selected for Global Input and in non-High Z modes, the block is selected for global output


For example, following are the steps for changing the "Select" option for Pin0_4 from "StdCPU" to "GlobalOutEven_4":

1. Set the port global select bit high

PRT0GS |= 0x10

2. Set the drive state to any of the non-High Z states as per your requirements. Modify the PRT0DMx registers for the same.

For more details on PRTxGS and PRTxDMx registers, please refer to the technical reference manual.