commit f8cf404d02f10a3c1bb0a83bf47e514ec48cdf9f
Author: Thomas Schöpping <tschoepp@cit-ec.uni-bielefeld.de>
Date:   Fri Aug 11 19:43:54 2017 +0200

    All outputs that were still printed to SD1 (on-board serial connector) have been switched to global.sercanmux1 (SD1-CAN-multiplexer)

diff --git a/components/ControllerAreaNetworkRx.cpp b/components/ControllerAreaNetworkRx.cpp
index 9b76779..30fbe1e 100644
--- a/components/ControllerAreaNetworkRx.cpp
+++ b/components/ControllerAreaNetworkRx.cpp
@@ -5,9 +5,13 @@
 #include <amiro/Constants.h>
 #include <amiro/ControllerAreaNetworkRx.h>
 
+#include <global.hpp>
+
 using namespace chibios_rt;
 using namespace amiro;
 
+extern Global global;
+
 using namespace types;
 using namespace amiro::constants;
 
@@ -36,7 +40,7 @@ ControllerAreaNetworkRx::
 msg_t ControllerAreaNetworkRx::receiveSensorVal(CANRxFrame *frame) {
   int deviceId = this->decodeDeviceId(frame);
 
-  // chprintf((BaseSequentialStream*) &SD1, "DeviceId: %d\r\n",deviceId);
+  // chprintf((BaseSequentialStream*) &global.sercanmux1, "DeviceId: %d\r\n",deviceId);
 
   switch (deviceId) {
     case CAN::PROXIMITY_RING_ID(0):
@@ -72,7 +76,7 @@ msg_t ControllerAreaNetworkRx::receiveSensorVal(CANRxFrame *frame) {
       break;
 
     case CAN::PROXIMITY_FLOOR_ID:
-      // chprintf((BaseSequentialStream*) &SD1, "CAN::PROXIMITY_FLOOR_ID");
+      // chprintf((BaseSequentialStream*) &global.sercanmux1, "CAN::PROXIMITY_FLOOR_ID");
       if (frame->DLC == 8) {
         proximityFloorValue[0] = frame->data16[0];
         proximityFloorValue[1] = frame->data16[1];
@@ -192,7 +196,7 @@ msg_t ControllerAreaNetworkRx::main(void) {
         CANRxFrame rxframe;
         msg_t message = canReceive(this->canDriver, CAN_ANY_MAILBOX, &rxframe, TIME_IMMEDIATE);
         if (message == RDY_OK) {
-          // chprintf((BaseSequentialStream*) &SD1, "Rx Message");
+          // chprintf((BaseSequentialStream*) &global.sercanmux1, "Rx Message");
           message = this->receiveMessage(&rxframe);
           if (message != RDY_OK)
             this->receiveSensorVal(&rxframe);
diff --git a/components/DistControl.cpp b/components/DistControl.cpp
index 21c6036..a416533 100644
--- a/components/DistControl.cpp
+++ b/components/DistControl.cpp
@@ -5,12 +5,16 @@
 
 #include <amiro/DistControl.h>
 
+#include <global.hpp>
+
 using namespace chibios_rt;
 using namespace amiro;
 using namespace types;
 using namespace constants;
 using namespace constants::DiWheelDrive;
 
+extern Global global;
+
 DistControl::DistControl(MotorControl* mc, MotorIncrements* mi)
     : BaseStaticThread<256>(),
       motorControl(mc),
@@ -142,7 +146,7 @@ msg_t DistControl::main(void) {
 
 /*
       if (time-printTime > MS2ST(100)) {
-        chprintf((BaseSequentialStream*) &SD1, "dist = %i um, angle = %i urad, ed = %i um, ea = %i, v = %i um/s, w = %i urad/s\n", realDistance, realAngle, errorDistance, errorAngle, targetVelocity.x, targetVelocity.w_z);
+        chprintf((BaseSequentialStream*) &global.sercanmux1, "dist = %i um, angle = %i urad, ed = %i um, ea = %i, v = %i um/s, w = %i urad/s\n", realDistance, realAngle, errorDistance, errorAngle, targetVelocity.x, targetVelocity.w_z);
         printTime = time;
       }
 */
diff --git a/components/Lidar.cpp b/components/Lidar.cpp
index 7d5a273..a3b7a31 100644
--- a/components/Lidar.cpp
+++ b/components/Lidar.cpp
@@ -1,8 +1,12 @@
 #include <amiro/Lidar.h>
 
+#include <global.hpp>
+
 using namespace chibios_rt;
 using namespace amiro;
 
+extern Global global;
+
 uint8_t Lidar::scannedData[NUMBER_OF_CHARACTERS + 1] = {};
 
 Lidar::Lidar(const uint8_t boardId, Lidar::SETUP setup)
@@ -49,18 +53,18 @@ msg_t Lidar::main(void) {
         flushSD2InputQueue();
 
         // Configure LIDAR serial interface speed
-//       chprintf((BaseSequentialStream*) &SD1, "Speed switch to " STR(SD_SPEED) "\n");
+//       chprintf((BaseSequentialStream*) &global.sercanmux1, "Speed switch to " STR(SD_SPEED) "\n");
         chprintf((BaseSequentialStream*) &SD2, "SS" STR(SD_SPEED_PREFIX) STR(SD_SPEED) LF);
 
         // Check if the switch went well, otherwise terminate the thread
         if (checkDataString("SS" STR(SD_SPEED_PREFIX) STR(SD_SPEED) "\n00P\n\n")) {
-          chprintf((BaseSequentialStream*) &SD1, "Lidar speed switch OK\n");
+          chprintf((BaseSequentialStream*) &global.sercanmux1, "Lidar speed switch OK\n");
           // Configure serial interface of STM32
           sdStop(&SD2);
           SerialConfig sdLidarconf = { SD_SPEED, 0, 0, 0 };
           sdStart(&SD2, &sdLidarconf);
         } else {
-          chprintf((BaseSequentialStream*) &SD1, "Lidar speed switch NOT OK: Terminating Lidar \n");
+          chprintf((BaseSequentialStream*) &global.sercanmux1, "Lidar speed switch NOT OK: Terminating Lidar \n");
           palWritePad(GPIOB, GPIOB_LASER_EN, PAL_LOW);
           return -1;
         }
@@ -200,7 +204,7 @@ msg_t Lidar::updateSensorVal() {
             --this->dataIdx;
             this->lastInput = this->newInput;
           }
-          //chprintf((BaseSequentialStream*) &SD1, "%d ", this->newInput);
+          //chprintf((BaseSequentialStream*) &global.sercanmux1, "%d ", this->newInput);
         } else {
           step = FAIL;
         }
@@ -216,9 +220,9 @@ msg_t Lidar::updateSensorVal() {
         break;
       case DATA_SHOW:
         // Show the decoded data
-        chprintf((BaseSequentialStream*) &SD1, "\n%d", this->dataCounter);
+        chprintf((BaseSequentialStream*) &global.sercanmux1, "\n%d", this->dataCounter);
         for (uint32_t idx=0; idx < this->dataIdx; idx+=2) {
-          chprintf((BaseSequentialStream*) &SD1, "\n%d", *((uint16_t*) &(Lidar::scannedData[idx])));
+          chprintf((BaseSequentialStream*) &global.sercanmux1, "\n%d", *((uint16_t*) &(Lidar::scannedData[idx])));
         }
         step = FINISH;
         break;
@@ -252,11 +256,11 @@ void Lidar::printData() {
       if (lastInput == 10 && newInput == 10) {
         return;
       } else {
-        chprintf((BaseSequentialStream*) &SD1, "%c", newInput);
+        chprintf((BaseSequentialStream*) &global.sercanmux1, "%c", newInput);
       }
       lastInput = newInput;
     } else {
-      chprintf((BaseSequentialStream*) &SD1, "TIMEOUT\n", newInput);
+      chprintf((BaseSequentialStream*) &global.sercanmux1, "TIMEOUT\n", newInput);
       return;
     }
   }
@@ -291,7 +295,7 @@ bool_t Lidar::checkDataString(const char compareString[]) {
 
 void Lidar::printDetails() {
 
-  chprintf((BaseSequentialStream*) &SD1, "Print sensor details:\n");
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "Print sensor details:\n");
 
   // Tell the sensor to transmit its details
   chprintf((BaseSequentialStream*) &SD2, "VV\n");
@@ -302,7 +306,7 @@ void Lidar::printDetails() {
 
 void Lidar::printSpecification() {
 
-  chprintf((BaseSequentialStream*) &SD1, "Print sensor specification:\n");
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "Print sensor specification:\n");
 
   // Tell the sensor to transmit its specifications
   chprintf((BaseSequentialStream*) &SD2, "PP\n");
@@ -312,7 +316,7 @@ void Lidar::printSpecification() {
 }
 
 void Lidar::printInformation() {
-  chprintf((BaseSequentialStream*) &SD1, "Print sensor information:\n");
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "Print sensor information:\n");
 
   // Tell the sensor to transmit its information
   chprintf((BaseSequentialStream*) &SD2, "II\n");
diff --git a/components/MotorControl.cpp b/components/MotorControl.cpp
index 12d543c..f5d72dd 100644
--- a/components/MotorControl.cpp
+++ b/components/MotorControl.cpp
@@ -232,9 +232,9 @@ void MotorControl::calibrate() {
       System::getTime() - this->wheelCalibrationTime > 1500) {
     this->motorCalibrationFactor = (float)this->rightWValues[0]/(float)this->leftWValues[0];
 
-    chprintf((BaseSequentialStream*) &SD1, "motorCalibrationFactor =   %f  \n" ,this->motorCalibrationFactor);
-    chprintf((BaseSequentialStream*) &SD1, "rw =   %i  \n" ,this->rightWValues[0]);
-    chprintf((BaseSequentialStream*) &SD1, "lw =   %i  \n" ,this->leftWValues[0]);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "motorCalibrationFactor =   %f  \n" ,this->motorCalibrationFactor);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "rw =   %i  \n" ,this->rightWValues[0]);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "lw =   %i  \n" ,this->leftWValues[0]);
 
     this->pwmPercentage[LEFT_WHEEL] = 0;
     this->pwmPercentage[RIGHT_WHEEL] = 0;
@@ -257,7 +257,7 @@ void MotorControl::calibrateZiegler() {
     if (ziegler && ziegler2){
         this->targetVelocity.x = 200000 * ((zieglerHelp%2 == 0) ? 1 : -1);
         this->pGain = 1000 + 100 * zieglerHelp;
-        chprintf((BaseSequentialStream*) &SD1, "pgain =  %i  \n" , this->pGain);
+        chprintf((BaseSequentialStream*) &global.sercanmux1, "pgain =  %i  \n" , this->pGain);
         zieglerHelp++;
         ziegler = false;
         ziegler2 = false;
@@ -281,7 +281,7 @@ void MotorControl::calibrateZiegler() {
         zieglerHelp2++;
         if (zieglerHelp2 > 20){
            this->zieglerPeriod  = numberOfLastVelocitiesV * this->period / nsc;
-           chprintf((BaseSequentialStream*) &SD1, "zieglerPeriod =   %f  \n" ,this->zieglerPeriod);
+           chprintf((BaseSequentialStream*) &global.sercanmux1, "zieglerPeriod =   %f  \n" ,this->zieglerPeriod);
 
            this->targetVelocity.x = 0;
            this->pGain = (int) (this->pGain* 0.6);
@@ -290,9 +290,9 @@ void MotorControl::calibrateZiegler() {
            this->memory->setpGain(this->pGain);
            this->memory->setiGain(this->iGain);
            this->memory->setdGain(this->dGain);
-           chprintf((BaseSequentialStream*) &SD1, "pgain =   %i  \n" ,this->pGain);
-           chprintf((BaseSequentialStream*) &SD1, "igain =   %f  \n" ,this->iGain);
-           chprintf((BaseSequentialStream*) &SD1, "dgain =   %f  \n" ,this->dGain);
+           chprintf((BaseSequentialStream*) &global.sercanmux1, "pgain =   %i  \n" ,this->pGain);
+           chprintf((BaseSequentialStream*) &global.sercanmux1, "igain =   %f  \n" ,this->iGain);
+           chprintf((BaseSequentialStream*) &global.sercanmux1, "dgain =   %f  \n" ,this->dGain);
 
            this->motorCalibration = true;
            ziegler = true;
@@ -428,10 +428,10 @@ int MotorControl::getNumberofSignChanges(){
 }
 
 void MotorControl::printGains(){
-    chprintf((BaseSequentialStream*)&SD1, "motorCalibrationFactor %f\n", this->motorCalibrationFactor );
-    chprintf((BaseSequentialStream*)&SD1, "pGain %i\n", this->pGain );
-    chprintf((BaseSequentialStream*)&SD1, "iGain %f\n", this->iGain );
-    chprintf((BaseSequentialStream*)&SD1, "dGain %f\n", this->dGain );
+    chprintf((BaseSequentialStream*)&global.sercanmux1, "motorCalibrationFactor %f\n", this->motorCalibrationFactor );
+    chprintf((BaseSequentialStream*)&global.sercanmux1, "pGain %i\n", this->pGain );
+    chprintf((BaseSequentialStream*)&global.sercanmux1, "iGain %f\n", this->iGain );
+    chprintf((BaseSequentialStream*)&global.sercanmux1, "dGain %f\n", this->dGain );
 }
 
 void MotorControl::resetGains()
diff --git a/components/Odometry.cpp b/components/Odometry.cpp
index d3a1cb5..071654e 100644
--- a/components/Odometry.cpp
+++ b/components/Odometry.cpp
@@ -9,11 +9,14 @@
 #include <Matrix.h> // Matrixoperations "Matrix::*"
 #include <amiro/Constants.h> // Constants "constants::*"
 #include <chprintf.h>
+#include <global.hpp>
 
 using namespace chibios_rt;
 using namespace amiro;
 using namespace constants::DiWheelDrive;
 
+extern Global global;
+
 
 Odometry::Odometry(MotorIncrements* mi, L3G4200D* gyroscope)
     : BaseStaticThread<1024>(),
@@ -58,10 +61,10 @@ types::position Odometry::getPosition() {
     robotPosition.y = this->pY * 1e6;
     robotPosition.f_z = (int32_t(this->pPhi * 1e6) % piScaled) + ((this->pPhi < 0) ? piScaled : 0);  // Get only the postitve angel f_z in [0 .. 2 * pi]
   chSysUnlock();
-//     chprintf((BaseSequentialStream*) &SD1, "X:%d Y:%d Phi:%d", robotPosition.x,robotPosition.y, robotPosition.f_z);
-//     chprintf((BaseSequentialStream*) &SD1, "\r\n");
-//     chprintf((BaseSequentialStream*) &SD1, "X:%f Y:%f Phi:%f", this->pX,this->pY, this->pPhi);
-//     chprintf((BaseSequentialStream*) &SD1, "\r\n");
+//     chprintf((BaseSequentialStream*) &global.sercanmux1, "X:%d Y:%d Phi:%d", robotPosition.x,robotPosition.y, robotPosition.f_z);
+//     chprintf((BaseSequentialStream*) &global.sercanmux1, "\r\n");
+//     chprintf((BaseSequentialStream*) &global.sercanmux1, "X:%f Y:%f Phi:%f", this->pX,this->pY, this->pPhi);
+//     chprintf((BaseSequentialStream*) &global.sercanmux1, "\r\n");
   return robotPosition;
 }
 
@@ -110,18 +113,18 @@ msg_t Odometry::main(void) {
 
     // Calculate the odometry
     this->updateOdometry();
-		
 
-//     chprintf((BaseSequentialStream*) &SD1, "X:%f Y:%f Phi:%f", this->pX,this->pY, this->pPhi);
-//     chprintf((BaseSequentialStream*) &SD1, "\r\n");
-//     chprintf((BaseSequentialStream*) &SD1, "distance_left:%f distance_right:%f", this->distance[0],this->distance[1]);
-//     chprintf((BaseSequentialStream*) &SD1, "\r\n");
 
-	if (time >= System::getTime()) {
+//     chprintf((BaseSequentialStream*) &global.sercanmux1, "X:%f Y:%f Phi:%f", this->pX,this->pY, this->pPhi);
+//     chprintf((BaseSequentialStream*) &global.sercanmux1, "\r\n");
+//     chprintf((BaseSequentialStream*) &global.sercanmux1, "distance_left:%f distance_right:%f", this->distance[0],this->distance[1]);
+//     chprintf((BaseSequentialStream*) &global.sercanmux1, "\r\n");
+
+  if (time >= System::getTime()) {
       chThdSleepUntil(time);
     } else {
-      chprintf((BaseSequentialStream*) &SD1, "WARNING Odometry: Unable to keep track\r\n");
-	}
+      chprintf((BaseSequentialStream*) &global.sercanmux1, "WARNING Odometry: Unable to keep track\r\n");
+  }
   }
 
   return true;
@@ -139,7 +142,7 @@ void Odometry::updateOdometry() {
     Matrix::copy<float>(this->Cp3x3,3,3,Cp3x3,3,3);
     // Get the differentail gyro information and reset it
     angular_ud = gyro->getAngular_ud(L3G4200D::AXIS_Z);
-	gyro->angularReset();
+  gyro->angularReset();
   chSysUnlock();
 
   ////////////////
@@ -237,11 +240,11 @@ void Odometry::updateDistance() {
   // Get the current increments of the QEI
   MotorControl::updateIncrements(this->motorIncrements, this->increment, this->incrementDifference);
 //
-//  chprintf((BaseSequentialStream*) &SD1, "\ni_right = %d \t i_left = %d", this->increment[RIGHT_WHEEL], this->increment[LEFT_WHEEL]);
-//  chprintf((BaseSequentialStream*) &SD1, "\niDiff_right = %d \t iDiff_left = %d", this->incrementDifference[RIGHT_WHEEL], this->incrementDifference[LEFT_WHEEL]);
+//  chprintf((BaseSequentialStream*) &global.sercanmux1, "\ni_right = %d \t i_left = %d", this->increment[RIGHT_WHEEL], this->increment[LEFT_WHEEL]);
+//  chprintf((BaseSequentialStream*) &global.sercanmux1, "\niDiff_right = %d \t iDiff_left = %d", this->incrementDifference[RIGHT_WHEEL], this->incrementDifference[LEFT_WHEEL]);
 
   // Get the driven distance for each wheel
   MotorControl::updateDistance(this->incrementDifference, this->distance);
 
-//  chprintf((BaseSequentialStream*) &SD1, "\nx_right = %f \t x_left = %f", this->distance[RIGHT_WHEEL], this->distance[LEFT_WHEEL]);
+//  chprintf((BaseSequentialStream*) &global.sercanmux1, "\nx_right = %f \t x_left = %f", this->distance[RIGHT_WHEEL], this->distance[LEFT_WHEEL]);
 }
diff --git a/components/accel/lis331dlh.cpp b/components/accel/lis331dlh.cpp
index 574cdad..fb45447 100644
--- a/components/accel/lis331dlh.cpp
+++ b/components/accel/lis331dlh.cpp
@@ -6,9 +6,12 @@
 #include <chprintf.h>
 #include <cmath>  // abs()
 #include <amiro/Constants.h>
+#include <global.hpp>
 
 namespace amiro {
 
+extern Global global;
+
 LIS331DLH::
 LIS331DLH(HWSPIDriver *driver) :
   driver(driver),
@@ -238,7 +241,7 @@ printSelfTest(LIS331DLHConfig* config) {
   this->configure(&test_accel_run_cfg);
   BaseThread::sleep(MS2ST(sleepBetweenMeasurementMs));
   // Grep some values and build the mean value
-  chprintf((BaseSequentialStream*) &SD1, "\nACC: Get acc std values\n");
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "\nACC: Get acc std values\n");
   int32_t stdAccValues[3] = { this->getAcceleration(LIS331DLH::AXIS_X), this
       ->getAcceleration(LIS331DLH::AXIS_Y), this->getAcceleration(
       LIS331DLH::AXIS_Z) };
@@ -248,10 +251,10 @@ printSelfTest(LIS331DLHConfig* config) {
     for (uint8_t i = LIS331DLH::AXIS_X; i <= LIS331DLH::AXIS_Z; i++) {
       accel = int32_t(this->getAcceleration(i));
       stdAccValues[i] = (stdAccValues[i] * n + accel) / (n + 1);
-      chprintf((BaseSequentialStream*) &SD1, "%c%d:%d ", accel < 0 ? '-' : '+',
+      chprintf((BaseSequentialStream*) &global.sercanmux1, "%c%d:%d ", accel < 0 ? '-' : '+',
                 accel < 0 ? -accel : accel, stdAccValues[i]);
     }
-    chprintf((BaseSequentialStream*) &SD1, "\n");
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "\n");
   }
 
   // 2. Apply negative offset
@@ -262,7 +265,7 @@ printSelfTest(LIS331DLHConfig* config) {
   this->configure(&test_accel_run_cfg);
   BaseThread::sleep(MS2ST(sleepBetweenMeasurementMs));
   // Grep some values and build the mean value
-  chprintf((BaseSequentialStream*) &SD1, "\nACC: Get acc neg values\n");
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "\nACC: Get acc neg values\n");
   int16_t negAccValues[3] = { this->getAcceleration(LIS331DLH::AXIS_X), this
       ->getAcceleration(LIS331DLH::AXIS_Y), this->getAcceleration(
       LIS331DLH::AXIS_Z) };
@@ -272,10 +275,10 @@ printSelfTest(LIS331DLHConfig* config) {
     for (uint8_t i = LIS331DLH::AXIS_X; i <= LIS331DLH::AXIS_Z; i++) {
       accel = int32_t(this->getAcceleration(i));
       negAccValues[i] = (negAccValues[i] * n + accel) / (n + 1);
-      chprintf((BaseSequentialStream*) &SD1, "%c%d:%d ", accel < 0 ? '-' : '+',
+      chprintf((BaseSequentialStream*) &global.sercanmux1, "%c%d:%d ", accel < 0 ? '-' : '+',
                 accel < 0 ? -accel : accel, negAccValues[i]);
     }
-    chprintf((BaseSequentialStream*) &SD1, "\n");
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "\n");
   }
 
   // 2. Apply positive offset
@@ -286,7 +289,7 @@ printSelfTest(LIS331DLHConfig* config) {
   this->configure(&test_accel_run_cfg);
   BaseThread::sleep(MS2ST(sleepBetweenMeasurementMs));
   // Grep some values and build the mean value
-  chprintf((BaseSequentialStream*) &SD1, "\nACC: Get acc pos values\n");
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "\nACC: Get acc pos values\n");
   int16_t posAccValues[3] = { this->getAcceleration(LIS331DLH::AXIS_X), this
       ->getAcceleration(LIS331DLH::AXIS_Y), this->getAcceleration(
       LIS331DLH::AXIS_Z) };
@@ -296,10 +299,10 @@ printSelfTest(LIS331DLHConfig* config) {
     for (uint8_t i = LIS331DLH::AXIS_X; i <= LIS331DLH::AXIS_Z; i++) {
       accel = int32_t(this->getAcceleration(i));
       posAccValues[i] = (posAccValues[i] * n + accel) / (n + 1);
-      chprintf((BaseSequentialStream*) &SD1, "%c%d:%d ", accel < 0 ? '-' : '+',
+      chprintf((BaseSequentialStream*) &global.sercanmux1, "%c%d:%d ", accel < 0 ? '-' : '+',
                 accel < 0 ? -accel : accel, posAccValues[i]);
     }
-    chprintf((BaseSequentialStream*) &SD1, "\n");
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "\n");
   }
 
   // Get the amplitude change and compare it to the standard values from LIS331DLH manual table 3
@@ -308,31 +311,31 @@ printSelfTest(LIS331DLHConfig* config) {
   const int32_t ampXmin = 120, ampYmin = 120, ampZmin = 140;
 
   // TEST
-  chprintf((BaseSequentialStream*) &SD1, "\n\nACC: Testresult\n");
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "\n\nACC: Testresult\n");
   amp = std::abs(
       stdAccValues[LIS331DLH::AXIS_X] - negAccValues[LIS331DLH::AXIS_X]);
   if (amp < ampXmin || amp > ampXmax)
-    chprintf((BaseSequentialStream*) &SD1, "ACC: Negative x-axis faulty\n");
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "ACC: Negative x-axis faulty\n");
   amp = std::abs(
       stdAccValues[LIS331DLH::AXIS_Y] - negAccValues[LIS331DLH::AXIS_Y]);
   if (amp < ampYmin || amp > ampYmax)
-    chprintf((BaseSequentialStream*) &SD1, "ACC: Negative y-axis faulty\n");
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "ACC: Negative y-axis faulty\n");
   amp = std::abs(
       stdAccValues[LIS331DLH::AXIS_Z] - negAccValues[LIS331DLH::AXIS_Z]);
   if (amp < ampZmin || amp > ampZmax)
-    chprintf((BaseSequentialStream*) &SD1, "ACC: Negative z-axis faulty\n");
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "ACC: Negative z-axis faulty\n");
   amp = std::abs(
       stdAccValues[LIS331DLH::AXIS_X] - posAccValues[LIS331DLH::AXIS_X]);
   if (amp < ampXmin || amp > ampXmax)
-    chprintf((BaseSequentialStream*) &SD1, "ACC: Positive x-axis faulty\n");
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "ACC: Positive x-axis faulty\n");
   amp = std::abs(
       stdAccValues[LIS331DLH::AXIS_Y] - posAccValues[LIS331DLH::AXIS_Y]);
   if (amp < ampYmin || amp > ampYmax)
-    chprintf((BaseSequentialStream*) &SD1, "ACC: Positive y-axis faulty\n");
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "ACC: Positive y-axis faulty\n");
   amp = std::abs(
       stdAccValues[LIS331DLH::AXIS_Z] - posAccValues[LIS331DLH::AXIS_Z]);
   if (amp < ampZmin || amp > ampZmax)
-    chprintf((BaseSequentialStream*) &SD1, "ACC: Positive z-axis faulty\n");
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "ACC: Positive z-axis faulty\n");
 
   // Write back the original config
   this->configure(config);
diff --git a/components/bluetooth/bluetooth-iwrap.cpp b/components/bluetooth/bluetooth-iwrap.cpp
index f2925fb..e1c7bb4 100644
--- a/components/bluetooth/bluetooth-iwrap.cpp
+++ b/components/bluetooth/bluetooth-iwrap.cpp
@@ -6,9 +6,13 @@
 #include <amiro/bluetooth/bluetooth-iwrap.hpp>
 #include <amiro/bluetooth/bluetooth-connector.hpp>
 
+#include <global.hpp>
+
 using namespace chibios_rt;
 using namespace amiro;
 
+extern Global global;
+
 /*
  * Class constructor
  */
@@ -52,7 +56,7 @@ msg_t BluetoothIwrap::iwrapReceive() {
 
   for (size_t i = 0; i < length; i++) {
     // print out received chars
-    chSequentialStreamPut((BaseSequentialStream*) &SD1, buffer[i]);
+    chSequentialStreamPut((BaseSequentialStream*) &global.sercanmux1, buffer[i]);
   }
 
   // reset block
@@ -135,7 +139,7 @@ void BluetoothIwrap::bluetoothIwrapSendCommand(const char* cmd) {
 
   size_t length = strlen(cmd);
 //  for (size_t i = 0; i < length; i++)
-//    chSequentialStreamPut((BaseSequentialStream*) &SD1, cmd[i]);   // To display the command
+//    chSequentialStreamPut((BaseSequentialStream*) &global.sercanmux1, cmd[i]);   // To display the command
 
   // To send the string command to WT12 bluetooth chip
   iwrapTransmit(HOST_IWRAP_PLAIN_LINKID,(uint8_t*) cmd, length);
diff --git a/components/bluetooth/bluetooth-serial.cpp b/components/bluetooth/bluetooth-serial.cpp
index 9efe73b..b554d17 100644
--- a/components/bluetooth/bluetooth-serial.cpp
+++ b/components/bluetooth/bluetooth-serial.cpp
@@ -3,9 +3,13 @@
 
 #include <amiro/bluetooth/bluetooth-serial.hpp>
 
+#include <global.hpp>
+
 using namespace chibios_rt;
 using namespace amiro;
 
+extern Global global;
+
 /*
  * Class constructor
  */
@@ -47,7 +51,7 @@ msg_t BluetoothSerial::serialReceive() {
   length = recv_descriptor->bluetoothDescriptorGetPayloadLength();
 
   for (size_t i = 0; i < length; i++)
-    chSequentialStreamPut((BaseSequentialStream*) &SD1, buffer[i]);
+    chSequentialStreamPut((BaseSequentialStream*) &global.sercanmux1, buffer[i]);
 
   msg = iwrap->transport.bluetoothTransportGetStorageMailbox()->post((msg_t) recv_descriptor, TIME_INFINITE);
   if ((msg == RDY_RESET) || stopflag)
diff --git a/components/bluetooth/checkutility.cpp b/components/bluetooth/checkutility.cpp
index 114436e..6cf0ff5 100644
--- a/components/bluetooth/checkutility.cpp
+++ b/components/bluetooth/checkutility.cpp
@@ -48,8 +48,8 @@ WT12CheckUtility::msgPrint(const char* message, const uint16_t length)
 {
   if (length > 0)
   {
-    chSequentialStreamWrite((BaseSequentialStream*)&SD1, (uint8_t*)message, length);
-//    chprintf((BaseSequentialStream*) &SD1, "[%d]\n", length);
+    chSequentialStreamWrite((BaseSequentialStream*)&global.sercanmux1, (uint8_t*)message, length);
+//    chprintf((BaseSequentialStream*) &global.sercanmux1, "[%d]\n", length);
   }
   return;
 }
@@ -72,7 +72,7 @@ WT12CheckUtility::sendMessage(char* message, uint8_t link_id)
 {
   const uint16_t length = strlen(message);
   if (length >= 1 << 10) {
-    chprintf((BaseSequentialStream*) &SD1, "%s(%d): ERROR: message too long!\n", __FILE__ , __LINE__);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): ERROR: message too long!\n", __FILE__ , __LINE__);
     return;
   }
 
@@ -116,7 +116,7 @@ WT12CheckUtility::receiveMessage(char* message, const uint16_t max_length)
 
   if (msg.head.length > max_length)
   {
-    chprintf((BaseSequentialStream*) &SD1, "%s(%d): ERROR: message too long (%d of max %d bytes)!\n", __FILE__ , __LINE__, msg.head.length, max_length);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): ERROR: message too long (%d of max %d bytes)!\n", __FILE__ , __LINE__, msg.head.length, max_length);
 
     for (uint16_t i = 0; i < msg.head.length; ++i) {
       chSequentialStreamGet((BaseSequentialStream*)&SD3);
@@ -132,7 +132,7 @@ WT12CheckUtility::receiveMessage(char* message, const uint16_t max_length)
 
   if (uint8_t(msg.head.link_id ^ msg.n_link) != 0xFFu)
   {
-    chprintf((BaseSequentialStream*) &SD1, "%s(%d): ERROR: message link id does not match (0x%02X vs 0x%02X)!\n", __FILE__ , __LINE__, msg.head.link_id, msg.n_link);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): ERROR: message link id does not match (0x%02X vs 0x%02X)!\n", __FILE__ , __LINE__, msg.head.link_id, msg.n_link);
   }
 
   return msg.head.length;
@@ -160,7 +160,7 @@ WT12CheckUtility::receiveMessages(char* message_buf, const uint16_t msg_buf_size
 //    }
 
     if (length_buf[msg_count] == 0) {
-      chprintf((BaseSequentialStream*) &SD1, "%s(%d): WARNING: receiving aborted after %d messages (%d bytes)\n", __FILE__ , __LINE__, msg_count, msg_pos);
+      chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): WARNING: receiving aborted after %d messages (%d bytes)\n", __FILE__ , __LINE__, msg_count, msg_pos);
       return msg_count;
     }
 
@@ -178,7 +178,7 @@ WT12CheckUtility::receiveMessages(char* message_buf, const uint16_t msg_buf_size
     }
 
     if (msg_count > len_buf_size) {
-      chprintf((BaseSequentialStream*) &SD1, "%s(%d): ERROR: maximum messages received (%d)!\n", __FILE__ , __LINE__, len_buf_size);
+      chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): ERROR: maximum messages received (%d)!\n", __FILE__ , __LINE__, len_buf_size);
       return len_buf_size;
     }
 
@@ -201,9 +201,9 @@ WT12CheckUtility::receiveRaw(uint8_t* buffer, uint16_t num_bytes, const bool pri
   {
     for (i = 0; i < num_bytes; ++i)
     {
-      chprintf((BaseSequentialStream*) &SD1, "%02X ", buffer[i]);
+      chprintf((BaseSequentialStream*) &global.sercanmux1, "%02X ", buffer[i]);
     }
-    chprintf((BaseSequentialStream*) &SD1, "\n");
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "\n");
   }
 
   return;
@@ -217,7 +217,7 @@ WT12CheckUtility::receiveRawLine(const bool print)
   {
     byte = chSequentialStreamGet((BaseSequentialStream*) &SD3);
     if (print) {
-      chprintf((BaseSequentialStream*) &SD1, "%c", byte);
+      chprintf((BaseSequentialStream*) &global.sercanmux1, "%c", byte);
     }
   }
 
@@ -233,7 +233,7 @@ WT12CheckUtility::clearMessageBuffer(const bool print)
     byte = sdGet(&SD3);
     //byte = chSequentialStreamGet((BaseSequentialStream*) &SD3);
     if (print) {
-      chprintf((BaseSequentialStream*) &SD1, "0x%02X <%c>\n", byte, byte);
+      chprintf((BaseSequentialStream*) &global.sercanmux1, "0x%02X <%c>\n", byte, byte);
     }
     BaseThread::sleep(MS2ST(1));
   }
diff --git a/components/gyro/l3g4200d.cpp b/components/gyro/l3g4200d.cpp
index 9bd136f..2201677 100644
--- a/components/gyro/l3g4200d.cpp
+++ b/components/gyro/l3g4200d.cpp
@@ -7,9 +7,12 @@
 #include <amiro/bus/spi/HWSPIDriver.hpp>
 #include <amiro/gyro/l3g4200d.hpp>
 #include <amiro/Constants.h>
+#include <global.hpp>
 
 using namespace chibios_rt;
 
+extern Global global;
+
 namespace amiro {
 
 L3G4200D::L3G4200D(HWSPIDriver *driver)
@@ -34,7 +37,7 @@ msg_t L3G4200D::main() {
   this->setName("l3g4200d");
 
   while (!this->shouldTerminate()) {
-	time += this->period_st;
+  time += this->period_st;
 
     updateSensorData();
     calcAngular();
@@ -44,8 +47,8 @@ msg_t L3G4200D::main() {
     if (time >= System::getTime()) {
       chThdSleepUntil(time);
     } else {
-      chprintf((BaseSequentialStream*) &SD1, "WARNING l3g4200d: Unable to keep track\r\n");
-	}
+      chprintf((BaseSequentialStream*) &global.sercanmux1, "WARNING l3g4200d: Unable to keep track\r\n");
+  }
   }
   return RDY_OK;
 }
@@ -168,7 +171,7 @@ msg_t L3G4200D::configure(const L3G4200DConfig *config) {
 
   // Reset the integration
   this->angularReset();
-    
+
   return RDY_OK;
 
 }
diff --git a/components/power/adconverter.cpp b/components/power/adconverter.cpp
index 2a02c0c..7b43812 100644
--- a/components/power/adconverter.cpp
+++ b/components/power/adconverter.cpp
@@ -116,14 +116,14 @@ ADConverter::main()
 
         if (global.adc1_buffer[0] > uV2Adc(this->watchdog_threshold_uV))
         {
-          chprintf((BaseSequentialStream*)&SD1, "%f > 9V detected: now charging\n", ((float)adc2uV(global.adc1_buffer[0]))/1000000.0f);
+          chprintf((BaseSequentialStream*)&global.sercanmux1, "%f > 9V detected: now charging\n", ((float)adc2uV(global.adc1_buffer[0]))/1000000.0f);
           global.robot.getPowerStatus().charging_flags.content.vsys_higher_than_9V = true;
           global.bq24103a[constants::PowerManagement::BAT_P7]->enable(true);
           global.bq24103a[constants::PowerManagement::BAT_P8]->enable(true);
           this->conversion_group.htr = ADC_HTR_HT;
           this->conversion_group.ltr = ADC_LTR(uV2Adc(this->watchdog_threshold_uV));
         } else {
-          chprintf((BaseSequentialStream*)&SD1, "%f < 9V detected: not charging\n", ((float)adc2uV(global.adc1_buffer[0]))/1000000.0f);
+          chprintf((BaseSequentialStream*)&global.sercanmux1, "%f < 9V detected: not charging\n", ((float)adc2uV(global.adc1_buffer[0]))/1000000.0f);
           global.robot.getPowerStatus().charging_flags.content.vsys_higher_than_9V = false;
           this->conversion_group.htr = ADC_HTR(uV2Adc(this->watchdog_threshold_uV));
           this->conversion_group.ltr = 0;
diff --git a/components/power/bq27500.cpp b/components/power/bq27500.cpp
index 694ee79..795f274 100644
--- a/components/power/bq27500.cpp
+++ b/components/power/bq27500.cpp
@@ -2,6 +2,7 @@
 
 #include <ch.hpp>
 #include <chprintf.h>
+#include <global.hpp>
 
 #include <cstring>
 
@@ -9,6 +10,8 @@ using namespace chibios_rt;
 using namespace amiro;
 using namespace BQ27500;
 
+extern Global global;
+
 Driver::Driver(I2CDriver &i2c_driver, const GPIO_TypeDef &batgd_pingrp, const uint8_t batgd_pin, const GPIO_TypeDef &batlow_pingrp, const uint8_t batlow_pin) :
   BaseSensor<BQ27500::InitData,BQ27500::CalibData>(), i2c_driver(&i2c_driver), tx_params({I2C_ADDR, NULL, 0, NULL, 0}),
   batgd_pingrp(&batgd_pingrp), batgd_pin(batgd_pin), batlow_pingrp(&batlow_pingrp), batlow_pin(batlow_pin)
@@ -26,7 +29,7 @@ Driver::getEventSource()
 msg_t
 Driver::init(InitData* initialization_data)
 {
-  chprintf((BaseSequentialStream*) &SD1, "%s(%d): TODO\n", __FILE__, __LINE__);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): TODO\n", __FILE__, __LINE__);
   return NOT_IMPLEMENTED;
 }
 
@@ -64,14 +67,14 @@ Driver::calibration(CalibData* calibration_data)
   DataFlashBlock block;
   this->readDataFlashBlock(block, CONFIGURATION_Safety);
 
-  chprintf((BaseSequentialStream*) &SD1, "%s(%d):\n", __FILE__, __LINE__);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d):\n", __FILE__, __LINE__);
   for(uint8_t i = 0; i < 32; ++i) {
-    chprintf((BaseSequentialStream*) &SD1, "%02X ", block.content.data[i]);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%02X ", block.content.data[i]);
   }
-  chprintf((BaseSequentialStream*) &SD1, "\n");
-  chprintf((BaseSequentialStream*) &SD1, "%02X\n", block.content.checksum);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "\n");
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "%02X\n", block.content.checksum);
 
-  chprintf((BaseSequentialStream*) &SD1, "%s(%d): TODO\n", __FILE__, __LINE__);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): TODO\n", __FILE__, __LINE__);
   return NOT_IMPLEMENTED;
 }
 #endif
@@ -89,7 +92,7 @@ Driver::selftest()
   {
     return ST_FAIL_READ_HW_VERSION;
   }
-  chprintf((BaseSequentialStream*) &SD1, "hardware version: %X%X-%X%X (0x%04X)\n", version.content.major_high, version.content.major_low, version.content.minor_high, version.content.minor_low, version.value);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "hardware version: %X%X-%X%X (0x%04X)\n", version.content.major_high, version.content.major_low, version.content.minor_high, version.content.minor_low, version.value);
 
   // read firmware version
   version.value = 0;
@@ -97,7 +100,7 @@ Driver::selftest()
   {
     return ST_FAIL_READ_FW_VERSION;
   }
-  chprintf((BaseSequentialStream*) &SD1, "firmware version: %X%X-%X%X (0x%04X)\n", version.content.major_high, version.content.major_low, version.content.minor_high, version.content.minor_low, version.value);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "firmware version: %X%X-%X%X (0x%04X)\n", version.content.major_high, version.content.major_low, version.content.minor_high, version.content.minor_low, version.value);
 
   // read device name
   uint8_t name_length = 0;
@@ -111,7 +114,7 @@ Driver::selftest()
     return ST_FAIL_READ_DEVICENAME;
   }
   name_buffer[name_length] = '\0';
-  chprintf((BaseSequentialStream*) &SD1, "device name: %s (%u characters)\n", name_buffer, name_length);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "device name: %s (%u characters)\n", name_buffer, name_length);
 
   // read the current flags
   Flags flags;
@@ -119,19 +122,19 @@ Driver::selftest()
   {
     return ST_FAIL_READ_FLAGS;
   }
-  chprintf((BaseSequentialStream*) &SD1, "flags: 0x%04X\n", flags.value);
-  chprintf((BaseSequentialStream*) &SD1, "  OTC     : %u\n", flags.content.otc);
-  chprintf((BaseSequentialStream*) &SD1, "  OTD     : %u\n", flags.content.otd);
-  chprintf((BaseSequentialStream*) &SD1, "  CHG_INH : %u\n", flags.content.chg_inh);
-  chprintf((BaseSequentialStream*) &SD1, "  XCHG    : %u\n", flags.content.xchg);
-  chprintf((BaseSequentialStream*) &SD1, "  FC      : %u\n", flags.content.fc);
-  chprintf((BaseSequentialStream*) &SD1, "  CHG     : %u\n", flags.content.chg);
-  chprintf((BaseSequentialStream*) &SD1, "  OCV_GD  : %u\n", flags.content.ocv_gd);
-  chprintf((BaseSequentialStream*) &SD1, "  WAIT_ID : %u\n", flags.content.wait_id);
-  chprintf((BaseSequentialStream*) &SD1, "  BAT_DET : %u\n", flags.content.bat_det);
-  chprintf((BaseSequentialStream*) &SD1, "  SOC1    : %u\n", flags.content.soc1);
-  chprintf((BaseSequentialStream*) &SD1, "  SOCF    : %u\n", flags.content.socf);
-  chprintf((BaseSequentialStream*) &SD1, "  DSG     : %u\n", flags.content.dsg);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "flags: 0x%04X\n", flags.value);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  OTC     : %u\n", flags.content.otc);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  OTD     : %u\n", flags.content.otd);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  CHG_INH : %u\n", flags.content.chg_inh);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  XCHG    : %u\n", flags.content.xchg);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  FC      : %u\n", flags.content.fc);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  CHG     : %u\n", flags.content.chg);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  OCV_GD  : %u\n", flags.content.ocv_gd);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  WAIT_ID : %u\n", flags.content.wait_id);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  BAT_DET : %u\n", flags.content.bat_det);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  SOC1    : %u\n", flags.content.soc1);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  SOCF    : %u\n", flags.content.socf);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  DSG     : %u\n", flags.content.dsg);
 
   // read the current controller status
   ControlStatus ctrl_status;
