A general method for the construction of smooth flat connections on 3-manifolds is introduced. The procedure is strictly connected with the deduction of the fundamental group of a manifold M by means of a Heegaard splitting presentation of M. For any given matrix representation of the fundamental group of M, a corresponding flat connection A on M is specified. It is shown that the associated classical Chern–Simons invariant assumes then a canonical form which is given by the sum of two contributions: the first term is determined by the intersections of the curves in the Heegaard diagram, and the second term is the volume of a region in the representation group which is determined by the representation of π1(M) and by the Heegaard gluing homeomorphism. Examples of flat connections in topologically nontrivial manifolds are presented and the computations of the associated classical Chern–Simons invariants are illustrated.