Some of the pins In my stm32 boards do not work
Matthew Harrington
I am a beginner in embedded devices. I want to run a blinking my nucleo stm32f303ret6. here you can see the code that I used for three pins to toggle an led.
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1, 1); HAL_GPIO_WritePin(GPIOC, GPIO_PIN_15, 1); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, 1); HAL_Delay(1000); HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1, 0); HAL_GPIO_WritePin(GPIOC, GPIO_PIN_15, 0); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, 0); HAL_Delay(1000);when I wire the circuit on breadboard it works only for pin A10 but it does not work for pins C15,C14,C12. I check some other pins such as C1 and it worked.
why it doesn't work for some pins and doesn't work for some others? does it mean that the problem is with the pins themselves ???
I tried the exact code for several pins and I got different results.
111 Answer
The GPIO pins on STM32 are multiplexed to other on-chip peripheral functions, and may not all be available as GPIO on your particular board design.
As stated in the manual for your board section 6.7.2 OSC 32 kHz clock supply PC14 and PC15 are normally unavailable as they are used for the 32.768KHz low-speed external (LSE) oscillator. You can modify the board as described:
But any devices that utilise the low speed oscillator will then tun from the LSI which is very inaccurate. That is generally not critical you are using the RTC (Real-time clock), which will mot maintain accurate time/date using the LSI.
PC12 is less easy to explain, the user manual no longer includes the board schematic as I am sure they used to, but the manual suggest sit is normally connected to the I/O connector. PC12 is multiplexed to EVENTOUT and USART3_CK but it seems unlikely that you have configure either of those functions.
The Nucleo boards have a built-in ST-Link debugger, so you are able to directly inspect the GPIO and RCC registers to see if they are configured as you expect. It is also possible modify the registers in the debugger, for example to directly set the pin state via the ODR while code execution is halted,