11 years, 6 months ago.

Unable to read mbed/LPC1768 P1.25 & P1.26 (DP83848J LED_LINK & LED_SPEED) pins

Greetings.

I'm struggling to read the DP83848J LED_LINK & LED_SPEED pins that, according to the mbed schematic, are connected to LPC1768 P1.15 and P1.26 pins. I know that these pins are not readable using the common DigitalIn or InterruptIn so I was trying to read them using:

pc.printf("LPC_GPIO1->FIOPIN=%u\n", LPC_GPIO1->FIOPIN);

EthernetInterface eth;
eth.init();
eth.connect();
pc.printf("IP Address is %s\n", eth.getIPAddress());
pc.printf("Done!\n");
.
.
.
pc.printf("LPC_GPIO1->FIOPIN=%u\n", LPC_GPIO1->FIOPIN);

Both bits corresponding to P1.25 & P1.26 do not change. Also, according to the DP83848J datasheet, as far as I understand, the output of these pins is always present.

Am I missing something? Aren't the pins connected to LPC1768 like the mbed schematic details?

Thank you for your help.

Regards,

Pedro Jorge

I have not tried reading these pins, but you should be able to use them as regular mbed pins

DigitalIn ledlnk(P1_25);

Maybe they need pullup mode enabled.

posted by Wim Huiskamp 18 Jan 2013

Greetings.

It does work! It must me in OpenDrain, just after the PHY is initialized. The InterruptIn does not work (actually, it crashes the mbed) because the P1 GPIO does not offer interrupts.

Thank you for your help.

Regards,

Pedro Jorge

posted by Pedro Jorge 28 Jan 2013

I tried this and the mbed hangs when reading the Digital input state. I also tried setting the input mode to PullUp. How did you get it to work?

posted by Adrian Watter 15 Mar 2013

Hi Adrian.

This was the code I used:

DigitalIn link(P1_25);
DigitalIn speed(P1_26);

DigitalOut link_led(p29);
DigitalOut speed_led(p30);

void status(void const *n) {
    link_led.write(!link.read());
    speed_led.write(!speed.read());
}

link.mode(PullUp);
speed.mode(PullUp);

RtosTimer status_timer(status, osTimerPeriodic, (void *)0);
status_timer.start(250);
link.mode(OpenDrain);
speed.mode(OpenDrain);

I hope this helps.

Regards,

Pedro Jorge

posted by Pedro Jorge 19 Mar 2013
Be the first to answer this question.