In this paper, we shall investigate an initial–boundary value problem of a generalized Swift–Hohenberg model subject to homogeneous Dirichlet boundary conditions in two spatial dimensions. The model consists of a nonlinear term of the form ψ2Δ2ψ2 in the free energy functional, which is used to model the stability of fronts between hexagons and squares in pinning effect. We first prove the global-in-time existence and uniqueness of weak solutions to this initial–boundary value problem in the case with the parameter β<0, where we employ the energy method and make use of various techniques to derive delicate a priori estimates. At the end, a few numerical experiments of the model are also performed to study the competition between hexagons and squares.