diff --git a/.github/workflows/TestCompile.yml b/.github/workflows/TestCompile.yml
new file mode 100644
index 00000000..a5e48256
--- /dev/null
+++ b/.github/workflows/TestCompile.yml
@@ -0,0 +1,87 @@
+# TestCompile.yml
+# Github workflow script to test compile all examples of an Arduino library repository.
+#
+# Copyright (C) 2020  Armin Joachimsmeyer
+# https://github.com/ArminJo/Github-Actions
+#
+
+# This is the name of the workflow, visible on GitHub UI.
+name: TestCompile
+on:  
+  push: # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows#pull-request-event-pull_request
+    paths:
+    - '**.ino'
+    - '**.cpp'
+    - '**.h'
+    - '**TestCompile.yml'
+  pull_request:
+jobs:
+  build:
+    name: Test compiling examples for Digispark
+    runs-on: ubuntu-18.04
+    env:
+      # Comma separated list without double quotes around the list. 
+      REQUIRED_LIBRARIES: SparkFun MS5637 Barometric Pressure Library,SparkFun MMA8452Q Accelerometer
+      PLATFORM_DEFAULT_URL: https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json
+
+    strategy:
+      matrix:
+        # The matrix will produce one job for each configuration parameter of type `arduino-boards-fqbn`
+        # In the Arduino IDE, the fqbn is printed in the first line of the verbose output for compilation as parameter -fqbn=... for the "arduino-builder -dump-prefs" command
+        #
+        # Examples: arduino:avr:uno, arduino:avr:leonardo, arduino:avr:nano, arduino:avr:mega
+        # arduino:sam:arduino_due_x, arduino:samd:arduino_zero_native"
+        # ATTinyCore:avr:attinyx5:chip=85,clock=1internal, digistump:avr:digispark-tiny, digistump:avr:digispark-pro
+        # STM32:stm32:GenF1:pnum=BLUEPILL_F103C8
+        # esp8266:esp8266:huzzah:eesz=4M3M,xtal=80, esp32:esp32:featheresp32:FlashFreq=80
+        # You may add a suffix behind the fqbn with "|" to specify one board for e.g. different compile options like arduino:avr:uno|trace
+        #############################################################################################################
+        arduino-boards-fqbn:
+          - SparkFun:apollo3:artemis
+          - SparkFun:apollo3:amap3redboard
+          - SparkFun:apollo3:amap3nano
+          - SparkFun:apollo3:amap3atp
+          - SparkFun:apollo3:amap3thing
+          - SparkFun:apollo3:edge
+          - SparkFun:apollo3:edge2
+
+
+        # Specify parameters for each board.
+        # With examples-exclude you may exclude specific examples for a board. Use a comma separated list.
+        #############################################################################################################
+        include:
+          - arduino-boards-fqbn: SparkFun:apollo3:artemis
+            examples-exclude: Example4_analogRead,LowPower_WithWork,Example2_Serial,Example2_MoreSPIPorts,Example6_19servos,Example7_29servos
+
+          - arduino-boards-fqbn: SparkFun:apollo3:amap3redboard
+            examples-exclude: Example2_MoreSPIPorts
+
+          - arduino-boards-fqbn: SparkFun:apollo3:amap3nano
+            examples-exclude: Example6_19servos,Example7_29servos
+
+          - arduino-boards-fqbn: SparkFun:apollo3:amap3atp
+            examples-exclude: Example4_analogRead,Example6_19servos
+
+          - arduino-boards-fqbn: SparkFun:apollo3:amap3thing
+
+          - arduino-boards-fqbn: SparkFun:apollo3:edge
+            examples-exclude: Example4_analogRead,LowPower_WithWork,Example2_Serial,Example6_19servos,Example7_29servos
+
+          - arduino-boards-fqbn: SparkFun:apollo3:edge2
+            examples-exclude: Example4_analogRead,LowPower_WithWork,Example2_Serial,Example1_SPI,Example6_19servos,Example7_29servos
+
+      # Do not cancel all jobs / architectures if one job fails
+      fail-fast: false    
+    steps:
+      - name: Checkout
+        uses: actions/checkout@master
+
+      - name: Compile all examples
+        uses: ArminJo/arduino-test-compile@v2
+        with:
+          required-libraries: ${{ env.REQUIRED_LIBRARIES }}
+          arduino-board-fqbn: ${{ matrix.arduino-boards-fqbn }}
+          platform-default-url: ${{ env.PLATFORM_DEFAULT_URL }}
+          platform-url: ${{ matrix.platform-url }}
+          examples-exclude: ${{ matrix.examples-exclude }}
+          examples-build-properties: ${{ toJson(matrix.examples-build-properties) }}
diff --git a/cores/arduino/ard_sup/analog/ap3_analog.cpp b/cores/arduino/ard_sup/analog/ap3_analog.cpp
index 636116ca..accfd13b 100644
--- a/cores/arduino/ard_sup/analog/ap3_analog.cpp
+++ b/cores/arduino/ard_sup/analog/ap3_analog.cpp
@@ -538,7 +538,8 @@ ap3_err_t ap3_pwm_output(uint8_t pin, uint32_t th, uint32_t fw, uint32_t clk)
 
     // if timer is running wait for timer value to roll over (will indicate that at least one pulse has been emitted)
     AM_CRITICAL_BEGIN // critical section when reading / writing config registers
