An archaeological study will have to be carried out on a field to check for remains of a medieval castle before a new housing development can be built.