cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U575Zi Errors on GPIO Configuration

RickH
Associate

Greetings,

I'm struggling to get GPIO configuration to work without hitting the HardFault_Handler.  If I configure a single GPIO, like this:

__HAL_RCC_GPIOB_CLK_ENABLE();

GPIO_InitStruct.Pin = GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET);

There is no issue;  I can toggle the GPIO at-will inside a loop.

However, if I add more GPIO pins to the setup, I end up landing in a fault handler:

__HAL_RCC_GPIOB_CLK_ENABLE();

GPIO_InitStruct.Pin = 
CTRL18_Pin | CTRL19_Pin | CTRL20_Pin | CTRL21_Pin
| CTRL22_Pin | HEARTBEAT_Pin | PUMP_1_Pin | PUMP_2_Pin
| CTRL_35_Pin 
| CTRL_36_Pin 
| CTRL_37_Pin 
| CTRL_38_Pin
| CTRL_39_Pin | CTRL_40_Pin | NC6_Pin | M2_ADC_CTRL_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOE,
CTRL_39_Pin|CTRL_40_Pin|NC6_Pin|M2_ADC_CTRL_Pin
|CTRL18_Pin|CTRL19_Pin|CTRL20_Pin|CTRL21_Pin
|CTRL22_Pin|HEARTBEAT_Pin|PUMP_1_Pin|PUMP_2_Pin
|CTRL_35_Pin
|CTRL_36_Pin
|CTRL_37_Pin
|CTRL_38_Pin
|CTRL_36_Pin|CTRL_37_Pin|CTRL_38_Pin
|CTRL_39_Pin|CTRL_40_Pin|NC6_Pin
|CTRL_38_Pin,
GPIO_PIN_RESET);
 
I see this issue on both a custom board with STM32U575Zit6 and on a NUCLEO-U575ZI-Q board.
 
There is one other issue I see when initializing power.  This call to HAL_PWREx_ConfigSupply() results in a timeout:
 
HAL_PWREx_EnableVddIO2();
if (HAL_PWREx_ConfigSupply(PWR_SMPS_SUPPLY) != HAL_OK)
{
    Error_Handler();
}
 
This is where the timeout is hit:
if (timeout == 0U)
{
return HAL_TIMEOUT;
}
 
The parameter to HAL_PWREx_ConfigSupply(uint32_t SupplySource) is: 2
 
I would appreciate any help you can provide wrt these two issues.
 
Thanks + regards,
Rick
 
 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RickH
Associate

This turned out to be an RTOS issue - it is now resolved, happily.  Thanks, Rick

 

View solution in original post

1 REPLY 1
RickH
Associate

This turned out to be an RTOS issue - it is now resolved, happily.  Thanks, Rick