@@ -128,13 +128,6 @@ void beginBoard()
128128 case ESP_RST_SDIO : Serial.println (F (" ESP_RST_SDIO" )); break ;
129129 default : Serial.println (F (" Unknown" ));
130130 }
131-
132- #ifdef ENABLE_DEVELOPER
133- Serial.println (" System reset" );
134- displayError (" WDT RST" ); // Freeze with displayed error
135- while (1 );
136- #endif
137-
138131 }
139132}
140133
@@ -202,26 +195,38 @@ void beginSD()
202195 }
203196}
204197
198+ // We want the UART2 interrupts to be pinned to core 0 to avoid competing with I2C interrupts
205199// We do not start the UART2 for GNSS->BT reception here because the interrupts would be pinned to core 1
206- // competing with I2C interrupts
207- // See issue: https://github.com/espressif/arduino-esp32/issues/3386
208200// We instead start a task that runs on core 0, that then begins serial
201+ // See issue: https://github.com/espressif/arduino-esp32/issues/3386
209202void beginUART2 ()
210203{
211- if (startUART2TaskHandle == NULL ) xTaskCreatePinnedToCore (
212- startUART2Task ,
204+ if (pinUART2TaskHandle == NULL ) xTaskCreatePinnedToCore (
205+ pinUART2Task ,
213206 " UARTStart" , // Just for humans
214207 2000 , // Stack Size
215208 NULL , // Task input parameter
216209 0 , // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest.
217- &startUART2TaskHandle , // Task handle
210+ &pinUART2TaskHandle , // Task handle
218211 0 ); // Core where task should run, 0=core, 1=Arduino
219212
220- while (uart2Started == false ) // Wait for task to run once
213+ while (uart2pinned == false ) // Wait for task to run once
221214 delay (1 );
222215}
223216
224- // These must be started after BT is up and running otherwise SerialBT.available will call reboot
217+ // Assign UART2 interrupts to the core 0. See: https://github.com/espressif/arduino-esp32/issues/3386
218+ void pinUART2Task ( void *pvParameters )
219+ {
220+ serialGNSS.begin (settings.dataPortBaud ); // UART2 on pins 16/17 for SPP. The ZED-F9P will be configured to output NMEA over its UART1 at the same rate.
221+ serialGNSS.setRxBufferSize (SERIAL_SIZE_RX);
222+ serialGNSS.setTimeout (50 );
223+
224+ uart2pinned = true ;
225+
226+ vTaskDelete ( NULL ); // Delete task once it has run once
227+ }
228+
229+ // Serial Read/Write tasks for the F9P must be started after BT is up and running otherwise SerialBT.available will cause reboot
225230void startUART2Tasks ()
226231{
227232 // Start the tasks for handling incoming and outgoing BT bytes to/from ZED-F9P
@@ -447,6 +452,6 @@ void beginSystemState()
447452 " BtnCheck" , // Just for humans
448453 buttonTaskStackSize, // Stack Size
449454 NULL , // Task input parameter
450- 1 , // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest.
455+ 0 , // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest.
451456 &ButtonCheckTaskHandle); // Task handle
452457}
0 commit comments