/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / how do the extension connector ports relate to the primer 2?

Username:     
Password:     
             

Forum
  • Index
  •  » circleOS
  •  » how do the extension connector ports relate to the primer 2?

# 1   2011-03-08 18:57:43 how do the extension connector ports relate to the primer 2?

elite_101
New member
Registered: 2010-11-15
Posts: 2

how do the extension connector ports relate to the primer 2?

Hi there,

Can anyone help me, I have been looking to drive a simple LED flashing circuit using the Extension connector. But I am having a problem with using the ports, how does the code GPIO and USART relate to the actual ports on the 20pin extension connector header?

As is does GPIO_Pin_7 mean pin 7 on the connector the AUDIO_I2S2_SCK port??? Is there a diagram or map for GPIO and USART that shows this?

How could I drive a LED from one of the ports on the connector?

All help much appreciated!!

Offline

 

# 2   2011-03-09 04:32:55 how do the extension connector ports relate to the primer 2?

mikepo
Member
From: USA
Registered: 2010-12-03
Posts: 36

Re: how do the extension connector ports relate to the primer 2?

Does the Primer2 User manual have the information you need? The mapping of the extension connector is on page 8:
http://www.stm32circle.com/resources/do … Manual.pdf
For example Pin 16 on the extension connector is connected to pin PA.2 (GPIO Port A, Bit 2) and is also the TX line for USART2 (depending on how you configure the GPIO ports).

Basically the GPIO lines on the STM32F103VET6 are organized as "ports" GPIOA ... GPIOE, each having 16 bits (Bit 0 ... Bit 15).

Schematic: http://www.stm32circle.com/resources/do … r2_1_2.PDF

If you look at the "toggle" example that comes with Ride 7 (should be in C:\Program Files\Raisonance\Ride\Examples\ARM\Primer\Primer2\toggle), you can see how the built-in LEDs are flashed.

At the top is the definition section for the built-in LEDs (which are on GPIO Port E, Bits 0 and 1):

Code:

//LEDs port and pins
#define LEDS_GPIO       (GPIOE)
#define LEDS_RCC_GPIO   (RCC_APB2Periph_GPIOE)
#define LED0_PIN        (GPIO_Pin_0)
#define LED1_PIN        (GPIO_Pin_1)
#define LEDS_BOTH_PINS  (LED0_PIN|LED1_PIN)

So let's say you want to use pins 16 and 18 on the Extension connector (i.e PA.2 and PA.3), you should be able to change the above code from GPIOE to GPIOA and the Bits 2 and 3:

Code:

//LEDs port and pins
#define LEDS_GPIO       (GPIOA)
#define LEDS_RCC_GPIO   (RCC_APB2Periph_GPIOA)
#define LED0_PIN        (GPIO_Pin_2)
#define LED1_PIN        (GPIO_Pin_3)
#define LEDS_BOTH_PINS  (LED0_PIN|LED1_PIN)

Note: I didn't try this right now since my Primer is in use for something  else, but you probably get the idea.

Hope that helps,
Mike

Last edited by mikepo (2011-03-09 04:41:16)

Offline

 

  • Index
  •  » circleOS
  •  » how do the extension connector ports relate to the primer 2?

Board footer