2024-02-05 02:06 AM
Hi,I used PA12 & PA11 as input gpios(pull-up) in STM32U595VJT6Q ,read the pins are always '0'.The IOs connected NOTHING.
I reference RM0456 :
I config USBPWREN and VDD11USBDIS bits used the HAL functions before GPIO_Init():
HAL_PWREx_EnableUSBHSTranceiverSupply();
HAL_PWREx_DisableVDD11USB();
BUT I read the pins still '0'.How can i do?
The details of HAL function like as:
HAL_StatusTypeDef HAL_PWREx_EnableUSBHSTranceiverSupply(void)
{
uint32_t vos;
/* Get the system applied voltage scaling range */
vos = HAL_PWREx_GetVoltageRange();
/* Check the system applied voltage scaling range */
if ((vos == PWR_REGULATOR_VOLTAGE_SCALE1) || (vos == PWR_REGULATOR_VOLTAGE_SCALE2))
{
SET_BIT(PWR->VOSR, (PWR_VOSR_USBPWREN | PWR_VOSR_USBBOOSTEN));
}
else
{
return HAL_ERROR;
}
return HAL_OK;
}
void HAL_PWREx_DisableVDD11USB(void)
{
/* Set VDD11USBDIS bit */
SET_BIT(PWR->VOSR, PWR_VOSR_VDD11USBDIS);
}
Solved! Go to Solution.
2024-04-10 08:45 PM
Thanks @SStor
Solved: Problem with Pin A11 on STM32U595VJ - STMicroelectronics Community
This method is effective.
SET_BIT(PWR->SVMCR, PWR_SVMCR_USV);
SET_BIT(PWR->VOSR, PWR_VOSR_USBPWREN | PWR_VOSR_VDD11USBDIS);
2024-02-05 03:30 AM
Use this button to properly post source code:
To get that extra row of icons, press this button:
2024-02-05 04:00 AM - edited 2024-02-05 04:01 AM
Read out PWR_VOSR content and check those two bits in it. If they are not set, check if you've enabled clock for PWR in RCC.
If that's OK, read out and check GPIO registers content.
JW
2024-02-05 10:35 PM
Thanks for your reply.I made a mini project to read the registers.The GPIOA register are ZERO...
The result like as:
HW VERSION 001001
reg_pwr_init = 0x7c000
reg_pwr = 0x2fc000
reg_gpioa = 0x6700
#define HW_BIT0 HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_7)
#define HW_BIT1 HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_8)
#define HW_BIT2 HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_9)
#define HW_BIT3 HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_8)
#define HW_BIT4 HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_11)
#define HW_BIT5 HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_12)
int main(void)
{
/* USER CODE BEGIN 1 */
uint32_t reg_pwr_init;
uint32_t reg_pwr;
uint32_t reg_gpio;
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* Configure the System Power */
SystemPower_Config();
/* USER CODE BEGIN SysInit */
reg_pwr_init = READ_REG(PWR->VOSR);
SET_BIT(PWR->VOSR,PWR_VOSR_USBPWREN);
SET_BIT(PWR->VOSR, PWR_VOSR_VDD11USBDIS);
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART1_UART_Init();
MX_ICACHE_Init();
/* USER CODE BEGIN 2 */
reg_pwr = READ_REG(PWR->VOSR);
reg_gpio = READ_REG(GPIOA->IDR);
printf("HW VERSION %d%d%d%d%d%d\r\n",HW_BIT5,HW_BIT4,HW_BIT3,HW_BIT2,HW_BIT1,HW_BIT0);
printf("reg_pwr_init = 0x%x\r\n",reg_pwr_init);
printf("reg_pwr = 0x%x\r\n",reg_pwr);
printf("reg_gpioa = 0x%x\r\n",reg_gpio);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_11, GPIO_PIN_SET);
HAL_Delay(1000);
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_11, GPIO_PIN_RESET);
HAL_Delay(1000);
}
/* USER CODE END 3 */
}
2024-02-05 10:39 PM
thank you very much.I have learned:handshake:
2024-02-06 01:21 AM - edited 2024-02-06 01:21 AM
I'd have a look also at GPIOA->MODER, whether both PA11 and PA12 are set as outputs.
Beyond that, sorry, I don't know what else to check.
JW
2024-02-06 10:20 PM
Hi,my project is created by CubeMx.
The GPIO configured like as:
2024-04-10 08:45 PM
Thanks @SStor
Solved: Problem with Pin A11 on STM32U595VJ - STMicroelectronics Community
This method is effective.
SET_BIT(PWR->SVMCR, PWR_SVMCR_USV);
SET_BIT(PWR->VOSR, PWR_VOSR_USBPWREN | PWR_VOSR_VDD11USBDIS);
2024-04-10 11:26 PM
Oh, an isolation switch... Thanks with coming back with the solution.
JW