@@ -139,19 +142,19 @@ Driver::selftest()
   {
     return ST_FAIL_READ_STATUS;
   }
-  chprintf((BaseSequentialStream*) &SD1, "control status: 0x%04X\n", ctrl_status.value);
-  chprintf((BaseSequentialStream*) &SD1, "  FAS       : %u\n", ctrl_status.content.fas);
-  chprintf((BaseSequentialStream*) &SD1, "  SS        : %u\n", ctrl_status.content.ss);
-  chprintf((BaseSequentialStream*) &SD1, "  CSV       : %u\n", ctrl_status.content.csv);
-  chprintf((BaseSequentialStream*) &SD1, "  CSA       : %u\n", ctrl_status.content.cca);
-  chprintf((BaseSequentialStream*) &SD1, "  BCA       : %u\n", ctrl_status.content.bca);
-  chprintf((BaseSequentialStream*) &SD1, "  HIBERNATE : %u\n", ctrl_status.content.hibernate);
-  chprintf((BaseSequentialStream*) &SD1, "  SNOOZE    : %u\n", ctrl_status.content.snooze);
-  chprintf((BaseSequentialStream*) &SD1, "  SLEEP     : %u\n", ctrl_status.content.sleep);
-  chprintf((BaseSequentialStream*) &SD1, "  LDMD      : %u\n", ctrl_status.content.ldmd);
-  chprintf((BaseSequentialStream*) &SD1, "  RUP_DIS   : %u\n", ctrl_status.content.rup_dis);
-  chprintf((BaseSequentialStream*) &SD1, "  VOK       : %u\n", ctrl_status.content.vok);
-  chprintf((BaseSequentialStream*) &SD1, "  QEN       : %u\n", ctrl_status.content.qen);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "control status: 0x%04X\n", ctrl_status.value);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  FAS       : %u\n", ctrl_status.content.fas);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  SS        : %u\n", ctrl_status.content.ss);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  CSV       : %u\n", ctrl_status.content.csv);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  CSA       : %u\n", ctrl_status.content.cca);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  BCA       : %u\n", ctrl_status.content.bca);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  HIBERNATE : %u\n", ctrl_status.content.hibernate);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  SNOOZE    : %u\n", ctrl_status.content.snooze);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  SLEEP     : %u\n", ctrl_status.content.sleep);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  LDMD      : %u\n", ctrl_status.content.ldmd);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  RUP_DIS   : %u\n", ctrl_status.content.rup_dis);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  VOK       : %u\n", ctrl_status.content.vok);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "  QEN       : %u\n", ctrl_status.content.qen);
 
   // if no battery was detected, abort
   if (!flags.content.bat_det)
