Try this...for me worked a lot of times.
30/30/30 reset
This is the first attempt to reset the hardware if you get locked out or if you misconfigure the router. The 30/30/30 reset is supported by almost any router. Actually, I’m not really sure if that is 100% correct but it doesn’t take much time to test and that’s why I tried it and I’m posting it here. It’s called the 30/30/30 reset because you will need to press the router’s reset button for thirty seconds for three period. Firstly, while the router is plugged in and running, press the reset button and keep pressing for thirty seconds. After the thirty seconds pass, remove the power jack but keep pressing the reset button. After another thirty seconds, plug in the router and keep the button pressed for another thirty seconds. If you do this correctly, the router should be reseted and ready to be bricked again. As I mentioned earlier, I didn’t have any success with this method so I’m just referencing. It defenitely works the try.
Then ...if the FW is openwrt based...
You can SSH in and type
mtd -r erase rootfs_data