Transmission electron microscopy has been used to study defects formed in M
g-doped GaN crystals. Three types of crystals have been studied: bulk cryst
als grown by a high pressure and high temperature process with Mg added to
the Ga solution and two types of crystals grown by metal-organic chemical v
apor deposition (MOCVD) where Mg was either delta-doped or continuously dop
ed. Spontaneous ordering was observed in bulk crystals. The ordering consis
ts of Mg rich planar defects on basal planes separated by 10.4 nm and occur
s only for growth in the N to Ga polar direction (000 (1) over bar N polari
ty). These planar defects exhibit the characteristics of stacking faults wi
th a shift vector of a 1/3 [1 (1) over bar 00] +c/2 but some other features
identify these defects as inversion domains. Different type of defects wer
e formed on the opposite site of the crystal (Ga to N polar direction). whe
re the growth rate is also an order of magnitude faster compared to the gro
wth with N-polarity. These defects are three-dimensional: pyramidal and rec
tangular, empty inside with Mg segregation on internal surfaces. The same t
ypes of defects seen for the two growth polarities in the bulk crystals wer
e also observed in the MOCVD grown GaN samples with Mg delta doping, but we
re not observed in the crystals where Mg was added continuously.