Hello,
Welcome to the ehealthforum and I am really glad to help you out. Your concern is regarding the spotting that you are having in the second trimester. During pregnancy the cervix becomes more sensitive and engorged with blood. Any trauma even slight like in intercourse or during pelvic examination or transvaginal examination can cause bleeding after intercourse.
The other possibility is of threatened miscarriage. To prevent threatened miscarriage, I would suggest you to avoid intercourse. If the bleeding becomes severe (clots) or is associated with any cramps (as in your case), then the chances of miscarriage are there. Immediate medical intervention is then required. In your case, the possibility of a threatened miscarriage are high and hence you need an urgent opinion from an obstetrician.
It is very difficult to precisely confirm a diagnosis without examination and investigations and the answer is based on the medical information provided. For exact diagnosis, you are requested to consult your doctor. I sincerely hope that helps. Take care.