Index: trunk/firmware/App/CubeMX/Appli/Core/Inc/FreeRTOSConfig.h
===================================================================
--- trunk/firmware/App/CubeMX/Appli/Core/Inc/FreeRTOSConfig.h	(revision 34)
+++ trunk/firmware/App/CubeMX/Appli/Core/Inc/FreeRTOSConfig.h	(revision 36)
@@ -52,5 +52,4 @@
 #include <stdint.h>
 extern uint32_t SystemCoreClock;
-void xPortSysTickHandler(void);
 #endif
 #ifndef CMSIS_device_header
Index: trunk/firmware/App/CubeMX/Appli/Core/Inc/app_freertos.h
===================================================================
--- trunk/firmware/App/CubeMX/Appli/Core/Inc/app_freertos.h	(revision 34)
+++ trunk/firmware/App/CubeMX/Appli/Core/Inc/app_freertos.h	(revision 36)
@@ -57,4 +57,5 @@
 extern osThreadId_t mainTaskHandle;
 extern osThreadId_t sdmmcTaskHandle;
+extern osMessageQueueId_t sdmmcCmdQueueHandle;
 
 /* Exported function prototypes -----------------------------------------------*/
Index: trunk/firmware/App/CubeMX/Appli/Core/Inc/stm32n6xx_hal_conf.h
===================================================================
--- trunk/firmware/App/CubeMX/Appli/Core/Inc/stm32n6xx_hal_conf.h	(revision 34)
+++ trunk/firmware/App/CubeMX/Appli/Core/Inc/stm32n6xx_hal_conf.h	(revision 36)
@@ -80,5 +80,5 @@
 /*#define HAL_SPI_MODULE_ENABLED   */
 /*#define HAL_SRAM_MODULE_ENABLED   */
-/*#define HAL_TIM_MODULE_ENABLED   */
+#define HAL_TIM_MODULE_ENABLED
 /*#define HAL_UART_MODULE_ENABLED   */
 /*#define HAL_USART_MODULE_ENABLED   */
@@ -163,5 +163,5 @@
   */
 #define  VDD_VALUE                  3300UL /*!< Value of VDD in mv */
-#define  TICK_INT_PRIORITY          0U  /*!< tick interrupt priority */
+#define  TICK_INT_PRIORITY          15U  /*!< tick interrupt priority (lowest by default) */
 #define  USE_RTOS                   0U
 
Index: trunk/firmware/App/CubeMX/Appli/Core/Inc/stm32n6xx_it.h
===================================================================
--- trunk/firmware/App/CubeMX/Appli/Core/Inc/stm32n6xx_it.h	(revision 34)
+++ trunk/firmware/App/CubeMX/Appli/Core/Inc/stm32n6xx_it.h	(revision 36)
@@ -54,4 +54,5 @@
 void SecureFault_Handler(void);
 void DebugMon_Handler(void);
+void TIM18_IRQHandler(void);
 void SDMMC2_IRQHandler(void);
 /* USER CODE BEGIN EFP */
Index: trunk/firmware/App/CubeMX/Appli/Core/Src/app_freertos.c
===================================================================
--- trunk/firmware/App/CubeMX/Appli/Core/Src/app_freertos.c	(revision 34)
+++ trunk/firmware/App/CubeMX/Appli/Core/Src/app_freertos.c	(revision 36)
@@ -24,8 +24,11 @@
 /* USER CODE BEGIN Includes */
 
+#include "sdmmcTask.h"
+
 /* USER CODE END Includes */
 
 /* Private typedef -----------------------------------------------------------*/
 typedef StaticTask_t osStaticThreadDef_t;
+typedef StaticQueue_t osStaticMessageQDef_t;
 /* USER CODE BEGIN PTD */
 
@@ -60,5 +63,5 @@
 /* Definitions for sdmmcTask */
 osThreadId_t sdmmcTaskHandle;
