A court, except as provided in this section, shall not accept a plea of guilty or nolo contendere without first, by addressing the defendant personally in open court, determining that the plea is voluntary and not the result of force or threats or of promises apart from a plea agreement. It shall also inquire as to whether the defendant's willingness to plead guilty or nolo contendere results from prior discussions between the prosecuting attorney and the defendant or his attorney. If a defendant is charged with a misdemeanor, his attorney may enter a plea of guilty, nolo contendere, or not guilty for him. The court shall inquire into whether the attorney has advised the defendant of the contents of §