µTasker Forum

µTasker Forum => NXPTM M522XX, KINETIS and i.MX RT => Topic started by: neil on October 19, 2008, 06:38:54 AM

Title: Using Ethernet Status as I/O
Post by: neil on October 19, 2008, 06:38:54 AM
Hi Mark,
   I have a project using the 55235, and want to use the Collision,RX, and TX status outputs as standard inputs and and outputs (want to use the speed and duplex only outputs). Is there anything within utasker I have to enable/displabe to allow me to do this?

Neil
Title: Re: Using Ethernet Status as I/O
Post by: mark on October 19, 2008, 10:58:34 AM
Hi Neil

As you probably know, the demo project uses the following to define whether the outputs are controlled by the PHY or not:

network.usNetworkOptions |= LAN_LEDS;       // PHY controls all outputs

or

network.usNetworkOptions &= ~LAN_LEDS;       // PHY doesn't control any outputs

You however have the possibility to override individual inputs/outputs as you wish. The Ethernet driver is configured very early on so by placing your own configuration code in the initialisation in application.c it will then override the setting.

#define ENABLE_PHY_LEDS     (ACT_LED_ENABLED | LINK_LED_ENABLED | SPEED_LED_ENABLED | DUPLEX_LED_ENABLED | COLLISION_LED_ENABLED | RX_LED_ENABLED | TX_LED_ENABLED);
// from m5223x.h
PLDPAR = ENABLE_PHY_LEDS; // configure all outputs under control of PHY (from M5223x.c)



PLDPAR &= ~(COLLISION_LED_ENABLED | RX_LED_ENABLED | TX_LED_ENABLED); // override these pins back to GPIO if originally set for PHY use


or, when not configuring for default PHY use

PLDPAR = (ACT_LED_ENABLED | LINK_LED_ENABLED | SPEED_LED_ENABLED | DUPLEX_LED_ENABLED); // set these pins for PHY control


If you have some inputs wired, the second method is probably best since it will avoid them being driven as outputs (possible short circuit) for the duration between the PHY configuration and the override.

Regards

Mark