Been having brown discharge

So for the last 3days iv been having brown discharge my period is due in 2 days i thought ny period was coming as 2 days ago i had the worst lower stomach cramps ever but now nothing.i stopped breastfeeding 3 months ago so i didnt know if it was to do with that.we did have unprotected sex 2 days before i ovulated