-        if (*((uint32_t *)CTIMERADDRn(CTIMER, timer, CTRL0)) & (CTIMER_CTRL0_TMRA0EN_Msk | CTIMER_CTRL0_TMRB0EN_Msk))
+    if ((segment == AM_HAL_CTIMER_TIMERA && *((uint32_t *)CTIMERADDRn(CTIMER, timer, CTRL0)) & (CTIMER_CTRL0_TMRA0EN_Msk)) ||
+        (segment == AM_HAL_CTIMER_TIMERB && *((uint32_t *)CTIMERADDRn(CTIMER, timer, CTRL0)) & (CTIMER_CTRL0_TMRB0EN_Msk)))
     {
         uint32_t current = 0;
         uint32_t last = 0;
@@ -548,11 +549,10 @@ ap3_err_t ap3_pwm_output(uint8_t pin, uint32_t th, uint32_t fw, uint32_t clk)
             current = am_hal_ctimer_read(timer, segment);
         } while (current >= last);
     }
-
     AM_CRITICAL_END // end critical section
 
-        // clear timer (also stops the timer)
-        am_hal_ctimer_clear(timer, segment);
+    // clear timer (also stops the timer)
+    am_hal_ctimer_clear(timer, segment);
 
     // Configure the repeated pulse mode with our clock source
     am_hal_ctimer_config_single(timer,
diff --git a/libraries/Wire/src/Wire.cpp b/libraries/Wire/src/Wire.cpp
index 889d0021..ee7c3af9 100644
--- a/libraries/Wire/src/Wire.cpp
+++ b/libraries/Wire/src/Wire.cpp
@@ -373,17 +373,17 @@ TwoWire Wire1(AP3_Wire1_IOM);
 #endif
 
 #if WIRE_INTERFACES_COUNT > 2
-TwoWire Wire2(AP3_Wire1_IOM);
+TwoWire Wire2(AP3_Wire2_IOM);
 #endif
 
 #if WIRE_INTERFACES_COUNT > 3
-TwoWire Wire3(AP3_Wire1_IOM);
+TwoWire Wire3(AP3_Wire3_IOM);
 #endif
 
 #if WIRE_INTERFACES_COUNT > 4
-TwoWire Wire4(AP3_Wire1_IOM);
+TwoWire Wire4(AP3_Wire4_IOM);
 #endif
 
 #if WIRE_INTERFACES_COUNT > 5
-TwoWire Wire5(AP3_Wire1_IOM);
+TwoWire Wire5(AP3_Wire5_IOM);
 #endif
\ No newline at end of file