cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L GPIO

leone1386
Associate II
Posted on September 17, 2011 at 14:55

Hi.

I am a student and i must do a project with the STM32L-Discovery using SPI.

I found this code:

/**

  * @brief  Changes the mapping of the specified pin.

  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.

  * @param  GPIO_PinSource: specifies the pin for the Alternate function.

  *   This parameter can be GPIO_PinSourcex where x can be (0..15).

  * @param  GPIO_AFSelection: selects the pin to used as Alternat function.

  *   This parameter can be one of the following values:

  *     @arg GPIO_AF_RTC_50Hz: RTC 50/60 Hz synchronization

  *     @arg GPIO_AF_MCO: Microcontroller clock output

  *     @arg GPIO_AF_RTC_AF1: Time stamp, Tamper, Alarm A out, Alarm B out,

  *                           512 Hz clock output (with an LSE oscillator of 32.768 kHz)

  *     @arg GPIO_AF_WKUP: wakeup

  *     @arg GPIO_AF_SWJ: SWJ (SW and JTAG)

  *     @arg GPIO_AF_TRACE

  *     @arg GPIO_AF_TIM2

  *     @arg GPIO_AF_TIM3

  *     @arg GPIO_AF_TIM4

  *     @arg GPIO_AF_TIM9

  *     @arg GPIO_AF_TIM10

  *     @arg GPIO_AF_TIM11

  *     @arg GPIO_AF_I2C1

  *     @arg GPIO_AF_I2C2

  *     @arg GPIO_AF_SPI1

  *     @arg GPIO_AF_SPI2

  *     @arg GPIO_AF_USART1

  *     @arg GPIO_AF_USART2

  *     @arg GPIO_AF_USART3

  *     @arg GPIO_AF_USB

  *     @arg GPIO_AF_LCD

  *     @arg GPIO_AF_RI

  *     @arg GPIO_AF_EVENTOUT: Cortex-M3 EVENTOUT signal

  * @note: The pin should already been configured in Alternate Function mode(AF)

  *        using GPIO_InitStruct->GPIO_Mode = GPIO_Mode_AF

  * @note: Please refer to the Alternate function mapping table in the device 

  *        datasheet for the detailed mapping of the system and peripherals�

  *        alternate function I/O pins.  

  * @note: EVENTOUT is not mapped on PH0, PH1 and PH2.  

  * @retval None

  */

void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF)

{

  uint32_t temp = 0x00;

  uint32_t temp_2 = 0x00;

  

  /* Check the parameters */

  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));

  assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));

  assert_param(IS_GPIO_AF(GPIO_AF));

  

  temp = ((uint32_t)(GPIO_AF) << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4)) ;

  GPIOx->AFR[GPIO_PinSource >> 0x03] &= ~((uint32_t)0xF << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4)) ;

  temp_2 = GPIOx->AFR[GPIO_PinSource >> 0x03] | temp;

  GPIOx->AFR[GPIO_PinSource >> 0x03] = temp_2;

}

but i don't know which GPIO peripheral are A, B, C, D, E and H. I have looked it up in the serveral doc, but i didn't find it.

Can someone tell me which GPIO peripheral represent A, B, C, D, E and H?

Thanks

#stm32l-discovery
2 REPLIES 2
leone1386
Associate II
Posted on September 20, 2011 at 15:24

Understood 

Thanks :)