-uint32_t sdmmcTaskBuff[ 128 ];
+uint32_t sdmmcTaskBuff[ 1024 ];
 osStaticThreadDef_t sdmmcTaskCtrlBlock;
 const osThreadAttr_t sdmmcTask_attributes = {
@@ -69,4 +72,15 @@
   .cb_size = sizeof(sdmmcTaskCtrlBlock),
   .priority = (osPriority_t) osPriorityBelowNormal7,
+};
+/* Definitions for sdmmcCmdQueue */
+osMessageQueueId_t sdmmcCmdQueueHandle;
+uint8_t sdmmcQueueBuff[ 8 * sizeof( SdCardCmd_t ) ];
+osStaticMessageQDef_t sdmmcQueueCtrlBlock;
+const osMessageQueueAttr_t sdmmcCmdQueue_attributes = {
+  .name = "sdmmcCmdQueue",
+  .cb_mem = &sdmmcQueueCtrlBlock,
+  .cb_size = sizeof(sdmmcQueueCtrlBlock),
+  .mq_mem = &sdmmcQueueBuff,
+  .mq_size = sizeof(sdmmcQueueBuff)
 };
 
@@ -121,4 +135,6 @@
   /* start timers, add new ones, ... */
   /* USER CODE END RTOS_TIMERS */
+  /* creation of sdmmcCmdQueue */
+  sdmmcCmdQueueHandle = osMessageQueueNew (8, sizeof(SdCardCmd_t), &sdmmcCmdQueue_attributes);
 
   /* USER CODE BEGIN RTOS_QUEUES */
Index: trunk/firmware/App/CubeMX/Appli/Core/Src/main.c
===================================================================
--- trunk/firmware/App/CubeMX/Appli/Core/Src/main.c	(revision 34)
+++ trunk/firmware/App/CubeMX/Appli/Core/Src/main.c	(revision 36)
@@ -82,8 +82,8 @@
   /* USER CODE BEGIN 1 */
 
-  SEGGER_RTT_Init();
+  //SEGGER_RTT_Init();
 
   /* System clock already configured, simply SystemCoreClock init */
-  SystemCoreClockUpdate();
+  //SystemCoreClockUpdate();
 
   /* USER CODE END 1 */
@@ -161,6 +161,7 @@
   RIMC_MasterConfig_t RIMC_master = {0};
   RIMC_master.MasterCID = RIF_CID_1;
-  RIMC_master.SecPriv = RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_NPRIV;
+  RIMC_master.SecPriv = RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV;
   HAL_RIF_RIMC_ConfigMasterAttributes(RIF_MASTER_INDEX_SDMMC2, &RIMC_master);
+  HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_SDMMC2 , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
 
   /* RIF-Aware IPs Config */
@@ -168,8 +169,8 @@
   /* set up GPIO configuration */
   HAL_GPIO_ConfigPinAttributes(GPIOC,GPIO_PIN_0,GPIO_PIN_SEC|GPIO_PIN_NPRIV);
+  HAL_GPIO_ConfigPinAttributes(GPIOC,GPIO_PIN_2,GPIO_PIN_SEC|GPIO_PIN_NPRIV);
   HAL_GPIO_ConfigPinAttributes(GPIOC,GPIO_PIN_3,GPIO_PIN_SEC|GPIO_PIN_NPRIV);
   HAL_GPIO_ConfigPinAttributes(GPIOC,GPIO_PIN_4,GPIO_PIN_SEC|GPIO_PIN_NPRIV);
   HAL_GPIO_ConfigPinAttributes(GPIOC,GPIO_PIN_5,GPIO_PIN_SEC|GPIO_PIN_NPRIV);
-  HAL_GPIO_ConfigPinAttributes(GPIOD,GPIO_PIN_2,GPIO_PIN_SEC|GPIO_PIN_NPRIV);
   HAL_GPIO_ConfigPinAttributes(GPIOE,GPIO_PIN_4,GPIO_PIN_SEC|GPIO_PIN_NPRIV);
   HAL_GPIO_ConfigPinAttributes(GPION,GPIO_PIN_12,GPIO_PIN_SEC|GPIO_PIN_NPRIV);
@@ -236,4 +237,26 @@
 
 /**
+  * @brief  Period elapsed callback in non blocking mode
+  * @note   This function is called  when TIM18 interrupt took place, inside
+  * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
+  * a global variable "uwTick" used as application time base.
+  * @param  htim : TIM handle
+  * @retval None
+  */
+void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
+{
+  /* USER CODE BEGIN Callback 0 */
+
+  /* USER CODE END Callback 0 */
+  if (htim->Instance == TIM18)
+  {
+    HAL_IncTick();
+  }
+  /* USER CODE BEGIN Callback 1 */
+
+  /* USER CODE END Callback 1 */
+}
+
+/**
   * @brief  This function is executed in case of error occurrence.
   * @param None
@@ -244,7 +267,9 @@
   /* USER CODE BEGIN Error_Handler_Debug */
   /* User can add his own implementation to report the HAL error return state */
