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:
- 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.
- 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.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.