@@ -160,92 +163,92 @@ Driver::selftest()
   }
 
   // read the BATGD_N pin
-  chprintf((BaseSequentialStream*) &SD1, "battery good: %s\n", (this->isBatteryGood()? "yes" : "no"));
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "battery good: %s\n", (this->isBatteryGood()? "yes" : "no"));
 
   // read temperature
   if (this->stdCommand(STD_CMD_TEMP, val))
   {
     return ST_FAIL_READ_TEMP;
   }
-  chprintf((BaseSequentialStream*) &SD1, "temperature: %fK (%fC)\n", float(val)/10.0f, float(val)/10.0f - 273.15f);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "temperature: %fK (%fC)\n", float(val)/10.0f, float(val)/10.0f - 273.15f);
 
   // read the full available capacity
   if (this->stdCommand(STD_CMD_FAC, val))
   {
     return ST_FAIL_READ_FAC;
   }
-  chprintf((BaseSequentialStream*) &SD1, "full available capacity: %umAh\n", val);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "full available capacity: %umAh\n", val);
 
   // read the full charge capacity
   if (this->stdCommand(STD_CMD_FCC, val))
   {
     return ST_FAIL_READ_FCC;
   }
-  chprintf((BaseSequentialStream*) &SD1, "full charge capacity: %umAh\n", val);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "full charge capacity: %umAh\n", val);
 
   // read the remaining capacity
   if (this->stdCommand(STD_CMD_RM, val))
   {
     return ST_FAIL_READ_RM;
   }
