You need "did" for:
1. Questions - Did you speak to her?
2. Negations - I didn't speak to her.
3. Emphasis - I did speak to her!
That is in the past tense. The same applies for "do" in the present tense. It is only used as an auxiliary in the above cases.
Student or Learner