You wasted your money. I'm sorry to tell you it's not going to run with a 40MHz crystal or external oscillator at that speed.

To run at 40MHz, use a 10MHz crystal and set the internal PLL to x4.

Make friends with section 2 of the Datasheet (it also shows you how to hook up your Oscillator, Crystal, resonator or whatever and what loading capacitances you might need.