A project log for Calibration and Measurement Tool

A tool that simplifies development, debugging and calibration of embedded control systems

osannolikosannolik 04/09/2017 at 10:470 Comments

While using the tuning feature in my other project BLDC motor controller, I had some issues with the values being written to the target became corrupt. This caused some unintended rotor acceleration when tuning the duty cycle...

The reason for this turned out to be due to the uart being overrun from time to time (when using a high baud), which in turn caused lost bytes and thus corrupt frames to be processed.

Therefore, I made two improvements:

  1. Instead of generating an interrupt for each and every uart byte received and in the isr adding it to a buffer, this is now handled using the DMA. The buffer is then polled periodically. This way there is no overhead caused by the communication itself at all, and it is extremely unlikely that the uart will be overrun.
  2. Added selectable CRC to the frames. So, if there still are problems, the checksum will very likely fail, preventing incorrect data being written to the target's symbols.

As a bonus, I also made it possible to have CRC on the data being sent from the target.