-  chprintf((BaseSequentialStream*) &SD1, "remaining capacity capacity: %umAh\n", val);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "remaining capacity capacity: %umAh\n", val);
 
   // read the state of charge
   if (this->stdCommand(STD_CMD_SOC, val))
   {
     return ST_FAIL_READ_SOC;
   }
-  chprintf((BaseSequentialStream*) &SD1, "state of charge: %3u%%\n", val);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "state of charge: %3u%%\n", val);
 
   // read voltage
   if (this->stdCommand(STD_CMD_VOLT, val))
   {
     return ST_FAIL_READ_VOLT;
   }
-  chprintf((BaseSequentialStream*) &SD1, "voltage: %umV\n", val);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "voltage: %umV\n", val);
 
   // read average current
   if (this->stdCommand(STD_CMD_AI, val))
   {
     return ST_FAIL_READ_AI;
   }
-  chprintf((BaseSequentialStream*) &SD1, "average current: %dmA\n", *reinterpret_cast<int8_t*>(&val));
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "average current: %dmA\n", *reinterpret_cast<int8_t*>(&val));
 
   // read average power
   if (this->stdCommand(STD_CMD_AP, val))
   {
     return ST_FAIL_READ_AP;
   }
-  chprintf((BaseSequentialStream*) &SD1, "average power: %dmW\n", *reinterpret_cast<int8_t*>(&val));
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "average power: %dmW\n", *reinterpret_cast<int8_t*>(&val));
 
   // read the BATLOW pin
