4 years, 8 months ago.

Pins PD0 & PD1 are not compiling

hii

i am using NUCLEO-F103RB and the online compiler

i need to use PD0 & PD1 in my code but when i try to use them the compiler is printing this error:

"Error: Identifier "PD_1" is undefined in "main.cpp", Line: 3, Col: 19"

i understode that this pins are not defined in the compiler

what can i do in order to use them ?

this is a simple code that i did for cheking these pins "

  1. include "mbed.h"

DigitalOut myled(PD_1);

int main() { while(1) { myled = 1; LED is ON wait(0.25); wait 250 ms myled = 0; LED is OFF wait(0.5); wait 500 ms } }

"

1 Answer

4 years, 8 months ago.

PD_0 and PD_1 pins are reserved for the external xtal oscillator or for the 8MHz external clock supplied from the ST-Link part of the nucleo. They may not have been defined in mbed-src code to avoid conflicts with the nucleo hardware. You should either use different pins for your DigitalOut or you have to import the mbed library source code and manually add the pin defines. Note that this may also mean the MCO clock solderbridge has to be removed and that you can only use the internal RC clocksource and not the more accurate xtal.

thank you

posted by Eyal Doppelt 20 May 2016