CRC for serial output and error recognition ??

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
HansH
 
Posts: 117
Joined: Wed Apr 14, 2021 2:49 pm

CRC for serial output and error recognition ??

Post by HansH »

Hi
another beginner's question:
I going to transmit measured data (ASCII temperature data) with the ItsyBity RX/TX and a Pololu RS232 through a wire.
  • Is it reasonable and/or possible, to use some transmission error recognition like CRC ??
  • Other question will there be a parity bit transmitted?

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: CRC for serial output and error recognition ??

Post by adafruit_support_bill »

Parity bits are rarely used these days for serial transmission. For critical data, a CRC or similar checksum strategy is more practical. In the event of an error, you would typically need to re-send the entire packet anyway.

User avatar
HansH
 
Posts: 117
Joined: Wed Apr 14, 2021 2:49 pm

Re: CRC for serial output and error recognition ??

Post by HansH »

Thank You @adafruit_support_bill

The data transmitted are just numbers, a real time transmission of temperatures.
I have no idea, how much effort it was, to implement a CRC check.

Was it worth the effort?
Was this typically done?
Is it already implemented in the Python library?

And additional question, would You think the ItsyBitsyM4 Express with the MAX31865 was able to generate a temperature sample rate of 5-10Hz?

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: CRC for serial output and error recognition ??

Post by adafruit_support_bill »

If you are sampling at 5-10Hz, I'd forget about CRC and retransmission on error. I'd just do some simple filtering to discard any outlier samples. The physics of your system will determine the maximum possible rate of temperature change. If you see a measurement that represents a physically impossible rate of change, ignore it and wait for the next one.

The M4 and MAX31865 are capable of sampling at that rate. Python is the unknown. If you avoid doing anything that involves memory allocation within your sampling loop, you should be able to avoid unpredictable garbage collection activity by the CircuitPython runtime.

User avatar
HansH
 
Posts: 117
Joined: Wed Apr 14, 2021 2:49 pm

Re: CRC for serial output and error recognition ??

Post by HansH »

Thank You @adafruit_support_bill

I share your opinion that the sensor response time limits the useful sample rate and that post processing can eliminate the errors.

I understand you that 5-10Hz is possible with python, but only without CRC.

What I didn't understand is if CRC is implemented in the Circuit Python library at all, or how much effort would be required. Now of course without CRC.

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: CRC for serial output and error recognition ??

Post by adafruit_support_bill »

There are CRC implementations in CircuitPython such as this one: https://github.com/tuupola/circuitpytho ... /hal/crc.c

But for an application such as yours, CRC doesn't make a lot of sense. In addition to the overhead of the CRC logic at both ends, you have the added complexity of re-transmission.

Since you are transmitting at 5-10Hz, it makes more sense for the receiver to just ignore obvious errors and wait for the next transmission.

Locked
Please be positive and constructive with your questions and comments.

Return to “Itsy Bitsy Boards”