2024-06-05 08:35 AM
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
Solved! Go to Solution.
2024-06-05 08:43 AM - edited 2024-06-13 01:24 AM
2024-06-05 08:39 AM - edited 2024-06-05 08:40 AM
@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:
2024-06-05 08:41 AM
Thanks for the tip Andrew. First time posting here :)
2024-06-05 08:43 AM - edited 2024-06-13 01:24 AM
2024-06-05 08:48 AM
Hello,
You can find the correspondence D0-D15 / GPIO pins in the board's schematics:
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.
2024-06-05 11:54 PM
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
2024-06-06 01:16 AM
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?
2024-06-06 01:45 AM
@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 ...
2024-06-06 05:27 AM
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?
2024-06-06 05:40 AM - edited 2024-06-06 05:49 AM
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: