cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 General questions

martin239955
Associate II
Posted on March 30, 2015 at 11:26

Hello,

I try to make a demoboard with a STM32F4 controller but I have some problems: Which pins I need to use the stlink programmer from a nucleo board (swdio, swclk ,... )? I found in the datasheet, that some functions are connected to more than one pin how the usart1_tx. How I can select which pin should be used? On the nucleo I tried to turn on the led but with eclipse it doesn't turned on. When I used the online compiler the led turned on. I think the online compiler inits the microcontroller.

I used this minimalistic code:

RCC->AHB1ENR |= 1;        //enable clock for port A

GPIOA->MODER |= (1<<10);     //port A as output

GPIOA->ODR |= (1<<5);         //Set pin 5

Is there something I forgot to init that it doesn't work?

Thank you.
3 REPLIES 3
Posted on March 30, 2015 at 15:10

The debug interface has pretty define pins, SWCLK, SWDIO, (SWO optional), NRST (strongly advised), GND, VCC (depending on what voltage, and how's supplying it)

To route USART1_TX to a specific pin you have to configure the AFR (pin muxing), if you use the standard library via GPIO_PinAFConfig()

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
martin239955
Associate II
Posted on March 31, 2015 at 16:27

Thank you.

I would have an external supply so I need only GND? What is NRST?

But are the registers just set at reset that I can start with that minimal code?
Posted on March 31, 2015 at 16:44

NRST (NRESET), Negated Reset, the processor's reset pin, so the debugger can quickly gain control of the processor and stop it.

I believe the default register settings of the peripherals are defined in the Reference Manual. By the time it's reached your main() function, the CMSIS library should have already run SystemInit() in system_stm32f4xx.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..