How to use Port C and D as general purpose I/O

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use Port C and D as general purpose I/O

Jump to solution
796 Views
adonisk
Contributor I

Hi, I'v very new on freescale, now I'm using S12X chip and I want use port c and d to control some LED.

 

but port C and D in S12X is using for EBI in default.

It's said: When not used with the alternative function, these pins can be used as general purpose I/O.

 

My question is: how to disable EBI and use port C D as general I/O?

 

Please show me code if possible.

 

Thank you for you reply.

Labels (1)
Tags (1)
0 Kudos
1 Solution
610 Views
RadekS
NXP Employee
NXP Employee

Hi Adonis,

External bus is 2nd Functionality (See Table 1-9. Pin-Out Summary).

When pins are not used with the any of alternative functions, these pins can be used as general purpose I/O.

So, you can use Port C/D as GPIO until you enable XEBI module. XEBI module could be used (is enabled) only in expended or emulated modes.

So, if you will use your MCU in normal or special single chip mode (MODA=MODB=0), you can use Port C/D only as GPIO.

For direction of port C/D, please use DDRC/DDRD registers. You can read/write value trough PORTC/PORTD registers.

Unfortunately ports C and D do not provide such high flexibility as other ports. You can just enable pull-ups (pull-down is not possible) and these pull-ups could be enabled only for whole port (we cannot choose which pins will have pull-ups). For more details, please check PUCR register.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
610 Views
adonisk
Contributor I

I'm using XEP100 by the way.

It's said like this on Reference Manual:

2.4.3.3 Port C, D

Port C pins PC[7:0] and Port D pins PD[7:0] can be used for either general-purpose I/O with the external

bus interface. In this case Port C and Port D are associated with the external data bus inputs/outputs

DATA15-DATA8 and DATA7-DATA0, respectively.

These pins are configured for reduced input threshold in certain operating modes (refer to S12X_EBI

section).

But I never found any information how to config it as general-purpose I/O within chapter S12X_EBI.

0 Kudos
611 Views
RadekS
NXP Employee
NXP Employee

Hi Adonis,

External bus is 2nd Functionality (See Table 1-9. Pin-Out Summary).

When pins are not used with the any of alternative functions, these pins can be used as general purpose I/O.

So, you can use Port C/D as GPIO until you enable XEBI module. XEBI module could be used (is enabled) only in expended or emulated modes.

So, if you will use your MCU in normal or special single chip mode (MODA=MODB=0), you can use Port C/D only as GPIO.

For direction of port C/D, please use DDRC/DDRD registers. You can read/write value trough PORTC/PORTD registers.

Unfortunately ports C and D do not provide such high flexibility as other ports. You can just enable pull-ups (pull-down is not possible) and these pull-ups could be enabled only for whole port (we cannot choose which pins will have pull-ups). For more details, please check PUCR register.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
610 Views
adonisk
Contributor I

You are correct!

Thank you RadekS, you did great help, I do appreciate for you.

0 Kudos