cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot find a clear mapping from physical ports/pins to the software GPIO pins

kyrkap
Associate II

Hello everyone,

I am new to STM32 architecture and configuration. I am trying to configure new GPIO ports and pins in an STM32H745i-DISCO board. I had some previous code for the pin configuration, but I could not 100% map it to the user manual for the board. The code is the following. I could not match these definitions to any from the manual. Could anyone help me with the mapping for pins D0-D15 on the board? Thank you very much

 


#define LD6_Port GPIOD
#define LD7_Port GPIOI
#define LD8_Port GPIOB

#define LD9_Port GPIOC
#define LD10_Port GPIOA

#define B1_Port GPIOC

#define LD6_Pin GPIO_PIN_3
#define LD7_Pin GPIO_PIN_2
#define LD8_Pin GPIO_PIN_15

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
14 REPLIES 14

@kyrkap wrote:

I could not match these definitions to any from the manual.


If they're not in the User Manual for the board (they should be), try looking at the schematics ?

 

Please use this button to properly post source code:

AndrewNeil_0-1717601986665.png

 

 

Thanks for the tip Andrew. First time posting here :) 

Here they are:

AndrewNeil_1-1717602220330.png

 

EDIT:

But note that there are two errors in this table - see the posts from @SofLit:

https://community.st.com/t5/stm32cubeide-mpus/cannot-find-a-clear-mapping-from-physical-ports-pins-to-the/m-p/685182/highlight/true#M658

 

SofLit
ST Employee

Hello,

You can find the correspondence D0-D15 / GPIO pins in the board's schematics:

SofLit_0-1717602226550.png

But also in UM2488 / Table 17. STM32H745I-DISCO and STM32H750B-DK I/O assignment: search for ARD_DXX. Example for D3 search for ARD_D3.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

So if I understand correctly, PIN D0 is port GPIOB and GPIO_PIN7? Because I tried to use the exact page you shared but lack of experience (first time using STM32) did not make it so clear for me

Hello @kyrkap ,

I think there is a discrepancy between the schematics and Table 8 regarding D0 and D1:

As shown in the schematics I shared in my previous comment: 

D0 : GPIOB/pin11, D1: GPIOB/pin10

while in table 8:

D0: GPIOB/pin7, D1: GPIOB/pin6

So try PB11/PB10 for D0 and D1.

Could you please also check other pins D2 - D15?

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

@kyrkap wrote:

So if I understand correctly, PIN D0 is port GPIOB and GPIO_PIN7? 


Yes: "PB7" means "pin (or bit) 7 on GPIO Port B"

 


@kyrkap wrote:

 I tried to use the exact page you shared but lack of experience (first time using STM32) did not make it so clear for me


But note @SofLit's reply - it seems there might be an error in the table ...  

 

kyrkap
Associate II

Thanks a lot for the comments and help. Final question. I try to set the pin state from code and I see no response. I control relays from the pin state and for the two new pins I see no response from the relay. This is the code that is used for all pins so far. Three work (D11, 12 and 13). D14 and D15 (new defined pins, do not.

void setLed(GPIO_Led led, GPIO_State state) {
	HAL_GPIO_WritePin(outputs[led].port, outputs[led].pin, state == LOW ? GPIO_PIN_RESET : GPIO_PIN_SET);
	if (state != outputs[led].initialState) {
		outputs[led].state = 50;
	}
}

Any ideas?

 

Before going to the implementation you need to test the IOs as I suggested before: a simple toggle for example for each pin to validate their positions on the Arduino connector. Did you do that?

For the implementation I suggest to refer to the LED BSP driver implementation from stm32h745i_discovery.c:

https://github.com/STMicroelectronics/stm32h745i-disco-bsp/blob/32bbf8a9a25c75cb7b06484694e62172fe8bc0cb/stm32h745i_discovery.c

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.