AnsweredAssumed Answered

Pin PA8 configured as OUTPUT

Question asked by berland.guillaume on Jan 29, 2016
Latest reply on Jan 29, 2016 by Clive One
Hello,

I'm trying for several days to set up the pin PA8 (STM32F4) as output but I do not see anything with an oscilloscope.

Here is the code I use to configure the pin:

01.#define PORT_IO_A_8     ((Uint32)0)
02. 
03.GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
04.GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
05.GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
06. 
07.Uint32 port_a_mask =
08.            (PORT_IO_A_0  << 0 ) |
09.            (PORT_IO_A_1  << 1 ) |
10.            (PORT_IO_A_2  << 2 ) |
11.            (PORT_IO_A_3  << 3 ) |
12.            (PORT_IO_A_4  << 4 ) |
13.            (PORT_IO_A_5  << 5 ) |
14.            (PORT_IO_A_6  << 6 ) |
15.            (PORT_IO_A_7  << 7 ) |
16.            (PORT_IO_A_8  << 8 ) |
17.            (PORT_IO_A_9  << 9 ) |
18.            (PORT_IO_A_10 << 10) |
19.            (PORT_IO_A_11 << 11) |
20.            (PORT_IO_A_12 << 12) |
21.            (PORT_IO_A_13 << 13) |
22.            (PORT_IO_A_14 << 14) |
23.            (PORT_IO_A_15 << 15);
24.GPIO_InitStructure.GPIO_Pin = ((uint32_t)port_a_mask) & 0xFFFF9FFF; //JTMS-SWDIO, JTCK-SWCLK
25.GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
26.GPIO_Init(GPIOA, &GPIO_InitStructure);
27.GPIO_InitStructure.GPIO_Pin = (~((uint32_t)port_a_mask)) & 0xFFFF9FFF;  //JTMS-SWDIO, JTCK-SWCLK
28.GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
29.GPIO_Init(GPIOA, &GPIO_InitStructure);

I use the following function to switch between high or low level.

1.GPIO_WriteBit(GPIOA,GPIO_Pin_8, Bit_RESET);
2.//GPIO_WriteBit(GPIOA,GPIO_Pin_8, Bit_SET);

The pin is always at the low level. I tested with another pin as PA0 or PA1 and it works well.

I hope you can help me.

Cordially

Guillaume

Outcomes