-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Serial losing bytes (regression from 1.0.4) #5005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have identified a potential race condition in the #3664 / #3713 patch group. Consider the last line in uartAvailable(uart_t* uart):
C does not specify which side of the + operator is evaluated first, hence the right hand side - the access to rxfifo_cnt - could occur first. Suppose that rxfifo contains 111 bytes and another byte arrives just after the fetch of rxfifo_cnt. An interrupt occurs, transferring 112 bytes to the queue. The interrupt returns and uxQueueMessagesWaiting() returns 112, so uartAvailable() returns 112+111 = 223, obviously wildly incorrect. I looked at assembler output from a recent compilation. This situation is not actually occurring because the left hand side was evaluated first, but there is no guarantee that it could not occur. This illustrates the difficulty of ensuring correctness when device driver logic is duplicated in ISRs and foreground code. |
I made the problem go away - at least in our test setup - with this version of uartAvailable(), which disables interrupts during the "queue + fifo" computation:
I do not like this solution, because it just patches over the underlying problem of bad design, but it does illustrate that some sort of race condition is occurring. |
The problem could be related to erratum 3.17 in https://espressif.com/sites/default/files/documentation/eco_and_workarounds_for_bugs_in_esp32_en.pdf Unfortunately, the description of the problem is vague and does not specify the exact sequence of operations that cause the problem, nor does it describe the workaround precisely. But we can infer that something bad happens when some kind of FIFO access is interrupted, which is consistent with the race condition mentioned above. |
I don't know if it's the same problem as yours, but my code also works on 1.0.4 but not 1.0.5 nor 1.0.6 when it comes to Serial. In 1.0.4, if I write 2 characters on the Serial to send to the board, then on the board the 2nd character is immediately available after reading the 1st character (ie |
The HardwareSerial driver is broken in Arduino framework versions 1.0.5 and 1.0.6 . espressif/arduino-esp32#5005 Instead of waiting for a fix, I wrote a very simple UART driver that does exactly what we need with no unnecessary bells and whistles to cause problems.
* Use local UART driver not HardwareSerial The HardwareSerial driver is broken in Arduino framework versions 1.0.5 and 1.0.6 . espressif/arduino-esp32#5005 Instead of waiting for a fix, I wrote a very simple UART driver that does exactly what we need with no unnecessary bells and whistles to cause problems. * Added missing files, changed method signatures The methods implemented by the UART class now have the same signatures as the HardwareSerial class, so it will be easy to switch back if we need to. * Incorporated suggestions from Stefan * Fixed TX_IDLE_NUM bug reported by mstrens * Quick test for Bf: problem This is not the final solution. * Fixed stupid typo in last commit * Another test - check for client_buffer space * Use the esp-idf uart driver You can revert to the direct driver for testing by defining DIRECT_UART * Uart class now supports VFD and TMC * data bits, stop bits, parity as enum classes The constants for data bits, stop bits, and parity were changed to enum classes so the compiler can check for argument order mismatches. * Set half duplex after uart init * Init TMC UART only once * rx/tx pin order mixup, missing _uart_started * Test: use Arduino Serial This reverts to the Arduino serial driver for UI communication, leaving the VFS comms on the Uart class on top of the esp_idf UART driver. You can switch back and forth with the define REVERT_TO_SERIAL line in Serial.cpp * REVERT_TO_ARDUINO_SERIAL off by default * Added debug messages * Update Grbl.h * Update platformio.ini Co-authored-by: bdring <[email protected]>
* Oled2 (#834) * WIP * WIP * Update platformio.ini * WIP * Cleanup * Update platformio.ini * Turn off soft limits with max travel (#836) #831 * Yalang YL620 VFD (#838) * New SpindleType YL620 Files for new SpindleType Yalang 620. So far the contents are a duplicate of H2ASpindle.h and H2ASpindle.cpp * Added register documentation and implemented read and write data packets * Some fixes, mostly regarding RX packet length * OLED and Other Updates (#844) * publish * Updates - CoreXY and OLED - Moved position calculation out of report_realtime_status(...) so other functions can access it. - Added a function to check if a limit switch is defined - CoreXY fixed bug in forward kinematics when midtbot is used. - Modified OLED display. * Cleanup for PR * Delete midtbot_x2.h * Incorporated PR 846 - Some OLED cleanup - verified correct forward kinematics on MidTbot * Pio down rev (#850) * Update platformio.ini * Update Grbl.h * Use local UART driver not HardwareSerial (#857) * Use local UART driver not HardwareSerial The HardwareSerial driver is broken in Arduino framework versions 1.0.5 and 1.0.6 . espressif/arduino-esp32#5005 Instead of waiting for a fix, I wrote a very simple UART driver that does exactly what we need with no unnecessary bells and whistles to cause problems. * Added missing files, changed method signatures The methods implemented by the UART class now have the same signatures as the HardwareSerial class, so it will be easy to switch back if we need to. * Incorporated suggestions from Stefan * Fixed TX_IDLE_NUM bug reported by mstrens * Quick test for Bf: problem This is not the final solution. * Fixed stupid typo in last commit * Another test - check for client_buffer space * Use the esp-idf uart driver You can revert to the direct driver for testing by defining DIRECT_UART * Uart class now supports VFD and TMC * data bits, stop bits, parity as enum classes The constants for data bits, stop bits, and parity were changed to enum classes so the compiler can check for argument order mismatches. * Set half duplex after uart init * Init TMC UART only once * rx/tx pin order mixup, missing _uart_started * Test: use Arduino Serial This reverts to the Arduino serial driver for UI communication, leaving the VFS comms on the Uart class on top of the esp_idf UART driver. You can switch back and forth with the define REVERT_TO_SERIAL line in Serial.cpp * REVERT_TO_ARDUINO_SERIAL off by default * Added debug messages * Update Grbl.h * Update platformio.ini Co-authored-by: bdring <[email protected]> * Fixed spindle sync for all VFD spindles (#868) * Implemented H2A spindle sync fix. Untested. * Changed the spindle sync fix to be in the VFD code. * Update Grbl.h Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: bdring <[email protected]> Co-authored-by: Mitch Bradley <[email protected]> Co-authored-by: marcosprojects <[email protected]> Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: Stefan de Bruijn <[email protected]>
* Oled2 (#834) * WIP * WIP * Update platformio.ini * WIP * Cleanup * Update platformio.ini * Turn off soft limits with max travel (#836) #831 * Yalang YL620 VFD (#838) * New SpindleType YL620 Files for new SpindleType Yalang 620. So far the contents are a duplicate of H2ASpindle.h and H2ASpindle.cpp * Added register documentation and implemented read and write data packets * Some fixes, mostly regarding RX packet length * OLED and Other Updates (#844) * publish * Updates - CoreXY and OLED - Moved position calculation out of report_realtime_status(...) so other functions can access it. - Added a function to check if a limit switch is defined - CoreXY fixed bug in forward kinematics when midtbot is used. - Modified OLED display. * Cleanup for PR * Delete midtbot_x2.h * Incorporated PR 846 - Some OLED cleanup - verified correct forward kinematics on MidTbot * Pio down rev (#850) * Update platformio.ini * Update Grbl.h * Use local UART driver not HardwareSerial (#857) * Use local UART driver not HardwareSerial The HardwareSerial driver is broken in Arduino framework versions 1.0.5 and 1.0.6 . espressif/arduino-esp32#5005 Instead of waiting for a fix, I wrote a very simple UART driver that does exactly what we need with no unnecessary bells and whistles to cause problems. * Added missing files, changed method signatures The methods implemented by the UART class now have the same signatures as the HardwareSerial class, so it will be easy to switch back if we need to. * Incorporated suggestions from Stefan * Fixed TX_IDLE_NUM bug reported by mstrens * Quick test for Bf: problem This is not the final solution. * Fixed stupid typo in last commit * Another test - check for client_buffer space * Use the esp-idf uart driver You can revert to the direct driver for testing by defining DIRECT_UART * Uart class now supports VFD and TMC * data bits, stop bits, parity as enum classes The constants for data bits, stop bits, and parity were changed to enum classes so the compiler can check for argument order mismatches. * Set half duplex after uart init * Init TMC UART only once * rx/tx pin order mixup, missing _uart_started * Test: use Arduino Serial This reverts to the Arduino serial driver for UI communication, leaving the VFS comms on the Uart class on top of the esp_idf UART driver. You can switch back and forth with the define REVERT_TO_SERIAL line in Serial.cpp * REVERT_TO_ARDUINO_SERIAL off by default * Added debug messages * Update Grbl.h * Update platformio.ini Co-authored-by: bdring <[email protected]> * Fixed spindle sync for all VFD spindles (#868) * Implemented H2A spindle sync fix. Untested. * Changed the spindle sync fix to be in the VFD code. * Update Grbl.h Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: bdring <[email protected]> * New jog fix (#872) * Applied 741 to new Devt * Make kinematics routines weak to eliminate ifdefs * Fixed warning * Update build date Co-authored-by: bdring <[email protected]> * Big kinematics cleanup (#875) * Applied 741 to new Devt * Make kinematics routines weak to eliminate ifdefs * Fixed warning * Big kinematics cleanup * Cleanup * no isCancelled arg for jog_execute; return it instead * WIP * Made OLED compliant with new kinematics * Added system_get_mpos * system_get_mpos() returns float* * WIP * Cleanup after testing - Had MPos and WPos text on OLED backwards. - Added my cartesian test def - Will remove test defs before merging to devt. * Cleanup of remaining user optional code. * Fixed delta kinematics loop ending early. * Account for jog cancel in saved motor positions * Update Grbl.h Co-authored-by: bdring <[email protected]> Co-authored-by: Mitch Bradley <[email protected]> Co-authored-by: marcosprojects <[email protected]> Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: Stefan de Bruijn <[email protected]>
* changing to EXTENDED type from GRBL type to prevent sender issues when running 1585 * Oled2 (#834) * WIP * WIP * Update platformio.ini * WIP * Cleanup * Update platformio.ini * Turn off soft limits with max travel (#836) #831 * Yalang YL620 VFD (#838) * New SpindleType YL620 Files for new SpindleType Yalang 620. So far the contents are a duplicate of H2ASpindle.h and H2ASpindle.cpp * Added register documentation and implemented read and write data packets * Some fixes, mostly regarding RX packet length * OLED and Other Updates (#844) * publish * Updates - CoreXY and OLED - Moved position calculation out of report_realtime_status(...) so other functions can access it. - Added a function to check if a limit switch is defined - CoreXY fixed bug in forward kinematics when midtbot is used. - Modified OLED display. * Cleanup for PR * Delete midtbot_x2.h * Incorporated PR 846 - Some OLED cleanup - verified correct forward kinematics on MidTbot * Pio down rev (#850) * Update platformio.ini * Update Grbl.h * Use local UART driver not HardwareSerial (#857) * Use local UART driver not HardwareSerial The HardwareSerial driver is broken in Arduino framework versions 1.0.5 and 1.0.6 . espressif/arduino-esp32#5005 Instead of waiting for a fix, I wrote a very simple UART driver that does exactly what we need with no unnecessary bells and whistles to cause problems. * Added missing files, changed method signatures The methods implemented by the UART class now have the same signatures as the HardwareSerial class, so it will be easy to switch back if we need to. * Incorporated suggestions from Stefan * Fixed TX_IDLE_NUM bug reported by mstrens * Quick test for Bf: problem This is not the final solution. * Fixed stupid typo in last commit * Another test - check for client_buffer space * Use the esp-idf uart driver You can revert to the direct driver for testing by defining DIRECT_UART * Uart class now supports VFD and TMC * data bits, stop bits, parity as enum classes The constants for data bits, stop bits, and parity were changed to enum classes so the compiler can check for argument order mismatches. * Set half duplex after uart init * Init TMC UART only once * rx/tx pin order mixup, missing _uart_started * Test: use Arduino Serial This reverts to the Arduino serial driver for UI communication, leaving the VFS comms on the Uart class on top of the esp_idf UART driver. You can switch back and forth with the define REVERT_TO_SERIAL line in Serial.cpp * REVERT_TO_ARDUINO_SERIAL off by default * Added debug messages * Update Grbl.h * Update platformio.ini Co-authored-by: bdring <[email protected]> * Fixed spindle sync for all VFD spindles (#868) * Implemented H2A spindle sync fix. Untested. * Changed the spindle sync fix to be in the VFD code. * Update Grbl.h Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: bdring <[email protected]> * New jog fix (#872) * Applied 741 to new Devt * Make kinematics routines weak to eliminate ifdefs * Fixed warning * Update build date Co-authored-by: bdring <[email protected]> * need to override set_rpm * trying set_rpm override * it turns on! * start/stop and set speed all working * cleanup * fixing machine.h * fix .gitignore *&vi .gitignore didn't work anyway * forgot to get rid of hard coded max_freq, fixed now * changed 'speed' to 'freq' * reverting platformio.ini * minor readme update * removed debug msg * Big kinematics cleanup (#875) * Applied 741 to new Devt * Make kinematics routines weak to eliminate ifdefs * Fixed warning * Big kinematics cleanup * Cleanup * no isCancelled arg for jog_execute; return it instead * WIP * Made OLED compliant with new kinematics * Added system_get_mpos * system_get_mpos() returns float* * WIP * Cleanup after testing - Had MPos and WPos text on OLED backwards. - Added my cartesian test def - Will remove test defs before merging to devt. * Cleanup of remaining user optional code. * Fixed delta kinematics loop ending early. * Account for jog cancel in saved motor positions * Update Grbl.h Co-authored-by: bdring <[email protected]> * Add the Root 4 Lite CNC machine to the Machines folder (#886) * update for the Root 4 Lite * Return machine.h to use test_drive.hy * Removed some machine definitions Co-authored-by: bdring <[email protected]> * YL620_Fix (#941) * YL620_Fix Fix per ... #926 (comment) Added CNC_xPro machine def * Update Grbl.h * Delete CNC_xPRO_V5_XYYZ_PWM_NO.h * fixes for RPM * note * fixed rx length * fix smell and update readme * clang format * trying to fix newlines * trying to fix newlines part 2 * fix cast issue * fixed spinup spindown swap. Co-authored-by: me <[email protected]> Co-authored-by: Mitch Bradley <[email protected]> Co-authored-by: marcosprojects <[email protected]> Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: Pete <[email protected]> Co-authored-by: Jesse Schoch <[email protected]>
* changing to EXTENDED type from GRBL type to prevent sender issues when running 1585 * Oled2 (#834) * WIP * WIP * Update platformio.ini * WIP * Cleanup * Update platformio.ini * Turn off soft limits with max travel (#836) #831 * Yalang YL620 VFD (#838) * New SpindleType YL620 Files for new SpindleType Yalang 620. So far the contents are a duplicate of H2ASpindle.h and H2ASpindle.cpp * Added register documentation and implemented read and write data packets * Some fixes, mostly regarding RX packet length * OLED and Other Updates (#844) * publish * Updates - CoreXY and OLED - Moved position calculation out of report_realtime_status(...) so other functions can access it. - Added a function to check if a limit switch is defined - CoreXY fixed bug in forward kinematics when midtbot is used. - Modified OLED display. * Cleanup for PR * Delete midtbot_x2.h * Incorporated PR 846 - Some OLED cleanup - verified correct forward kinematics on MidTbot * Pio down rev (#850) * Update platformio.ini * Update Grbl.h * Use local UART driver not HardwareSerial (#857) * Use local UART driver not HardwareSerial The HardwareSerial driver is broken in Arduino framework versions 1.0.5 and 1.0.6 . espressif/arduino-esp32#5005 Instead of waiting for a fix, I wrote a very simple UART driver that does exactly what we need with no unnecessary bells and whistles to cause problems. * Added missing files, changed method signatures The methods implemented by the UART class now have the same signatures as the HardwareSerial class, so it will be easy to switch back if we need to. * Incorporated suggestions from Stefan * Fixed TX_IDLE_NUM bug reported by mstrens * Quick test for Bf: problem This is not the final solution. * Fixed stupid typo in last commit * Another test - check for client_buffer space * Use the esp-idf uart driver You can revert to the direct driver for testing by defining DIRECT_UART * Uart class now supports VFD and TMC * data bits, stop bits, parity as enum classes The constants for data bits, stop bits, and parity were changed to enum classes so the compiler can check for argument order mismatches. * Set half duplex after uart init * Init TMC UART only once * rx/tx pin order mixup, missing _uart_started * Test: use Arduino Serial This reverts to the Arduino serial driver for UI communication, leaving the VFS comms on the Uart class on top of the esp_idf UART driver. You can switch back and forth with the define REVERT_TO_SERIAL line in Serial.cpp * REVERT_TO_ARDUINO_SERIAL off by default * Added debug messages * Update Grbl.h * Update platformio.ini Co-authored-by: bdring <[email protected]> * Fixed spindle sync for all VFD spindles (#868) * Implemented H2A spindle sync fix. Untested. * Changed the spindle sync fix to be in the VFD code. * Update Grbl.h Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: bdring <[email protected]> * New jog fix (#872) * Applied 741 to new Devt * Make kinematics routines weak to eliminate ifdefs * Fixed warning * Update build date Co-authored-by: bdring <[email protected]> * need to override set_rpm * trying set_rpm override * it turns on! * start/stop and set speed all working * cleanup * fixing machine.h * fix .gitignore *&vi .gitignore didn't work anyway * forgot to get rid of hard coded max_freq, fixed now * changed 'speed' to 'freq' * reverting platformio.ini * minor readme update * removed debug msg * Big kinematics cleanup (#875) * Applied 741 to new Devt * Make kinematics routines weak to eliminate ifdefs * Fixed warning * Big kinematics cleanup * Cleanup * no isCancelled arg for jog_execute; return it instead * WIP * Made OLED compliant with new kinematics * Added system_get_mpos * system_get_mpos() returns float* * WIP * Cleanup after testing - Had MPos and WPos text on OLED backwards. - Added my cartesian test def - Will remove test defs before merging to devt. * Cleanup of remaining user optional code. * Fixed delta kinematics loop ending early. * Account for jog cancel in saved motor positions * Update Grbl.h Co-authored-by: bdring <[email protected]> * Add the Root 4 Lite CNC machine to the Machines folder (#886) * update for the Root 4 Lite * Return machine.h to use test_drive.hy * Removed some machine definitions Co-authored-by: bdring <[email protected]> * YL620_Fix (#941) * YL620_Fix Fix per ... #926 (comment) Added CNC_xPro machine def * Update Grbl.h * Delete CNC_xPRO_V5_XYYZ_PWM_NO.h * fixes for RPM * note * fixed rx length * fix smell and update readme * clang format * trying to fix newlines * trying to fix newlines part 2 * fix cast issue * fixed spinup spindown swap. * Core xy soft limits (#960) * Soft limit fix * Update Grbl.h * Increase serial task stack size (#970) * Increase stack size - Also changed defaults of trinamic motor currents * Update Grbl.h * 5160 class fix (#981) * Fixed class inheritance * Update date Co-authored-by: me <[email protected]> Co-authored-by: Mitch Bradley <[email protected]> Co-authored-by: marcosprojects <[email protected]> Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: Pete <[email protected]> Co-authored-by: Jesse Schoch <[email protected]>
* changing to EXTENDED type from GRBL type to prevent sender issues when running 1585 * Oled2 (#834) * WIP * WIP * Update platformio.ini * WIP * Cleanup * Update platformio.ini * Turn off soft limits with max travel (#836) #831 * Yalang YL620 VFD (#838) * New SpindleType YL620 Files for new SpindleType Yalang 620. So far the contents are a duplicate of H2ASpindle.h and H2ASpindle.cpp * Added register documentation and implemented read and write data packets * Some fixes, mostly regarding RX packet length * OLED and Other Updates (#844) * publish * Updates - CoreXY and OLED - Moved position calculation out of report_realtime_status(...) so other functions can access it. - Added a function to check if a limit switch is defined - CoreXY fixed bug in forward kinematics when midtbot is used. - Modified OLED display. * Cleanup for PR * Delete midtbot_x2.h * Incorporated PR 846 - Some OLED cleanup - verified correct forward kinematics on MidTbot * Pio down rev (#850) * Update platformio.ini * Update Grbl.h * Use local UART driver not HardwareSerial (#857) * Use local UART driver not HardwareSerial The HardwareSerial driver is broken in Arduino framework versions 1.0.5 and 1.0.6 . espressif/arduino-esp32#5005 Instead of waiting for a fix, I wrote a very simple UART driver that does exactly what we need with no unnecessary bells and whistles to cause problems. * Added missing files, changed method signatures The methods implemented by the UART class now have the same signatures as the HardwareSerial class, so it will be easy to switch back if we need to. * Incorporated suggestions from Stefan * Fixed TX_IDLE_NUM bug reported by mstrens * Quick test for Bf: problem This is not the final solution. * Fixed stupid typo in last commit * Another test - check for client_buffer space * Use the esp-idf uart driver You can revert to the direct driver for testing by defining DIRECT_UART * Uart class now supports VFD and TMC * data bits, stop bits, parity as enum classes The constants for data bits, stop bits, and parity were changed to enum classes so the compiler can check for argument order mismatches. * Set half duplex after uart init * Init TMC UART only once * rx/tx pin order mixup, missing _uart_started * Test: use Arduino Serial This reverts to the Arduino serial driver for UI communication, leaving the VFS comms on the Uart class on top of the esp_idf UART driver. You can switch back and forth with the define REVERT_TO_SERIAL line in Serial.cpp * REVERT_TO_ARDUINO_SERIAL off by default * Added debug messages * Update Grbl.h * Update platformio.ini Co-authored-by: bdring <[email protected]> * Fixed spindle sync for all VFD spindles (#868) * Implemented H2A spindle sync fix. Untested. * Changed the spindle sync fix to be in the VFD code. * Update Grbl.h Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: bdring <[email protected]> * New jog fix (#872) * Applied 741 to new Devt * Make kinematics routines weak to eliminate ifdefs * Fixed warning * Update build date Co-authored-by: bdring <[email protected]> * need to override set_rpm * trying set_rpm override * it turns on! * start/stop and set speed all working * cleanup * fixing machine.h * fix .gitignore *&vi .gitignore didn't work anyway * forgot to get rid of hard coded max_freq, fixed now * changed 'speed' to 'freq' * reverting platformio.ini * minor readme update * removed debug msg * Big kinematics cleanup (#875) * Applied 741 to new Devt * Make kinematics routines weak to eliminate ifdefs * Fixed warning * Big kinematics cleanup * Cleanup * no isCancelled arg for jog_execute; return it instead * WIP * Made OLED compliant with new kinematics * Added system_get_mpos * system_get_mpos() returns float* * WIP * Cleanup after testing - Had MPos and WPos text on OLED backwards. - Added my cartesian test def - Will remove test defs before merging to devt. * Cleanup of remaining user optional code. * Fixed delta kinematics loop ending early. * Account for jog cancel in saved motor positions * Update Grbl.h Co-authored-by: bdring <[email protected]> * Add the Root 4 Lite CNC machine to the Machines folder (#886) * update for the Root 4 Lite * Return machine.h to use test_drive.hy * Removed some machine definitions Co-authored-by: bdring <[email protected]> * YL620_Fix (#941) * YL620_Fix Fix per ... #926 (comment) Added CNC_xPro machine def * Update Grbl.h * Delete CNC_xPRO_V5_XYYZ_PWM_NO.h * fixes for RPM * note * fixed rx length * fix smell and update readme * clang format * trying to fix newlines * trying to fix newlines part 2 * fix cast issue * fixed spinup spindown swap. * Core xy soft limits (#960) * Soft limit fix * Update Grbl.h * Increase serial task stack size (#970) * Increase stack size - Also changed defaults of trinamic motor currents * Update Grbl.h * 5160 class fix (#981) * Fixed class inheritance * Update date * Update Machine.h * Update Grbl.h Co-authored-by: me <[email protected]> Co-authored-by: Mitch Bradley <[email protected]> Co-authored-by: marcosprojects <[email protected]> Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: Pete <[email protected]> Co-authored-by: Jesse Schoch <[email protected]>
* changing to EXTENDED type from GRBL type to prevent sender issues when running 1585 * Oled2 (#834) * WIP * WIP * Update platformio.ini * WIP * Cleanup * Update platformio.ini * Turn off soft limits with max travel (#836) #831 * Yalang YL620 VFD (#838) * New SpindleType YL620 Files for new SpindleType Yalang 620. So far the contents are a duplicate of H2ASpindle.h and H2ASpindle.cpp * Added register documentation and implemented read and write data packets * Some fixes, mostly regarding RX packet length * OLED and Other Updates (#844) * publish * Updates - CoreXY and OLED - Moved position calculation out of report_realtime_status(...) so other functions can access it. - Added a function to check if a limit switch is defined - CoreXY fixed bug in forward kinematics when midtbot is used. - Modified OLED display. * Cleanup for PR * Delete midtbot_x2.h * Incorporated PR 846 - Some OLED cleanup - verified correct forward kinematics on MidTbot * Pio down rev (#850) * Update platformio.ini * Update Grbl.h * Use local UART driver not HardwareSerial (#857) * Use local UART driver not HardwareSerial The HardwareSerial driver is broken in Arduino framework versions 1.0.5 and 1.0.6 . espressif/arduino-esp32#5005 Instead of waiting for a fix, I wrote a very simple UART driver that does exactly what we need with no unnecessary bells and whistles to cause problems. * Added missing files, changed method signatures The methods implemented by the UART class now have the same signatures as the HardwareSerial class, so it will be easy to switch back if we need to. * Incorporated suggestions from Stefan * Fixed TX_IDLE_NUM bug reported by mstrens * Quick test for Bf: problem This is not the final solution. * Fixed stupid typo in last commit * Another test - check for client_buffer space * Use the esp-idf uart driver You can revert to the direct driver for testing by defining DIRECT_UART * Uart class now supports VFD and TMC * data bits, stop bits, parity as enum classes The constants for data bits, stop bits, and parity were changed to enum classes so the compiler can check for argument order mismatches. * Set half duplex after uart init * Init TMC UART only once * rx/tx pin order mixup, missing _uart_started * Test: use Arduino Serial This reverts to the Arduino serial driver for UI communication, leaving the VFS comms on the Uart class on top of the esp_idf UART driver. You can switch back and forth with the define REVERT_TO_SERIAL line in Serial.cpp * REVERT_TO_ARDUINO_SERIAL off by default * Added debug messages * Update Grbl.h * Update platformio.ini Co-authored-by: bdring <[email protected]> * Fixed spindle sync for all VFD spindles (#868) * Implemented H2A spindle sync fix. Untested. * Changed the spindle sync fix to be in the VFD code. * Update Grbl.h Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: bdring <[email protected]> * New jog fix (#872) * Applied 741 to new Devt * Make kinematics routines weak to eliminate ifdefs * Fixed warning * Update build date Co-authored-by: bdring <[email protected]> * need to override set_rpm * trying set_rpm override * it turns on! * start/stop and set speed all working * cleanup * fixing machine.h * fix .gitignore *&vi .gitignore didn't work anyway * forgot to get rid of hard coded max_freq, fixed now * changed 'speed' to 'freq' * reverting platformio.ini * minor readme update * removed debug msg * Big kinematics cleanup (#875) * Applied 741 to new Devt * Make kinematics routines weak to eliminate ifdefs * Fixed warning * Big kinematics cleanup * Cleanup * no isCancelled arg for jog_execute; return it instead * WIP * Made OLED compliant with new kinematics * Added system_get_mpos * system_get_mpos() returns float* * WIP * Cleanup after testing - Had MPos and WPos text on OLED backwards. - Added my cartesian test def - Will remove test defs before merging to devt. * Cleanup of remaining user optional code. * Fixed delta kinematics loop ending early. * Account for jog cancel in saved motor positions * Update Grbl.h Co-authored-by: bdring <[email protected]> * Add the Root 4 Lite CNC machine to the Machines folder (#886) * update for the Root 4 Lite * Return machine.h to use test_drive.hy * Removed some machine definitions Co-authored-by: bdring <[email protected]> * YL620_Fix (#941) * YL620_Fix Fix per ... #926 (comment) Added CNC_xPro machine def * Update Grbl.h * Delete CNC_xPRO_V5_XYYZ_PWM_NO.h * fixes for RPM * note * fixed rx length * fix smell and update readme * clang format * trying to fix newlines * trying to fix newlines part 2 * fix cast issue * fixed spinup spindown swap. * Core xy soft limits (#960) * Soft limit fix * Update Grbl.h * Increase serial task stack size (#970) * Increase stack size - Also changed defaults of trinamic motor currents * Update Grbl.h * 5160 class fix (#981) * Fixed class inheritance * Update date * Update Machine.h * Update Grbl.h * Improved an example and added link to FluidNC * Update Grbl.h Co-authored-by: me <[email protected]> Co-authored-by: Mitch Bradley <[email protected]> Co-authored-by: marcosprojects <[email protected]> Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: Stefan de Bruijn <[email protected]> Co-authored-by: Pete <[email protected]> Co-authored-by: Jesse Schoch <[email protected]>
Our application - https://github.com/bdring/Grbl_Esp32 - works fine on v1.0.4, but loses Serial Rx bytes on every version after that, starting at 1.0.5-rc1. In developer testing, the loss of data typically occurs about 15 minutes into a 20 minute test run involving sending a 600KB GCode file sent via serial from third-party GCode sending programs that are very well tested. Multiple users have reported much quicker failures.
When we or our users compile against v1.0.4, the problems disappear. The problems appear when compiling against any variant of 1.0.5 or 1.0.6. It is the same with Arduino IDE and PlatformIO - if the Arduino ESP32 framework is v1.0.4, it works, and any later version fails.
The nature of the problem is a lost byte. In every instance that we have analyzed in depth, the lost byte is the newline at the end of a line.
I have isolated the cause of the problem to the rx portion of the patch in #3664 . The attempted fix to that patch - #3713 - does not solve the problem. The 3713 fix changes the failure mode, by eliminating the interchange of two characters at the expense of somewhat-less-frequent lost bytes.
The smallest fix that I have found is to simply revert this change from the 3664 patch:
That reversion suffices to make our application work reliably, but I do not believe that it is completely correct. I think that all of the code that uses uartRxFifoToQueue() should also be removed. Reaching around the ISR routine from uartRead() and uartPeek() - even when interrupts are disabled temporarily - is a recipe for obscure bugs, which we are experiencing. I think that the reverted return line has the effect of reducing the likelihood that uartRxFifoToQueue() is called, thus reducing, but probably not entirely eliminating, the possibility of lost data.
PR 3664 was intended to reduce Rx latency. I think a much better solution to that goal would be to make the FIFO and TOUT thresholds configurable, preserving the classic driver architecture where the ISR is the only writer to the queue.
I can produce a PR but I first wanted to document and explain the problem.
The text was updated successfully, but these errors were encountered: