Unexpected restart, NUCLEOL432KC

Hello,

I want to use a NUCLEO-L432KC as an interface card on a computer.
The L432KC reboots when it is plugged into the USB port of my computer in Windows 10.
These restarts occur randomly after a few minutes.
These restarts also occur if I supply it with 12V and it is connected to the USB port of the computer.
I did not observe these restarts when the L432KC is powered without being plugged into a USB port.
I did not observe these reboots when plugged into the USB port of another computer in Windows 7 and in Linux computer (Ubuntu 18.04).

Here is my test code:

#include "mbed.h"

DigitalOut myled (LED1);
DigitalIn button (PA_7);

int main () {

   while (! button) {
     myled = 1; // LED is ON
     wait (1.0); // 1 seconde
     myled = 0; // LED is OFF
     wait (1.0); 
   }

  while (1) {
     myled = 1; // LED is ON
     wait (0.25); // 250 ms
     myled = 0; // LED is OFF
     wait (0.25); 
   }

}

A button is connected between PA_7 and + 5V, a restoring resistor (15kohm) between PA_7 and GND.

At startup (or restart) the LED flashes at 0.5 Hertz, after pressing the button connected to PA_7 the LED flashes at 2Hz.

The reaction is the same whether I compile with MBED or with MBED OS.
If you have an idea on the origin of the problem ?

Marc.