I feel it could be the other way round i.e departure from Salem at around 2 pm to reach ernakulam at around 10 pm. After bangalore-Ernakulam intercity express there is no train to ernakulam till probably night 9pm so there is a big gap there. Departure in the morning from Ernakulam maybe at around 5 to reach salem at 1pm.