cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-L4R5ZI board CN12 header Pin76 = PG7, pin66 = PG8, config as GPIO output pins, but cannot toggle these two pins, SB130 and SB131 have been removed from the board.

HYuan.1
Associate II

NUCLEO-L4R5ZI board, CN12 header: Pin76 = PG7, pin66 = PG8.

SB130 and SB131 have been removed from the board. 

config PG7, PG8 as GPIO output pins, but cannot toggle these two pins

Here is the code:

 GPIO_InitTypeDef GPIO_InitStructure = {0};

 __HAL_RCC_GPIOG_CLK_ENABLE();

 GPIO_InitStructure.Pin =  GPIO_PIN_1 | GPIO_PIN_7 | GPIO_PIN_8;

 GPIO_InitStructure.Mode =  GPIO_MODE_OUTPUT_PP;               

 GPIO_InitStructure.Pull = GPIO_NOPULL; 

 GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;  

 HAL_GPIO_Init(GPIOG, &GPIO_InitStructure);

 HAL_GPIO_WritePin(GPIOG, GPIO_PIN_1, GPIO_PIN_RESET);  // set to LOW,  OK

 HAL_GPIO_WritePin(GPIOG, GPIO_PIN_1, GPIO_PIN_SET);  // set to HIGH, OK. PG1 toggles OK.

 HAL_GPIO_WritePin(GPIOG, GPIO_PIN_7, GPIO_PIN_RESET);  // LOW.  PG7 always low

 HAL_GPIO_WritePin(GPIOG, GPIO_PIN_7, GPIO_PIN_SET);   // set to HIGH, PG7 always low (measured), cannot set to high!

 

 HAL_GPIO_WritePin(GPIOG, GPIO_PIN_8, GPIO_PIN_RESET);  // LOW.  PG8 always low

 HAL_GPIO_WritePin(GPIOG, GPIO_PIN_8, GPIO_PIN_SET);  // set to HIGH, PG8 always low (measured), cannot set to high!

Note: (1) PG0, and PG1 pins can set/toggle correctly.

   (2) PG7 and PG8 cannot set/toggle correctly.

Thanks.

This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
waclawek.jan
Super User

PG2 to PG15 pins are supplied not from VDD but from VDDIO2, and you have to switch the VDDIO2 domain on by setting PWR_CR2.IOSV

0693W00000aJi6ZQAS.png 

JW

View solution in original post

5 REPLIES 5
JTP1
Lead

Hello.

Are jumpers SB193 and SB 195 closed ?

HYuan.1
Associate II

Yes. SB193 and 195 are closed.

JTP1
Lead

OK.some ideas:

Have you connect something to CN12 pins 67 / 66, if yes, disconnect and test again.

Maybe check the connection from these CN12 pins to MCU pins or to SB130/131 to make sure youre measuring right pins/board is ok/you have located jumpers correctly.

Check also that pins are not grounded.

In code, there is no other initializations, for example LPUART1 which overrides the pin ?

waclawek.jan
Super User

PG2 to PG15 pins are supplied not from VDD but from VDDIO2, and you have to switch the VDDIO2 domain on by setting PWR_CR2.IOSV

0693W00000aJi6ZQAS.png 

JW

HYuan.1
Associate II

Thanks for help. This issue is solved by calling  "HAL_PWREx_EnableVddIO2();"

as JW pointed out "PG2 to PG15 pins are supplied not from VDD but from VDDIO2, and you have to switch the VDDIO2 domain on by setting PWR_CR2.IOSV"

Thank you.