Have you considered the possibility that your cat might have a digestive problem? Your cat might have a constipation problem possibly due to the food given to him/her. My best advise would be to speak to the veternarian to determine the seriousness of the situation.
Urinary infections or constipation can be painful and maybe your cat is trying to tell you something. Some cats do not like sharing a litter box or an excessively used litter box. Make sure litter is deep enough. Perhaps your cat is just expressing himself!