9 years, 2 months ago.

Using USB pins for Digital I/O?

I need a couple more I/O pins on my mbed LPC1768 project. I am not using the USB interface and wondered if I could use the USB pins (mbed pins 31 and 32) for DigitalIn and DigitalOut.

I realise there are some passives connected to these pins, but this does not matter in my application.

According to the LPC1768 user manual, these pins can be configured as Port I/O (p31 = Port 0.29 and p32 = Port 0.30). However, declaring DigitalIn or DigitalOut with PinName p31 or p32 doesn't work - the compiler outputs an "Identifier p31/p32 is undefined" error.

Nas anybody succeeded in doing this? If so, how?

Dear Paul, Have you managed to use de USB pins for Digital I/O?

posted by FYLA LASER 05 Sep 2018

2 Answers

9 years, 2 months ago.

I quickly looked at it once, and didn't see a reason why it wouldn't work, just the pin numbers aren't defined. Try using P0_29 and P0_30 instead. If it works I guess they might as well get added.

Accepted Answer

Thanks Erik, that works nicely.

posted by Paul Griffith 14 Mar 2014
9 years, 2 months ago.

I check the pins,It is ok and you can use p0.29 and p0.30 as GPI/O I dont know which way of coding you use but I use CMSIS. Using these configuration made these pin I/O:

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 0;
	PinCfg.Pinnum = 29;
        PinCfg.Pinnum = 30;

of course for using these code you should have included "lpc17xx_pinsel.h" to your main program

code edited

posted by mohsen nops 15 Mar 2014