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;
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;
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
/* 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))
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!
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