Undetectable port

I have an arudino mega, I was working with it for a long time without any problem. I am controlling stepper motors with drivers runing on 12V. So yesterday I uploaded a program and tested it multiple times. It worked.
But today, as I plugged in the arduino I expected it to execute the program I left on it. But it didn't do anyting, so I wanted to upload the program again, but I can't see the port in the menu.

When I plug the arduino in the ON led blinks once, and also the L led but with a weaker light.

solution:

As I wrote these things down, I tried to connect an arduino nano's gnd and 5V pins to the mega's, to check if my cable is bad.
With this, both leds were constantly on. Then I connected the mega through the usb cable to the computer (while connected with the nano's 5V and gnd) and imagine, the program started to work! :DD

I am not sure what I did is healthly, but since I already wrote down my problem I thougth I still ask If someone knows what the porblem was. Also if someone has the same problem this seems to be a possible solution, I can see the port now in IDE and it seems to work just fine.

I am using all 6 hardware inteerrupts and changing the timers' compare match registers' values in my code. Maybe this caused the problem?

Sounds to me like your Arduino MEGA is trying to draw more than 500 mA from the USB cable. There is a self-resetting 'polyfuse' on the MEGA to protect your USB port by disconnecting USB power if the Arduino MEGA tries to draw more than 500 mA from the USB cable. Using a separate power supply keeps the Arduino MEGA from overloading the USB power lines.