-  chprintf((BaseSequentialStream*) &SD1, "battery low: %s\n", (this->isBatteryLow()? "yes" : "no"));
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "battery low: %s\n", (this->isBatteryLow()? "yes" : "no"));
 
   // read the time to empty
   if (this->stdCommand(STD_CMD_TTE, val))
   {
     return ST_FAIL_READ_TTE;
   }
-  chprintf((BaseSequentialStream*) &SD1, "time to empty: ");
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "time to empty: ");
   if (uint16_t(~val)) {
-    chprintf((BaseSequentialStream*) &SD1, "%u minutes", val);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%u minutes", val);
   } else {
-    chprintf((BaseSequentialStream*) &SD1, "(not discharging)");
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "(not discharging)");
   }
-  chprintf((BaseSequentialStream*) &SD1, "\n");
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "\n");
 
   // read the time to full
   if (this->stdCommand(STD_CMD_TTF, val))
   {
     return ST_FAIL_READ_TTF;
   }
-  chprintf((BaseSequentialStream*) &SD1, "time to full: ");
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "time to full: ");
   if (uint16_t(~val)) {
-    chprintf((BaseSequentialStream*) &SD1, "%u minutes", val);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%u minutes", val);
   } else {
-    chprintf((BaseSequentialStream*) &SD1, "(not charging)");
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "(not charging)");
   }
