cancel
Showing results for 
Search instead for 
Did you mean: 

Bug with STM32H743 FMC pin and other GPIO pin with same AF12.

Linas L
Senior II

Hello. Get strange problem.

I am using SRAM witn NE3 that is routed to PG10 (AF12). I am also using led on PG6 ( that could be also FMC AF12 fro NE3)

For some reason if i configure GPIO prior SRAM, i can't blink LED, while i can blink led when GPIO is configured after SRAM. Is it some kind of bug or limitation of AF functions ?

I double checked, SRAM only configures PG10, and GPIO function only configures PG6.

Any ideas why it is happening ?

LED start to glow when i enable Bank3 , so that is clearcly corespoinding to SRAM pin NE3, while it is not configured in any AF mode!!! ( mode is output push pull)

// SRAM code
 
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_9|GPIO_PIN_12|GPIO_PIN_15 
                          |GPIO_PIN_14|GPIO_PIN_13|GPIO_PIN_8|GPIO_PIN_5 
                          |GPIO_PIN_4|GPIO_PIN_3|GPIO_PIN_2|GPIO_PIN_0 
                          |GPIO_PIN_1;
  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
  HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
 
LED GPIO EN code
    GPIO_InitTypeDef GPIO_InitStruct;
  __HAL_RCC_GPIOG_CLK_ENABLE();
 
 GPIO_InitStruct.Pin = GPIO_PIN_6;
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
  
 

 And yes, if i check pin with scope, I have FMC_CS3 on PG10 and PG6 pins, even if PG6 is not configured !

But, if i configure GPIO after SRAM, it looks like everything is working as it should. I just don't like that i have to account for this problem, by calling functions in special sequence....

2 REPLIES 2

Show us the actual code producing the error, as a minimal but complete compilable program.

Observe in debugger the GPIO registers' content.

JW

Where is not much more code than than. Enable SRAM, and same time I get LED ON PG6 ( since chip select is active low) while ONLY PG10 was configured.

(PG6 is in default reset state)

nowhere in sram init code i can't find PIN_6, but ok, will check registers.

Configuring LED after SRAM fix the problem.