RS232 Communication with MCU

So I am making my own CNC - PCB Miller. It is communicating with the computer using RS232 (UART), but in my testing, I find that I don't always get the correct characters, even at 1200baud. Does anyone have a method to suggest for error-checking an incoming data string over serial? I was thinking of doing something like this:

CPU sends data to MCU 4 times.

MCU checks to make sure the data is repeated exactly 4 times.

--If yes->send "OK" 4 times

--If no->send "NOT OK" 4 times

If CPU receives OK, queue up the next data to send

If CPU receives NOT OK, resend the previous data.


Since it's milling, I don't think I'll need it to go too quickly, 1200baud hopefully is fast enough.

Any suggestions on this method or a completely different proven method? I need it to be 100% correct data.


Thanks in advanced for your advice.

Hi Mitch, most of the

Hi Mitch, most of the industrial data checking routines are much less intensive than your proposed idea. A basic parity check for example is simply a binary value describing whether the last data string had an even or odd number of 1’s, which means that a correct transmission will always get through, but incorrect transmissions will only be detected half of the time. Another method is to use hash sum checks, but they’re a bit cumbersome and are normally used for error checking vs. larger data blocks.

I’d try your idea out, and if it’s a little slow you can decrease the number of code repetitions. Have you added some basic analog filters to your data lines? You can really clean up the signal with a few caps and a balun or two.