-  __disable_irq();
+  //__disable_irq();
   while (1)
   {
+	  printf("Unknown error!\n");
+	  HAL_Delay(1000U);
   }
   /* USER CODE END Error_Handler_Debug */
Index: trunk/firmware/App/CubeMX/Appli/Core/Src/sdmmc.c
===================================================================
--- trunk/firmware/App/CubeMX/Appli/Core/Src/sdmmc.c	(revision 34)
+++ trunk/firmware/App/CubeMX/Appli/Core/Src/sdmmc.c	(revision 36)
@@ -42,7 +42,7 @@
   hsd2.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
   hsd2.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
-  hsd2.Init.BusWide = SDMMC_BUS_WIDE_4B;
+  hsd2.Init.BusWide = SDMMC_BUS_WIDE_1B;
   hsd2.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
-  hsd2.Init.ClockDiv = 0;
+  hsd2.Init.ClockDiv = 2;
   if (HAL_SD_Init(&hsd2) != HAL_OK)
   {
@@ -89,22 +89,22 @@
     PC3     ------> SDMMC2_CMD
     */
-    GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_0|GPIO_PIN_3;
+    GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5;
     GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
+    GPIO_InitStruct.Pull = GPIO_PULLUP;
+    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
     GPIO_InitStruct.Alternate = GPIO_AF11_SDMMC2;
     HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
-    GPIO_InitStruct.Pin = GPIO_PIN_2;
+    /*GPIO_InitStruct.Pin = GPIO_PIN_2;
     GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
     GPIO_InitStruct.Pull = GPIO_NOPULL;
     GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
     GPIO_InitStruct.Alternate = GPIO_AF11_SDMMC2;
-    HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+    HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);*/
 
     GPIO_InitStruct.Pin = GPIO_PIN_4;
     GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
+    GPIO_InitStruct.Pull = GPIO_PULLUP;
+    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
     GPIO_InitStruct.Alternate = GPIO_AF11_SDMMC2;
     HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
Index: trunk/firmware/App/CubeMX/Appli/Core/Src/stm32n6xx_hal_timebase_tim.c
===================================================================
--- trunk/firmware/App/CubeMX/Appli/Core/Src/stm32n6xx_hal_timebase_tim.c	(revision 36)
+++ trunk/firmware/App/CubeMX/Appli/Core/Src/stm32n6xx_hal_timebase_tim.c	(revision 36)
@@ -0,0 +1,116 @@
+/* USER CODE BEGIN Header */
+/**
+  ******************************************************************************
+  * @file    stm32n6xx_hal_timebase_tim.c
+  * @brief   HAL time base based on the hardware TIM.
+  ******************************************************************************
+  * @attention
+  *
+  * Copyright (c) 2026 STMicroelectronics.
+  * All rights reserved.
+  *
+  * This software is licensed under terms that can be found in the LICENSE file
+  * in the root directory of this software component.
+  * If no LICENSE file comes with this software, it is provided AS-IS.
+  *
+  ******************************************************************************
+  */
+/* USER CODE END Header */
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32n6xx_hal.h"
+#include "stm32n6xx_hal_tim.h"
+
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+/* Private macro -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+TIM_HandleTypeDef        htim18;
+/* Private function prototypes -----------------------------------------------*/
+/* Private functions ---------------------------------------------------------*/
+
+/**
+  * @brief  This function configures the TIM18 as a time base source.
+  *         The time source is configured  to have 1ms time base with a dedicated
+  *         Tick interrupt priority.
+  * @note   This function is called  automatically at the beginning of program after
+  *         reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig().
+  * @param  TickPriority: Tick interrupt priority.
+  * @retval HAL status
+  */
+HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
+{
+  RCC_ClkInitTypeDef    clkconfig;
+  uint32_t              uwTimclock;
+  uint32_t              uwPrescalerValue;
+
+  /*Configure the TIM18 IRQ priority */
+  HAL_NVIC_SetPriority(TIM18_IRQn, TickPriority ,0);
+  /* Enable the TIM18 global Interrupt */
+  HAL_NVIC_EnableIRQ(TIM18_IRQn);
+
+  /* Enable TIM18 clock */
+  __HAL_RCC_TIM18_CLK_ENABLE();
+
+  /* Compute TIM18 clock */
+  uwTimclock = HAL_RCCEx_GetTIMGFreq();
+
+  /* Get clock configuration */
+  HAL_RCC_GetClockConfig(&clkconfig);
+
+  /* Compute the prescaler value to have TIM18 counter clock equal to 1MHz */
+  uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000U) - 1U);
+
+  /* Initialize TIM18 */
+  htim18.Instance = TIM18;
+
+  /* Initialize TIMx peripheral as follow:
+   * Period = [(TIM18CLK/1000) - 1]. to have a (1/1000) s time base.
+   * Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock.
+   * ClockDivision = 0
+   * Counter direction = Up
+   */
+  htim18.Init.Period = (1000000U / 1000U) - 1U;
+  htim18.Init.Prescaler = uwPrescalerValue;
+  htim18.Init.ClockDivision = 0;
+  htim18.Init.CounterMode = TIM_COUNTERMODE_UP;
+
+  if(HAL_TIM_Base_Init(&htim18) == HAL_OK)
+  {
+#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1U)
+      /* Register callback */
+      HAL_TIM_RegisterCallback(&htim18, HAL_TIM_PERIOD_ELAPSED_CB_ID, TimeBase_TIM_PeriodElapsedCallback);
+#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
+
+    /* Start the TIM time Base generation in interrupt mode */
+    return HAL_TIM_Base_Start_IT(&htim18);
+  }
+
+  /* Return function status */
+  return HAL_ERROR;
+}
+
+/**
+  * @brief  Suspend Tick increment.
+  * @note   Disable the tick increment by disabling TIM18 update interrupt.
+  * @param  None
+  * @retval None
+  */
+void HAL_SuspendTick(void)
+{
+  /* Disable TIM18 update Interrupt */
+  __HAL_TIM_DISABLE_IT(&htim18, TIM_IT_UPDATE);
+}
+
+/**
+  * @brief  Resume Tick increment.
+  * @note   Enable the tick increment by Enabling TIM18 update interrupt.
+  * @param  None
+  * @retval None
+  */
+void HAL_ResumeTick(void)
+{
+  /* Enable TIM18 Update interrupt */
+  __HAL_TIM_ENABLE_IT(&htim18, TIM_IT_UPDATE);
+}
+
Index: trunk/firmware/App/CubeMX/Appli/Core/Src/stm32n6xx_it.c
===================================================================
--- trunk/firmware/App/CubeMX/Appli/Core/Src/stm32n6xx_it.c	(revision 34)
+++ trunk/firmware/App/CubeMX/Appli/Core/Src/stm32n6xx_it.c	(revision 36)
@@ -23,4 +23,7 @@
 /* Private includes ----------------------------------------------------------*/
 /* USER CODE BEGIN Includes */
