Context. Formaldehyde is an organic molecule that is abundant in the interstellar medium. High deuterium fractionation is a common feature in low-mass star-forming regions. Observing several isotopologues of molecules is an excellent tool for understanding the formation paths of the molecules. Aims. We seek an understanding of how the various deuterated isotopologues of formaldehyde are formed in the dense regions of lowmass star formation. More specifically, we adress the question of how the very high deuteration levels (several orders of magnitude above the cosmic D/H ratio) can occur using H 2 CO data of the nearby ρ Oph A molecular cloud. Methods. From mapping observations of H 2 CO, HDCO, and D 2 CO, we have determined how the degree of deuterium fractionation changes over the central 3 × 3 region of ρ Oph A. The multi-transition data of the various H 2 CO isotopologues, as well as from other molecules (e.g., CH 3 OH and N 2 D + ) present in the observed bands, were analysed using both the standard type rotation diagram analysis and, in selected cases, a more elaborate method of solving the radiative transfer for optically thick emission. In addition to molecular column densities, the analysis also estimates the kinetic temperature and H 2 density. Results. Toward the SM1 core in ρ Oph A, the H 2 CO deuterium fractionation is very high. In fact, the observed D 2 CO/HDCO ratio is 1.34 ± 0.19, while the HDCO/H 2 CO ratio is 0.107 ± 0.015. This is the first time, to our knowledge, that the D 2 CO/HDCO abundance ratio is observed to be greater than 1. The kinetic temperature is in the range 20−30 K in the cores of ρ Oph A, and the H 2 density is (6−10) × 10 5 cm −3 . We estimate that the total H 2 column density toward the deuterium peak is (1−4) × 10 23 cm −2 . As depleted gas-phase chemistry is not adequate, we suggest that grain chemistry, possibly due to abstraction and exchange reactions along the reaction chain H 2 CO → HDCO → D 2 CO, is at work to produce the very high deuterium levels observed.