-  chprintf((BaseSequentialStream*) &SD1, "\n");
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "\n");
 
   return ST_OK;
 }
@@ -300,7 +303,7 @@ Driver::stdCommand(const StandardCommand cmd, uint16_t &dst)
     dst = uint16_t((buffer[1] << 8) | buffer[0]);
 #ifndef NDEBUG
   } else {
-    chprintf((BaseSequentialStream*) &SD1, "%s(%d): ERROR: i2c transmit failed (%d)\n", __FILE__ , __LINE__ , res);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): ERROR: i2c transmit failed (%d)\n", __FILE__ , __LINE__ , res);
 #endif
   }
 
@@ -323,7 +326,7 @@ Driver::readName()
 
   buffer[buffer[0] + 1] = '\0';
 
-  chprintf((BaseSequentialStream*) &SD1, "name: %u - %s\n", buffer[0], (char*)&buffer[1]);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "name: %u - %s\n", buffer[0], (char*)&buffer[1]);
 
   return res;
 }
@@ -353,7 +356,7 @@ Driver::subCommand(const ControlSubcommand cmd, uint16_t *dst)
 
 #ifndef NDEBUG
   if (res) {
-    chprintf((BaseSequentialStream*) &SD1, "%s(%d): ERROR: i2c transmit failed (%d)\n", __FILE__ , __LINE__ , res);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): ERROR: i2c transmit failed (%d)\n", __FILE__ , __LINE__ , res);
   }
 #endif
 
