You should try to find out if the DIMM or the slot is broken: I suppose you tried to switch the DIMMs? The easiest way is to try only one DIMM (memory module), first in the lower slot, then in the upper slot.
IMPORTANT: reset the PRAM after altering the configuration, i.e. after moving a DIMM to another slot. (Hold Cmd+Opt+P+R when turning on the Mac and keep holding the keys until you've heared the start chime two times.)
https://support.apple.com/en-us/HT204063
If the one DIMM works in both slots, the slots are okay. Now try the other DIMM. If the second DIMM also works in both slots, I frankly have no other idea than to try a different version of OS X to rule out the possibility of a software problem.