MBED1768 Ethernet Speed & Link statues LEDs

Hello ,
I’m trying to get working 2 leds for ethernet speed and link status.
This is I have done so far, still no luck. The ethernet works fine
here is the part of my code

DigitalOut led3(LED3);
DigitalOut led4(LED4);
DigitalIn ethlink(P1_25);
DigitalIn ethspd(P1_26);

int main{
 ethlink.mode(PullNone); 
 ethspd.mode(PullNone);

eth.set_network(mbedIP,mbedMASK,mbedGATEWAY);
    eth.connect();

Thread TCPweb;
 Thread ethled;
 TCPweb.start(webpage_load);
 ethled.start(eth_led);

         while (true) {
        }
}

void we_pagelod{

//WEB PAGE
}
void eth_led(){
     while(true){     
      //   printf("ETH LINK: %d \n\r", ethlink.read());
      //   printf("ETH SPEED: %d \n\r", ethspd.read());
     led3=ethlink;
     led4=ethspd;
     }
 }

any suggestions ???
Thanks
Best Regards
Dan

Hello Dan,

According to the Mbed LPC1768 schematic the LED_LINK (P1_25) and LED_SPEED (P1_26) pins are digital outputs to drive LEDs rather than digital inputs. So try:

DigitalOut led3(LED3);
DigitalOut led4(LED4);
//DigitalIn ethlink(P1_25);
//DigitalIn ethspd(P1_26);
DigitalOut ethlink(P1_25);
DigitalOut ethspd(P1_26);
...

Best regards,

Zoltan

Hi Zoltan,
Thanks for your response
I’m bit confused now,
On DP83848, LED_Link(Pin 22) and LED _Speed(Pin 21) are outputs to drive the LEDs. Those pins connected to P1_25 & P1_26. That’s why I thought P1_25 & P1_26 on LPC1768 are the inputs.
Am I missing somthing??? :thinking:

Cheers
Dan

Hello Dan,
I’m sorry I didn’t check the DP83848 :frowning: . You are right. The lines connected to the P1_25 and P1_26 pins are driven by the DP83848 chip not by the LPC1768. However, according to the DP83848 datasheet it seems that the LEDs shall be connected to VCC (2.4 LED Interface - Figure 3) rather than to the ground. So the solution is to keep the definition of ehtlink and ethspd as DigitalIn and change the eth_led function as follows:

void eth_led(){
     while(true){     
      //   printf("ETH LINK: %d \n\r", !ethlink.read());
      //   printf("ETH SPEED: %d \n\r", !ethspd.read());
     led3=!ethlink;
     led4=!ethspd;
     }
 }

Best regards,

Zoltan

Hi Zoltan,
Yes ,(!) do the trick. :innocent:
Cheers
Dan