Configuring PortE on 5282

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

Configuring PortE on 5282

3,367 Views
SVC2
Contributor II

Hi,

I am trying to configure portE on 5282 without success. I would like to have PE2 and PE3 configured as output. So I am setting:

 

#define MCF5282_GPIO_DDRE  (*(vuint8  *)(void *)(&__IPSBAR[0x100018]))
#define MCF5282_GPIO_PEPAR (*(vuint16 *)(void *)(&__IPSBAR[0x100052]))


    MCF5282_GPIO_DDRE = 0x8 | 0x4;
    MCF5282_GPIO_PEPAR = 0;

 

 

I am trying to toggle the pin using:

 

 MCF5282_GPIO_PORTE  |=  (0x8);// set 1
 MCF5282_GPIO_PORTE &= ~(0x8);// set 0

 

It DOES NOT work.

What I am doing wrong?

Thanks,
S.

 

PS: I also tried:

#define MCF5282_GPIO_SETE    (*(vuint8  *)(void *)(&__IPSBAR[0x10002C]))
#define MCF5282_GPIO_CLRE     (*(vuint8  *)(void *)(&__IPSBAR[0x100040]))

 MCF5282_GPIO_SETE |=  0x8;
 MCF5282_GPIO_CLRE |=  0x8;

Labels (1)
0 Kudos
Reply
11 Replies

1,660 Views
bkatt
Contributor IV

SVC2 wrote:

Hi,

I am trying to configure portE on 5282 without success. I would like to have PE2 and PE3 configured as output. So I am setting:

 

(snip)


MCF5282_GPIO_DDRE = 0x8 | 0x4;
MCF5282_GPIO_PEPAR = 0;

 

 

I am trying to toggle the pin using:

 

MCF5282_GPIO_PORTE |= (0x8);// set 1
MCF5282_GPIO_PORTE &= ~(0x8);// set 0

 

It DOES NOT work.

What I am doing wrong?

Thanks,
S.

 

PS: I also tried:

(snip)

MCF5282_GPIO_SETE |= 0x8;
MCF5282_GPIO_CLRE |= 0x8;


If your 5282 powers up in "master" mode (with an external bus), those pins are used for SIZ[1:0] and controlled by the CCR register. This is the default even if your program never writes the CCR, and the CCR setting prevents your write to the PEPAR from having the desired effect.

 

Once you get past the configuration issues, the SETE and CLRE registers should be used with simple assignments. The whole idea is to make bit output easier than |= or &=~ on the PORTE register:

MCF5282_GPIO_SETE = 0x8;
MCF5282_GPIO_CLRE = 0x8;

Message Edited by bkatt on 2009-05-05 02:27 PM
Message Edited by bkatt on 2009-05-05 02:28 PM
0 Kudos
Reply

1,660 Views
RichTestardi
Senior Contributor II

Just to be safe, I believe this:

 

> MCF5282_GPIO_CLRE = 0x8

 

Should actually be:

 

> MCF5282_GPIO_CLRE = ~0x8

 

Writing a 0 clears the corresponding bit; writing a 1 has no effect.

 

(I assumed you wanted to clear a single bit.)

 

-- Rich

0 Kudos
Reply

1,660 Views
SVC2
Contributor II

I am using the external bus (master mode)!

 

Those this mean I cannot use PORTE bit 3 as Digital Output?

 

Thanks,

S

 

 

 

0 Kudos
Reply

1,660 Views
bkatt
Contributor IV

SVC2 wrote:

I am using the external bus (master mode)!

 

Does this mean I cannot use PORTE bit 3 as Digital Output?


If you change the CCR port first, then your configuration of PORT E should work.

0 Kudos
Reply

1,660 Views
dhar
Contributor I
hi there, have you already solved this problem? I also don't have any output on PORT A.
0 Kudos
Reply

1,660 Views
SVC2
Contributor II

I avoided using PortA as output.

 

0 Kudos
Reply

1,660 Views
dhar
Contributor I

hi there!

   

    what i mean is that an example that would give a +5V or 1 in a certain port that is connected to an LED...

0 Kudos
Reply

1,660 Views
SVC2
Contributor II

   /* Pin assignments for port EH
           Pin(s) 0,5-7, are GPIO inputs
           Pin(s) 1-4 are GPIO outputs
    */
    MCF5282_GPIO_DDREH = MCF5282_GPIO_DDRx4 |
                                      MCF5282_GPIO_DDRx3 |
                                      MCF5282_GPIO_DDRx2 |
                                      MCF5282_GPIO_DDRx1;
    MCF5282_GPIO_PEHLPAR = 0;

 

#define TURN_GREEN_LED_ON()  (MCF5282_GPIO_SETEH =  MCF5282_GPIO_SETx3)  
#define TURN_GREEN_LED_OFF() (MCF5282_GPIO_CLREH = (uint8)(~MCF5282_GPIO_SETx3)) 

 

 

0 Kudos
Reply

1,660 Views
dhar
Contributor I
btw, where can i find portEH?

how about using other ports? i mean how can i send an output of +5 volts in other ports so that it will light up the LED connected to the port other than portEH?

 

thanks for your help!

0 Kudos
Reply

1,660 Views
mjbcswitzerland
Specialist V

Hi

 

For an analysis fo the port properties on the M5282 (and family) see the following document:

http://www.utasker.com/docs/Coldfire/uTaskerM5282.PDF

 

Regards

 

Mark

 

www.uTasker.com

 

0 Kudos
Reply

1,660 Views
dhar
Contributor I

can you give us an example code in C language that would make any ports light up...

 

0 Kudos
Reply