Hi
The steps you need to take are:
(1) Initialise the appropriate Pin Assignment Register (PnPAR). Many of the pins on ColdFire are used for more than one function, so you need to specify that you want the GPIO usage.
(2) Initialise the appropriate Data Direction Register (DDRn) to specify whether you want the pin to be a GPIO Input or Output.
(3) For an output, specify the value you want to drive on the pin. There are several ways of doing this. One way is to write to the appropriate Port Output Data Register (Called PORTn on the 52235, although some other ColdFire families call it PODRn).
See the GPIO section of the manual for more details.
Here's some code for Freescale's M52235EVB evaluation board which flashes two LEDs connected to the timer port TC[3] and TC[2]:
/* Pin assignments for port TC
Pins are all GPIO outputs
*/
MCF_GPIO_DDRTC = MCF_GPIO_DDRTC_DDRTC3 |
MCF_GPIO_DDRTC_DDRTC2 |
MCF_GPIO_DDRTC_DDRTC1 |
MCF_GPIO_DDRTC_DDRTC0;
MCF_GPIO_PTCPAR = 0;
/* Loop to flash LEDs 2 (DTIN2) and 3 (DTIN3) alternately */
MCF_GPIO_PORTTC ^= MCF_GPIO_PORTTC_PORTTC3;
while (1) {
MCF_GPIO_PORTTC ^= MCF_GPIO_PORTTC_PORTTC3 |
MCF_GPIO_PORTTC_PORTTC2;
for (i = 0; i 2000000; i++)
asm (nop);
}
Hope this helps.
Simon