commit fc7151bbed55fc4b7fa1f3becb10ba4a75bc21db
Author: Thomas Schöpping <tschoepp@cit-ec.uni-bielefeld.de>
Date:   Thu Mar 14 14:32:41 2019 +0100

    Introduced new LightRing v1.2 module.
    Version number has been rolled back to 1.1.3, since no new functionality has been introduced with the latest commits, but just new modules and some fixes.

diff --git a/Target/Modules/LightRing_1-0/Boot/main.c b/Target/Modules/LightRing_1-0/Boot/main.c
index 76ac105..c7fde28 100644
--- a/Target/Modules/LightRing_1-0/Boot/main.c
+++ b/Target/Modules/LightRing_1-0/Boot/main.c
@@ -46,7 +46,7 @@
 ****************************************************************************************/
 
 /****************************************************************************************
-* Function prototypes
+* Function prototypes and static variables
 ****************************************************************************************/
 static void Init(void);
 
@@ -75,7 +75,7 @@ void blCallbackHandleShutdownRequest(void);
 
 const blCallbackTable_t cbtable __attribute__ ((section ("_callback_table"))) = {
   .magicNumber = BL_MAGIC_NUMBER,
-  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Beta, BL_VERSION_MAJOR, BL_VERSION_MINOR, 0},
+  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Beta, BL_VERSION_MAJOR, BL_VERSION_MINOR, 3},
   .vSSSP = {BL_VERSION_ID_SSSP, BL_SSSP_VERSION_MAJOR, BL_SSSP_VERSION_MINOR, 0},
   .vCompiler = {BL_VERSION_ID_GCC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__},  // currently only GCC is supported
   .cbShutdownHibernate = blCallbackShutdownHibernate,
@@ -257,6 +257,7 @@ static void Init(void)
   /* enable clocks for CAN controller peripheral */
   RCC->APB1ENR |= (blt_int32u)0x02000000;
 #endif
+
 #if (BOOT_COM_UART_ENABLE > 0 || BOOT_GATE_UART_ENABLE > 0)
   /* enable clocks for USART1 peripheral, transmitter and receiver pins (GPIOA and AFIO) */
   RCC->APB2ENR |= (blt_int32u)(0x00004000 | 0x00000004 | 0x00000001);
