How to use PA15 (JTDI) as a GPIO
On a custom board, the RED_LED is connected to PA15, which is pulled-up by default (JTDI).
The pin has been set to Push-Pull Output GPIO in CubeMX and is initialized to 0.
The STM32WB55CGUx was experiencing random resets, until this particular IO was set to 1, line 34 in the code below.
Now the code runs fine and is stable.
int main(void)
{
/* USER CODE BEGIN 1 */
/* 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();
/* USER CODE BEGIN SysInit */
//SysTick_Config(32000/0);
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ADC1_Init();
MX_SPI1_Init();
MX_TIM1_Init();
MX_TIM2_Init();
MX_USART1_UART_Init();
MX_RF_Init();
MX_RTC_Init();
/* USER CODE BEGIN 2 */
HAL_GPIO_WritePin(LED_RED_GPIO_Port, LED_RED_Pin, GPIO_PIN_SET);
HAL_UART_Transmit(&huart1, (uint8_t*)"Hello World\n", 12, 1000);
/* USER CODE END 2 */
/* Init code for STM32_WPAN */
APPE_Init();
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
UTIL_SEQ_Run(UTIL_SEQ_DEFAULT);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_WritePin(LED_BLUE_GPIO_Port, LED_BLUE_Pin, GPIO_PIN_SET);
HAL_Delay(5);
HAL_GPIO_WritePin(LED_BLUE_GPIO_Port, LED_BLUE_Pin, GPIO_PIN_RESET);
HAL_Delay(100);
}
/* USER CODE END 3 */
}Using STM32CubeIDE v1.0.3.
Flashing the board using SWD (SWDIO/SWCLK), not using JTDI.