In this work we have investigated the functioning of high resistivity amorphous silicon and silicon-rich nitride layers as a protection against discharges in Micro-Patterned Gaseous Detectors (MPGDs). When the anode is protected by a high resistivity layer, discharge signals are limited in charge. A signal reduction is expected when the layers are too thick; simulations presented in this paper indicate that layers up to 10 μm thick can be applied without significantly degrading the detector performance. Layers of amorphous silicon and silicon-rich nitride have been deposited on top of Timepix and Medipix2 chips in GridPix detectors; with this, chips survive naturally occurring as well as intentionally produced discharges. © 2010 Elsevier B.V. All rights reserved.