CHECK POOR CONTACT.
QUESTION
Is there poor contact in input signal of brake switch?
Yes
No
Repair the poor contact.
Replace the TCM.