@@ -369,19 +372,19 @@ Driver::extCommand(const ExtendedCommand cmd, const ExtendedCommandAccess rw, ui
 {
   if (!buf) {
 #ifndef NDEBUG
-    chprintf((BaseSequentialStream*) &SD1, "%s(%d): ERROR: received NULL-pointer as buffer\n", __FILE__ , __LINE__);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): ERROR: received NULL-pointer as buffer\n", __FILE__ , __LINE__);
 #endif
     return ~RDY_OK;
   }
   if (rw != EXT_CMD_WRITE && rw != EXT_CMD_READ) {
 #ifndef NDEBUG
-    chprintf((BaseSequentialStream*) &SD1, "%s(%d): ERROR: invalid access mode selected\n", __FILE__ , __LINE__);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): ERROR: invalid access mode selected\n", __FILE__ , __LINE__);
 #endif
     return ~RDY_OK;
   }
   if (length > 33) {
 #ifndef NDEBUG
-    chprintf((BaseSequentialStream*) &SD1, "%s(%d): ERROR: length exceeds maximum of 33 bytes\n", __FILE__ , __LINE__);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): ERROR: length exceeds maximum of 33 bytes\n", __FILE__ , __LINE__);
 #endif
     return ~RDY_OK;
   }
@@ -402,7 +405,7 @@ Driver::extCommand(const ExtendedCommand cmd, const ExtendedCommandAccess rw, ui
 
 #ifndef NDEBUG
   if (res) {
-    chprintf((BaseSequentialStream*) &SD1, "%s(%d): ERROR: i2c transmit failed (%d)\n", __FILE__ , __LINE__ , res);
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): ERROR: i2c transmit failed (%d)\n", __FILE__ , __LINE__ , res);
   }
 #endif
 