@@ -344,6 +345,13 @@ static void initGpio() {
   gpio_init.GPIO_Speed  = GPIO_Speed_50MHz;
   GPIO_Init(SYS_SYNC_N_GPIO, &gpio_init);
 
+  /* initialize SYS_UART_DN and let it go (inactive) */
+  GPIO_SetBits(SYS_UART_DN_GPIO, SYS_UART_DN_PIN);
+  gpio_init.GPIO_Pin    = SYS_UART_DN_PIN;
+  gpio_init.GPIO_Mode   = GPIO_Mode_Out_OD;
+  gpio_init.GPIO_Speed  = GPIO_Speed_50MHz;
+  GPIO_Init(SYS_UART_DN_GPIO, &gpio_init);
+
   /*
    * INPUTS
    */
@@ -416,7 +424,7 @@ void shutdownToTransportation(const blt_bool exec_disambiguation) {
 
   /* wait for all boards to be ready for shutdown */
   GPIO_SetBits(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN);
-  // this must no be skipped, since the pull-up voltage for SYS_SYNC_N (VIO3.3) must be configured at this point by definition.
+  // this must not be skipped, since the pull-up voltage for SYS_SYNC_N (VIO3.3) must be configured at this point by definition.
   setLed(BLT_TRUE);
   waitForSignal(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN, Bit_SET);
   setLed(BLT_FALSE);
@@ -448,7 +456,7 @@ void shutdownToDeepsleep(const blt_bool exec_disambiguation) {
 
   /* wait for all boards to be ready for shutdown */
   GPIO_SetBits(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN);
-  // this must no be skipped, since the pull-up voltage for SYS_SYNC_N (VIO3.3) must be configured at this point by definition.
+  // this must not be skipped, since the pull-up voltage for SYS_SYNC_N (VIO3.3) must be configured at this point by definition.
   setLed(BLT_TRUE);
   waitForSignal(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN, Bit_SET);
   setLed(BLT_FALSE);
@@ -480,7 +488,7 @@ void shutdownToHibernate(const blt_bool exec_disambiguation) {
 
   /* wait for all boards to be ready for shutdown */
   GPIO_SetBits(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN);
-  // this must no be skipped, since the pull-up voltage for SYS_SYNC_N (VIO3.3) must be configured at this point by definition.
+  // this must not be skipped, since the pull-up voltage for SYS_SYNC_N (VIO3.3) must be configured at this point by definition.
   setLed(BLT_TRUE);
   waitForSignal(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN, Bit_SET);
   setLed(BLT_FALSE);
@@ -502,6 +510,9 @@ void shutdownToHibernate(const blt_bool exec_disambiguation) {
   return;
 } /*** end of shutdownToHibernate ***/
 
+/*
+ * Final shutdown of the system and restart.
+ */
 void shutdownAndRestart(const blt_bool exec_disambiguation) {
   /* configure some criticpal GPIOs as input
    * This is required, because otherwise some hardware might be powered through these signals */
@@ -509,7 +520,7 @@ void shutdownAndRestart(const blt_bool exec_disambiguation) {
 
   /* wait for all boards to be ready for shutdown */
   GPIO_SetBits(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN);
-  // this must no be skipped, since the pull-up voltage for SYS_SYNC_N (VIO3.3) must be configured at this point by definition.
+  // this must not be skipped, since the pull-up voltage for SYS_SYNC_N (VIO3.3) must be configured at this point by definition.
   setLed(BLT_TRUE);
   waitForSignal(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN, Bit_SET);
   setLed(BLT_FALSE);
@@ -533,7 +544,7 @@ void shutdownAndRestart(const blt_bool exec_disambiguation) {
    */
 
   return;
-} /*** end of shutdownAndRestart***/
+} /*** end of shutdownAndRestart ***/
 
 /*
  * Configures some GPIO pins as inputs for safety reasons.
@@ -602,7 +613,7 @@ ErrorStatus handleWarmReset() {
 //      setLed(BLT_FALSE);
 //    } else if (currentTime < loopStartTime + 50+100+50) {
 //      setLed(BLT_TRUE);
-//    } else if ( currentTime < loopStartTime + 50+100+50+300) {
+//    } else if (currentTime < loopStartTime + 50+100+50+300) {
 //      setLed(BLT_FALSE);
 //    } else {
 //      loopStartTime = currentTime;
@@ -636,6 +647,7 @@ void blCallbackShutdownTransportation() {
   GPIO_ResetBits(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN);
   GPIO_ResetBits(SYS_PD_N_GPIO, SYS_PD_N_PIN);
 
+  /* initialized the standalone timer */
   saTimerInit();
 
   setLed(BLT_TRUE);
@@ -659,6 +671,7 @@ void blCallbackShutdownDeepsleep(void) {
   GPIO_ResetBits(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN);
   GPIO_ResetBits(SYS_PD_N_GPIO, SYS_PD_N_PIN);
 
+  /* initialized the standalone timer */
   saTimerInit();
 
   setLed(BLT_TRUE);
@@ -681,6 +694,7 @@ void blCallbackShutdownHibernate(void) {
   GPIO_ResetBits(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN);
   GPIO_ResetBits(SYS_PD_N_GPIO, SYS_PD_N_PIN);
 
+  /* initialized the standalone timer */
   saTimerInit();
 
   setLed(BLT_TRUE);
@@ -703,8 +717,12 @@ void blCallbackShutdownRestart(void) {
   GPIO_ResetBits(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN);
   GPIO_ResetBits(SYS_PD_N_GPIO, SYS_PD_N_PIN);
 
-  /* ensure that all modules had a chance to detect the pulse on SYS_PD_N */
+  /* initialized the standalone timer */
   saTimerInit();
+
+  setLed(BLT_TRUE);
+
+  /* deactivate SYS_PD_N and ensure that all modules had a chance to detect the falling edge */
   msleep(1);
   GPIO_SetBits(SYS_PD_N_GPIO, SYS_PD_N_PIN);
   msleep(1);
@@ -712,7 +730,7 @@ void blCallbackShutdownRestart(void) {
   shutdownAndRestart(BLT_TRUE);
 
   return;
-} /** end of blCallbackShutdownRestart ***/
+} /*** end of blCallbackShutdownRestart ***/
 
 /*
  * Callback function that handles a system shutdown/restart request from another module.
@@ -728,8 +746,12 @@ void blCallbackHandleShutdownRequest(void) {
   GPIO_ResetBits(SYS_SYNC_N_GPIO, SYS_SYNC_N_PIN);
   GPIO_ResetBits(SYS_PD_N_GPIO, SYS_PD_N_PIN);
 
-  /* ensure that all modules had a chance to detect the pulse on SYS_PD_N */
+  /* initialized the standalone timer */
   saTimerInit();
+
+  setLed(BLT_TRUE);
+
+  /* deactivate SYS_PD_N and ensure that all modules had a chance to detect the falling edge */
   msleep(1);
   GPIO_SetBits(SYS_PD_N_GPIO, SYS_PD_N_PIN);
   msleep(1);
