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 § 23A-7-4. If the court is satisfied that the defendant has been advised, the plea may be accepted. If the plea is guilty or nolo contendere, sentence may be imposed at that time and is binding upon the defendant.
SDCL 23A-7-5