Unfortunately, I don't have a solution for you, but I'll provide some additional information that might be helpful to you or others trying to help you.
I was able to reproduce the problem when running your sketch. I notice it even repeatedly disconnects all the other devices plugged into the USB hub!
The 4X long, 4X short blink pattern on the onboard LED is an error indicator. Serial debug information is output on the pin marked "TX1" on the Nano 33 BLE boards at 115200 baud when this happens. You can connect a USB to TTL serial adapter to that pin and then open its port in Serial Monitor to see the output. When I did this while your sketch was running, the output I got was:
++ MbedOS Error Info ++
Error Status: 0x80010133 Code: 307 Module: 1
Error Message: Mutex: 0x200101FC, Not allowed in ISR context
Location: 0x45F4F
Error Value: 0x200101FC
Current Thread: mainĀ Id: 0x200043D4 Entry: 0x45E7D StackSize: 0x8000 StackMem: 0x200081C8 SP: 0x2003FEEC
For more info, visit: https://mbed.com/s/error?error=0x80010133&tgt=ARDUINO_NANO33BLE
-- MbedOS Error Info --
You could set a flag in the attime function and do the rest in your main loop or a function called from your main loop.
The analogRead function has been written in a more complicated way than one might think, thats why mbedOS does not like you to run it inside an interrupt service routine.