The rules on filing bankruptcy are all founding the Bankruptcy Code. The time frame are all based on filing date to filing date (as opposed to discharge date).
You can file Chapter 13 every 2 years (11 USC 1328(f)(2)).
You can file a Chapter 13 – 4 years after the filing date of a previous Chapter 7 (11 USC 1328(f)(1)).
You can file a Chapter 7 – 6 years after the filing date of a previous Chapter 13 (11 USC 729=727(a)(9)).
You can file a Chapter 7 every 8 years (11 USC 727(a)(8)).
Once caveat to these filing rules is that you can file a Chapter 7 anytime after you file a Chapter 13 – if 100% of your unsecured creditors were paid in full – or – if you paid 70% of your unsecured debt and can show that you made your best efforts (11 USC 727(a)(9)(A)).