diff --git a/AtomCommon/AtomBase.cs b/AtomCommon/AtomBase.cs
index 00ae096c..a193e969 100644
--- a/AtomCommon/AtomBase.cs
+++ b/AtomCommon/AtomBase.cs
@@ -53,7 +53,18 @@ public static GpioButton Button
///
/// Gets the main .
///
- public static GpioController GpioController => _gpio;
+ public static GpioController GpioController
+ {
+ get
+ {
+ if (_gpio is null)
+ {
+ _gpio = new();
+ }
+
+ return _gpio;
+ }
+ }
///
/// Gets connected to GPIO 25.
diff --git a/nanoFramework.M5StickCommon/M5StickCBase.cs b/nanoFramework.M5StickCommon/M5StickCBase.cs
index f73d6e5c..8b76037f 100644
--- a/nanoFramework.M5StickCommon/M5StickCBase.cs
+++ b/nanoFramework.M5StickCommon/M5StickCBase.cs
@@ -134,7 +134,18 @@ public static Pcf8563 RealTimeClock
///
/// Gets the main GPIO Controller.
///
- public static GpioController GpioController => _gpio;
+ public static GpioController GpioController
+ {
+ get
+ {
+ if (_gpio is null)
+ {
+ _gpio = new();
+ }
+
+ return _gpio;
+ }
+ }
#if M5STICKC
static M5StickC()