Excitation mechanism of Er in Si studied with a free-electron laser