Homoclinic trajectories and chaotic behaviour in a piecewise linear oscillator