+
+#include <stdio.h>
+
 /* USER CODE END Includes */
 
@@ -57,4 +60,6 @@
 /* External variables --------------------------------------------------------*/
 extern SD_HandleTypeDef hsd2;
+extern TIM_HandleTypeDef htim18;
+
 /* USER CODE BEGIN EV */
 
@@ -85,4 +90,16 @@
 {
   /* USER CODE BEGIN HardFault_IRQn 0 */
+
+	uint32_t cfsr  = SCB->CFSR;
+    uint32_t hfsr  = SCB->HFSR;
+    uint32_t dfsr  = SCB->DFSR;
+    uint32_t mmfar = SCB->MMFAR;
+    uint32_t bfar  = SCB->BFAR;
+
+    printf("CFSR  = 0x%08lX\r\n", (unsigned long)cfsr);
+    printf("HFSR  = 0x%08lX\r\n", (unsigned long)hfsr);
+    printf("DFSR  = 0x%08lX\r\n", (unsigned long)dfsr);
+    printf("MMFAR = 0x%08lX\r\n", (unsigned long)mmfar);
+    printf("BFAR  = 0x%08lX\r\n", (unsigned long)bfar);
 
   /* USER CODE END HardFault_IRQn 0 */
@@ -175,4 +192,18 @@
 
 /**
+  * @brief This function handles TIM18 global interrupt.
+  */
+void TIM18_IRQHandler(void)
+{
+  /* USER CODE BEGIN TIM18_IRQn 0 */
+
+  /* USER CODE END TIM18_IRQn 0 */
+  HAL_TIM_IRQHandler(&htim18);
+  /* USER CODE BEGIN TIM18_IRQn 1 */
+
+  /* USER CODE END TIM18_IRQn 1 */
+}
+
+/**
   * @brief This function handles SDMMC2 global interrupt.
   */
