cancel
Showing results for 
Search instead for 
Did you mean: 

Simple GPIO Question

rj
Associate II
Posted on January 18, 2013 at 18:12

First off, please bear with me as I am new to this new environment.....The board I am using is the STM32VL. Looking at the user manual, I found the description of the pins that I want to use for simple output push/pull. The user manual says that the ''main function'' is the same as the pin name (ie. PB10 --> Port B10). Now I have successfully been able to use other pins to do this simple output. The problem seems to be with a few certain pins. I have the pin, mode and speed already configured as well as the port clock speed that the pins are on. What am I doing wrong with these certain pins? I do not want to use their alternate functions, just their primary function for a simple high/low output...Any help would be appreciated.

6 REPLIES 6
Posted on January 18, 2013 at 19:42

So is PB10 a specific pin you have a problem with? What others?

I don't see PB10 conflicting with other board functions, care to post some code demonstrating your issue?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
rj
Associate II
Posted on January 18, 2013 at 20:41

Posted on January 18, 2013 at 22:21

Well a quick review of the schematic/manual and you'll observe that PC14 and PC15 are used by the 32.768 KHz X3 oscillator, you'll need to remove R15 and make the solder bridges SB14 and SB15 to use the external pins.

http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/USER_MANUAL/CD00267113.pdf

The pins that I'm currently experiencing difficulty is PC14 and PC15. This is the code Im using to configure the pins:

 

 

 //Internal Clock

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOC  | RCC_APB2Periph_ADC1, ENABLE) ;

 

void config(void)

{

  GPIO_InitTypeDef GPIO_InitStructure;

  

  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_14 | GPIO_Pin_15 ;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;

  GPIO_Init(GPIOC, &GPIO_InitStructure);

}

 

 

// set pin high

 

GPIOC->BSRR = GPIO_Pin_14;

 

GPIOC->BSRR = GPIO_Pin_15;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
rj
Associate II
Posted on January 19, 2013 at 01:09

I did see that, under the ''alternative function'' column. However the ''main function'' did not suggest anything out of the normal and since I wasn't using it in alternate mode I was concerned.... So what exactly is the purpose of the main function for that specific pin then?

Posted on January 19, 2013 at 01:50

I did see that, under the ''alternative function'' column. However the ''main function'' did not suggest anything out of the normal and since I wasn't using it in alternate mode I was concerned.... So what exactly is the purpose of the main function for that specific pin then?

Well there's that suffix (1) saying the default is for the oscillators.

You'll need to review that manual, and the ones for the F100 part, and F1 series in concert to understand what the reset behaviour is. Most default to GPIO inputs, where as others are committed to JTAG, and low-power oscillators. There are also a number of pins power from the low power (VBAT) domain, and these (PC13,14,15) have very low current, and frequency, drive capabilities.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
rj
Associate II
Posted on January 19, 2013 at 02:25

I should have looked more closely, especially at the electrical schematic of the mcu. Once again, thanks for your help clive1.