The STM32 Nucleo board's power supply may be noisy due to USB or switching noise from the onboard LDO/Switching Regulator. Add capacitors (10uF + 100nF) near VREF+ and ADC inputs.
In USB 2.0 Full-Speed (FS) mode, a 1.5 kΩ pull-up resistor on the D+ line is used to signal the device's presence to the host. For High-Speed (HS) mode, devices initially connect at FS and then transition to HS after a handshake. Therefore, the D+ pu...
Even though it is internally connected to VDDA, it's not recommended to leave VREF+ floating. You should connect it to VDDA externally with a decoupling capacitor (typically 1µF + 100nF to VSSA) for stability.
If you enabled Watchdog Timer (IWDG) or certain low-power modes, the MCU might reset or lock up before the debugger can connect.Try a full chip erase using ST-Link Utility or STM32CubeProgrammer st-flash erase Then reflash your firmware.
When a connection is established, your STM32 should store the connection handle. If not, it might be an issue with aci_gap_set_event_mask(). Check if aci_gap_set_event_mask(GAP_EVT_MASK_ALL); is set correctly in your BLE initialization.