diff --git a/components/power/ina219.cpp b/components/power/ina219.cpp
index d1d3121..6341f1e 100644
--- a/components/power/ina219.cpp
+++ b/components/power/ina219.cpp
@@ -2,11 +2,14 @@
 
 #include <ch.hpp>
 #include <chprintf.h>
+#include <global.hpp>
 
 using namespace chibios_rt;
 using namespace amiro;
 using namespace INA219;
 
+extern Global global;
+
 Driver::Driver(I2CDriver &i2c_driver, const uint8_t i2c_address) :
   BaseSensor<InitData,CalibData>(), i2c_driver(&i2c_driver), tx_params({i2c_address, NULL, 0, NULL, 0}), current_lsb_uA(0)
 {
@@ -225,10 +228,10 @@ Driver::selftest()
     bus_voltage = this->readBusVoltage();
     this->readRegister(REG_POWER, power);
   }
-  chprintf((BaseSequentialStream*) &SD1, "shunt voltage : %fV\n", this->readShuntVoltage_uV() / 1000000.f);
-  chprintf((BaseSequentialStream*) &SD1, "bus voltage   : %fV\n", bus_voltage.voltage_uV / 1000000.f);
-  chprintf((BaseSequentialStream*) &SD1, "power         : %fW\n", this->readPower_uW() / 1000000.f);
-  chprintf((BaseSequentialStream*) &SD1, "current       : %fA\n", this->readCurrent_uA() / 1000000.f);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "shunt voltage : %fV\n", this->readShuntVoltage_uV() / 1000000.f);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "bus voltage   : %fV\n", bus_voltage.voltage_uV / 1000000.f);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "power         : %fW\n", this->readPower_uW() / 1000000.f);
+  chprintf((BaseSequentialStream*) &global.sercanmux1, "current       : %fA\n", this->readCurrent_uA() / 1000000.f);
 
   return ST_OK;
 }
@@ -343,7 +346,7 @@ Driver::readRegister(const RegisterAddress reg, uint16_t& dst)
       dst &= MASK_CALIBRATION;
 #ifndef NDEBUG
   } else {
-    chprintf((BaseSequentialStream*) &SD1, "%s(%d): ERROR: i2c transmit failed (%d | 0x%08X)\n", __FILE__ , __LINE__ , res, this->i2c_driver->getErrors());
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): ERROR: i2c transmit failed (%d | 0x%08X)\n", __FILE__ , __LINE__ , res, this->i2c_driver->getErrors());
 #endif
   }
 
@@ -366,7 +369,7 @@ Driver::writeRegister(const RegisterAddress reg, const uint16_t& val)
 
 #ifndef NDEBUG
   if (res) {
-    chprintf((BaseSequentialStream*) &SD1, "%s(%d): ERROR: i2c transmit failed (%d | 0x%08X)\n", __FILE__ , __LINE__ , res, this->i2c_driver->getErrors());
+    chprintf((BaseSequentialStream*) &global.sercanmux1, "%s(%d): ERROR: i2c transmit failed (%d | 0x%08X)\n", __FILE__ , __LINE__ , res, this->i2c_driver->getErrors());
   }
 #endif
 
