11 years, 9 months ago.

DigitalOut p9

Do I need to do something other than define a digital out for multifunction outputs?

For example I find defining DigitalOut x(p8) works fine and I can control the output

But when I try DigitalOut x(p9) there is no change in state on this line.

Feel sure I'm missing something simple but haven't managed to find it.

Can you help?

3 Answers

11 years, 9 months ago.

/cookbook/Cool-Components-Workshop-Board#c1621

If it is revision 2A, p9 is tied to 3.3V due to a routing error. you can cut the trace on the topside going to the SD slot to reclaim p9. If it is rev 2B "card detect" should work so you can just put a card in or bend up the two metal flaps on the SD slot housing.

I opened a ticket on this at coolcomponents and was told that they had fixed it but for some strange reason, my 2A board still refuses to magically morph into a rev 2B :-(

Accepted Answer

Many thanks for this information, I've now cut the tracks on both boards and have p9 working.

posted by Mel Strachan 11 Mar 2013
11 years, 9 months ago.

Hi Mel, can you paste your code (use the <<code>> your code <</code>> tag for better reading) and what mbed model are you using to help you. In theory for using a pin like DigitalOut you have to define it, and then assign a value to it. For example:

DigitalOut myPin(p9);

int main() {
  while(true) {
     myPin=1;  //put the pin in a high state
     wait(0.2);
     myPin=0; //put the pin in a low state
     wait(0.2);
   }
}

Greetings

Sure, I'm using LPC1768 mbed and my code is:

#include "mbed.h"

DigitalInOut myled(p9);

int main() {
    myled.output();
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}

I've used the code from the DigitalOut example and changed the port from LED1 to a pin. The other ports seem fine (I've tested p5,6,7,8 and 10). I'm using a led with resistor to a +5v supply to test the outputs and the led will flash on all the tested ports except p9. On p9 the led has a continuous low current glow to it, and I've changed to my second mbed (also a LPC1768) and see the same effect so I don't think I have a damaged output.

posted by Mel Strachan 08 Mar 2013

Hi Mel. can you add your schematic? i have a doubt because you say you connect the led with a resistor to a +5 supply?. Is the led connected this way:

pin9 ====> led ====> resistor ===> ground

Greetings. I will check your code in my mbed lpc1768 in the night

posted by Ney Palma 09 Mar 2013

Hi Mel, i do my test with this code:

#include "mbed.h"

DigitalInOut myled(p9);

int main() {
    myled.output();
    
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}

I connect the led in this form

mbed pin9 ===>(+) led (-) ==>> 120 ohms resistor ===> mbed GND

And everything works ok, the led blinks in pin9 every 0.2 seconds

Greetings

posted by Ney Palma 09 Mar 2013

Thanks for your advice, I've carried out a test on p9 using

mbed pin9 ===>(+) led (-) ==>> 120 ohms resistor ===> mbed GND

and my led stay on, no flashing ( and the test works on p8).

Looks like I have the same fault on both my boards

posted by Mel Strachan 10 Mar 2013

mmmm that´s weird mel, everything works fine to me, the led blinks in my board.

posted by Ney Palma 10 Mar 2013

Some-where in the dim and distant past ...

one or both of the I2C pins are Open Collector / Open Drain, So the pin on its own, cannot go Hi.,

It requires a pull up resistor,

or, you put the LED to 3V3.

... I think this was on the LPC11U24, but ...

Ceri

posted by ceri clatworthy 11 Mar 2013

Yep thats the 11u24, and other pins. On the LPC1768 mbed all available pins have push/pull cmos output available.

posted by Erik - 11 Mar 2013
11 years, 9 months ago.

Mel are you sure you have nothing else connected to p9 on your board?

I'm using a Coolcomponents mbed workshop board with only one link from the led and resistor to ground. I get the same result on my spare board.

posted by Mel Strachan 11 Mar 2013

Hi Mel, have you try to used the mbed in a breadboard (without using the mbed workshop board) and connect the led to see if it works?

posted by Ney Palma 11 Mar 2013

Good suggestion Ney, all works fine now!

I had a look at the Coolcomponents board (493141/1110) and both show a connection between p9 and p33,34,35,36 all 1ohm and 0ohm to the metal work of the miniSD slot (no connection to ground or metal work of the other connectors). Perhaps something on the internal tracking of the board as there is nothing obvious on the surface.

Once again thanks for your helpful suggestions

Mel

posted by Mel Strachan 11 Mar 2013