During fall 2015, I developed chest pain. In a matter of 2 or 3 days, pain went from null to highly disabling. I was then told I had developed costochondritis, which I had never heard about. Possibly as a result of strenuous exercise, or playing tennis.
At peak intensity, lying in the most comfortable position was painful if I didn't pay attention to my breathing. I then applied ice, took a couple sick days, NSAID, and about as fast as it had came, the pain went away.
Mostly. Unfortunately, ever since, I frequently experienced lesser pain on and around the affected rib, in particular when exercising, but also sometimes when doing everyday movements, unpredictably. This was worrying enough that I diminished/changed my exercises to avoid worsening the situation. Unfortunately, 3 months ago an acute costochondritis struck again (probably just a relapse).
This setback is quite frustrating, but on the positive side, I took it more seriously and it allowed me to study and understand what caused pain. Put simply, pain occurs when the breast is inflated. Which means that breathing is painful, but not if you breathe only with the belly. In the acute phase, breathing abdominally rather than apically will allow you to breathe without pain.
This is very simple to do once, but very hard to keep doing, since most of us don't breathe consciously. To force myself to stop breathing apically (with the top), I even strapped my chest with a lace, which can work.
Another source of pain is torsions. One thing which is very clear during the acute phase in the pain caused by rising and laying down, if you're used to doing so without using your hands (i.e., if you use your abdominals). An important lesson if you experience pain rising and lying down is that torsions are a lot less painful when your chest is deflated. But naturally, we tend to inflate the chest before rising or lying down. When you suffer from costochondritis, you should either switch positions without torsion, or go against that tendency and deflate your chest before rising or lying down.
If you exercise your abs, you should also expect pain, since most involve flexing the abdomen, and we tend to do that with the chest inflated. Exercising the abs while breathing abdominally is difficult or impossible. An alternative is to do the "plank" (static exercise on your forearms).
Good recovery