Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

unable to initialize to micro SD card using custom board

Chevalier_nRF52840_schema_v0.pdf

Hello all,

I have some troubles to initialize the micro SD card with my custom board.

I have used the nRF 52 DK to write a basic code and do some test. For micro card SD with the nRF 52 DK I have used this micro card SD reader

Here you can find the basic code. With my custom board the code can not do the initialization function. As the result disk_state = disk_initialize(0); is always true.

#include "nrf_drv_spi.h"
#include "app_util_platform.h"
#include "nrf_gpio.h"
#include "nrf_delay.h"
#include "boards.h"
#include "app_error.h"
#include <string.h>
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include "SEGGER_RTT.h"

#include "nrf.h"
#include "bsp.h"
#include "ff.h"
#include "diskio_blkdev.h"
#include "nrf_block_dev_sdc.h"
#include "app_sdcard.h"

#define SPI_INSTANCE  1 /**< SPI instance index. */
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); /**< SPI instance. */


#define FILE_NAME   "NORDIC.TXT"
#define TEST_STRING "SD card example."

#define SDC_SCK_PIN     42  ///< SDC serial clock (SCK) pin.
#define SDC_MOSI_PIN    36  ///< SDC serial data in (DI) pin.
#define SDC_MISO_PIN    45  ///< SDC serial data out (DO) pin.
#define SDC_CS_PIN      34  ///< SDC chip select (CS) pin. p1.02

/**
 * @brief  SDC block device definition
 * */
NRF_BLOCK_DEV_SDC_DEFINE(
        m_block_dev_sdc,
        NRF_BLOCK_DEV_SDC_CONFIG(
                SDC_SECTOR_SIZE,
                APP_SDCARD_CONFIG(SDC_MOSI_PIN, SDC_MISO_PIN, SDC_SCK_PIN, SDC_CS_PIN)
         ),
         NFR_BLOCK_DEV_INFO_CONFIG("PerfectStride", "SDC", "1.00")
);

/**
 * @brief Function for demonstrating FAFTS usage.
 */
void fatfs_example()
{
    static FATFS fs;
    static DIR dir;
    static FILINFO fno;
    static FIL file;

    uint32_t bytes_written;
    FRESULT ff_result;
    DSTATUS disk_state = STA_NOINIT;

    // Initialize FATFS disk I/O interface by providing the block device.
    static diskio_blkdev_t drives[] =
    {
            DISKIO_BLOCKDEV_CONFIG(NRF_BLOCKDEV_BASE_ADDR(m_block_dev_sdc, block_dev), NULL)
    };

    diskio_blockdev_register(drives, ARRAY_SIZE(drives));

    SEGGER_RTT_printf(0,"Initializing disk 0 (SDC)...");
    for (uint32_t retries = 3; retries && disk_state; --retries)
    {
        disk_state = disk_initialize(0);
    }
    if (disk_state)
    {
        SEGGER_RTT_printf(0,"Disk initialization failed.\n");
        return;
    }

    uint32_t blocks_per_mb = (1024uL * 1024uL) / m_block_dev_sdc.block_dev.p_ops->geometry(&m_block_dev_sdc.block_dev)->blk_size;
    uint32_t capacity = m_block_dev_sdc.block_dev.p_ops->geometry(&m_block_dev_sdc.block_dev)->blk_count / blocks_per_mb;
    SEGGER_RTT_printf(0,"Capacity: %d MB", capacity);

    SEGGER_RTT_printf(0,"Mounting volume...");
    ff_result = f_mount(&fs, "", 1);
    if (ff_result)
    {
        SEGGER_RTT_printf(0,"Mount failed.");
        return;
    }

    SEGGER_RTT_printf(0,"\r\n Listing directory: /");
    ff_result = f_opendir(&dir, "/");
    if (ff_result)
    {
        SEGGER_RTT_printf(0,"Directory listing failed!");
        return;
    }

//    ff_result = f_unlink(FILE_NAME); //LC: delete nordic file if exist before starting
    do
    {
        ff_result = f_readdir(&dir, &fno);
        if (ff_result != FR_OK)
        {
            SEGGER_RTT_printf(0,"Directory read failed.");
            return;
        }
        nrf_delay_ms(1000);
        if (fno.fname[0])
        {
            if (fno.fattrib & AM_DIR)
            {
                SEGGER_RTT_printf(0,"\n   <DIR>   %s",(uint32_t)fno.fname);
            }
            else
            {
                SEGGER_RTT_printf(0,"%9lu  %s", fno.fsize, (uint32_t)fno.fname);
            }
        }
    }
    while (fno.fname[0]);

    nrf_delay_ms(2000);
    SEGGER_RTT_printf(0,"\n \n");
    SEGGER_RTT_printf(0,"Writing to file %s ...   ", FILE_NAME);

    ff_result = f_open(&file, FILE_NAME, FA_READ | FA_WRITE | FA_OPEN_APPEND);
    if (ff_result != FR_OK)
    {
        SEGGER_RTT_printf(0,"Unable to open or create file: " FILE_NAME ".");
        return;
    }

    ff_result = f_write(&file, TEST_STRING, sizeof(TEST_STRING) - 1, (UINT *) &bytes_written);

    if (ff_result != FR_OK)
    {
        SEGGER_RTT_printf(0,"Write failed\r\n.");
    }
    else
    {
        SEGGER_RTT_printf(0,"%d bytes written.\n", bytes_written);
    }
SEGGER_RTT_printf(0,"before file close !");
    (void) f_close(&file);SEGGER_RTT_printf(0,"before out !");
    return;
}


void init_pins()
{
    SEGGER_RTT_printf(0, "\n \n-------- Fatfs CONFIG -------- \n");

    SEGGER_RTT_printf(0, "SDC_SCK_PIN   :\t %d \n", SDC_SCK_PIN);
    SEGGER_RTT_printf(0, "SDC_MOSI_PIN  :\t %d \n", SDC_MOSI_PIN);
    SEGGER_RTT_printf(0, "SDC_MISO_PIN  :\t %d \n", SDC_MISO_PIN);
    SEGGER_RTT_printf(0, "SDC_CS_PIN    :\t %d \n", SDC_CS_PIN);
    return;
}

void begin_message()
{
    SEGGER_RTT_printf(0, "\n\n\n \n\n\n -------------------------------------------------------- \n");
    SEGGER_RTT_printf(0, " Begin Perfect Stride program to read value from BMI160 sensor \n");
    SEGGER_RTT_printf(0, "\t linked with BMM150 sensor \n \n");
    return;
}



int main(void)
{
    begin_message();
    bsp_board_leds_init();

    init_pins();

    //LC ---- test
    fatfs_example();

    while (1)
    {
        bsp_board_led_invert(BSP_BOARD_LED_0);
        nrf_delay_ms(200);
    }
    //LC ---- end test
}

The file to configure the custom board is this one :

#include "boards.h"


#ifndef BOARD_CUSTOM_H
#define BOARD_CUSTOM_H

#ifdef __cplusplus
extern "C" {
#endif

#define LEDS_NUMBER    4

#define LED_1          NRF_GPIO_PIN_MAP(1,6)

#define LEDS_ACTIVE_STATE 0

#define LEDS_LIST { LED_1}

#define LEDS_INV_MASK  LEDS_MASK

#define BSP_LED_0      13
#define BSP_LED_1      14
#define BSP_LED_2      15
#define BSP_LED_3      16

#define BUTTONS_NUMBER 4

#define BUTTON_1       11
#define BUTTON_2       12
#define BUTTON_3       24
#define BUTTON_4       25
#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP

#define BUTTONS_ACTIVE_STATE 0

#define BUTTONS_LIST { BUTTON_1, BUTTON_2, BUTTON_3, BUTTON_4 }

#define BSP_BUTTON_0   BUTTON_1
#define BSP_BUTTON_1   BUTTON_2
#define BSP_BUTTON_2   BUTTON_3
#define BSP_BUTTON_3   BUTTON_4

// LEDs definitions
//#define LEDS_NUMBER    1

//#define LED_1          38

//#define LEDS_ACTIVE_STATE 0

//#define LEDS_LIST { LED_1}

//#define BSP_LED_0      LED_1

//#define LEDS_INV_MASK  0

//#define BUTTONS_LIST {  }

//#define BSP_BUTTON_0


#define RX_PIN_NUMBER  8
#define TX_PIN_NUMBER  6
#define CTS_PIN_NUMBER 7
#define RTS_PIN_NUMBER 5
#define HWFC           true

#define BSP_QSPI_SCK_PIN   19
#define BSP_QSPI_CSN_PIN   17
#define BSP_QSPI_IO0_PIN   20
#define BSP_QSPI_IO1_PIN   21
#define BSP_QSPI_IO2_PIN   22
#define BSP_QSPI_IO3_PIN   23


// serialization APPLICATION board - temp. setup for running serialized MEMU tests
#define SER_APP_RX_PIN              NRF_GPIO_PIN_MAP(1,13)    // UART RX pin number.
#define SER_APP_TX_PIN              NRF_GPIO_PIN_MAP(1,14)    // UART TX pin number.
#define SER_APP_CTS_PIN             NRF_GPIO_PIN_MAP(0,2)     // UART Clear To Send pin number.
#define SER_APP_RTS_PIN             NRF_GPIO_PIN_MAP(1,15)    // UART Request To Send pin number.

#define SER_APP_SPIM0_SCK_PIN       NRF_GPIO_PIN_MAP(0,27)     // SPI clock GPIO pin number.
#define SER_APP_SPIM0_MOSI_PIN      NRF_GPIO_PIN_MAP(0,2)      // SPI Master Out Slave In GPIO pin number
#define SER_APP_SPIM0_MISO_PIN      NRF_GPIO_PIN_MAP(0,26)     // SPI Master In Slave Out GPIO pin number
#define SER_APP_SPIM0_SS_PIN        NRF_GPIO_PIN_MAP(1,13)     // SPI Slave Select GPIO pin number
#define SER_APP_SPIM0_RDY_PIN       NRF_GPIO_PIN_MAP(1,15)     // SPI READY GPIO pin number
#define SER_APP_SPIM0_REQ_PIN       NRF_GPIO_PIN_MAP(1,14)     // SPI REQUEST GPIO pin number

// serialization CONNECTIVITY board
#define SER_CON_RX_PIN              NRF_GPIO_PIN_MAP(1,14)    // UART RX pin number.
#define SER_CON_TX_PIN              NRF_GPIO_PIN_MAP(1,13)    // UART TX pin number.
#define SER_CON_CTS_PIN             NRF_GPIO_PIN_MAP(1,15)    // UART Clear To Send pin number. Not used if HWFC is set to false.
#define SER_CON_RTS_PIN             NRF_GPIO_PIN_MAP(0,2)     // UART Request To Send pin number. Not used if HWFC is set to false.


#define SER_CON_SPIS_SCK_PIN        NRF_GPIO_PIN_MAP(0,27)    // SPI SCK signal.
#define SER_CON_SPIS_MOSI_PIN       NRF_GPIO_PIN_MAP(0,2)     // SPI MOSI signal.
#define SER_CON_SPIS_MISO_PIN       NRF_GPIO_PIN_MAP(0,26)    // SPI MISO signal.
#define SER_CON_SPIS_CSN_PIN        NRF_GPIO_PIN_MAP(1,13)    // SPI CSN signal.
#define SER_CON_SPIS_RDY_PIN        NRF_GPIO_PIN_MAP(1,15)    // SPI READY GPIO pin number.
#define SER_CON_SPIS_REQ_PIN        NRF_GPIO_PIN_MAP(1,14)    // SPI REQUEST GPIO pin number.

#define SER_CONN_CHIP_RESET_PIN     NRF_GPIO_PIN_MAP(1,1)    // Pin used to reset connectivity chip

// Arduino board mappings
#define ARDUINO_SCL_PIN             27    // SCL signal pin
#define ARDUINO_SDA_PIN             26    // SDA signal pin
#define ARDUINO_AREF_PIN            2     // Aref pin

#define ARDUINO_13_PIN              NRF_GPIO_PIN_MAP(1, 15)  // Digital pin 13
#define ARDUINO_12_PIN              NRF_GPIO_PIN_MAP(1, 14)  // Digital pin 12
#define ARDUINO_11_PIN              NRF_GPIO_PIN_MAP(1, 13)  // Digital pin 11
#define ARDUINO_10_PIN              NRF_GPIO_PIN_MAP(1, 12)  // Digital pin 10
#define ARDUINO_9_PIN               NRF_GPIO_PIN_MAP(1, 11)  // Digital pin 9
#define ARDUINO_8_PIN               NRF_GPIO_PIN_MAP(1, 10)  // Digital pin 8

#define ARDUINO_7_PIN               NRF_GPIO_PIN_MAP(1, 8) // Digital pin 7
#define ARDUINO_6_PIN               NRF_GPIO_PIN_MAP(1, 7) // Digital pin 6
#define ARDUINO_5_PIN               NRF_GPIO_PIN_MAP(1, 6) // Digital pin 5
#define ARDUINO_4_PIN               NRF_GPIO_PIN_MAP(1, 5) // Digital pin 4
#define ARDUINO_3_PIN               NRF_GPIO_PIN_MAP(1, 4) // Digital pin 3
#define ARDUINO_2_PIN               NRF_GPIO_PIN_MAP(1, 3) // Digital pin 2
#define ARDUINO_1_PIN               NRF_GPIO_PIN_MAP(1, 2) // Digital pin 1
#define ARDUINO_0_PIN               NRF_GPIO_PIN_MAP(1, 1) // Digital pin 0

#define ARDUINO_A0_PIN              3     // Analog channel 0
#define ARDUINO_A1_PIN              4     // Analog channel 1
#define ARDUINO_A2_PIN              28    // Analog channel 2
#define ARDUINO_A3_PIN              29    // Analog channel 3
#define ARDUINO_A4_PIN              30    // Analog channel 4
#define ARDUINO_A5_PIN              31    // Analog channel 5

// Low frequency clock source to be used by the SoftDevice
#define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_XTAL,            \
                                 .rc_ctiv       = 0,                                \
                                 .rc_temp_ctiv  = 0,                                \
                                 .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}

#ifdef __cplusplus
}
#endif

#endif // BOARD_CUSTOM_H

and in the make file I have add the path to the file custom_board.h and I have changed the CFLAG like this

CFLAGS += -DBOARD_CUSTOM
# CFLAGS += -DBOARD_PCA10056

Do you have an idea why I can not initialize the micro SD card ?

When looking at the schematic if you find something strange with the antenna or related with the BLE you may have spotted another error as I can not connect to the BLE (but I am able to detect it ! ).

Thank you very much for the help. As you can understand when looking at the custom board schematic, I have spend a lot of time and energy on this project and I start to feel low when running in so complicated problem.

Best regards,

Loïc

  • Yes I did it. What I should look for in this function ?

    I have checked the pins when initialising the SPI and it is alright. I thought that all useful things where declare in the code with the #define

    #define SDC_SCK_PIN     42  ///< SDC serial clock (SCK) pin.
    #define SDC_MOSI_PIN    36  ///< SDC serial data in (DI) pin.
    #define SDC_MISO_PIN    45  ///< SDC serial data out (DO) pin.
    #define SDC_CS_PIN      34  ///< SDC chip select (CS) pin. p1.02
    
    /**
     * @brief  SDC block device definition
     * */
    NRF_BLOCK_DEV_SDC_DEFINE(
            m_block_dev_sdc,
            NRF_BLOCK_DEV_SDC_CONFIG(
                    SDC_SECTOR_SIZE,
                    APP_SDCARD_CONFIG(SDC_MOSI_PIN, SDC_MISO_PIN, SDC_SCK_PIN, SDC_CS_PIN)
             ),
             NFR_BLOCK_DEV_INFO_CONFIG("PerfectStride", "SDC", "1.00")
    );

    What do I have to check in the sdk_config ? How can it work this one reader and not at all with another when using the same sdk_config ?

  • Check the SPI signals with a scope. We have no idea why this does not work either.

  • I could do that but the issue is that on the custom board and I have no access to the pins.

    The following is the beginning of the skd_config.h I can paste a specific part if you need.

    #ifndef SDK_CONFIG_H
    #define SDK_CONFIG_H
    // <<< Use Configuration Wizard in Context Menu >>>\n
    #ifdef USE_APP_CONFIG
    #include "app_config.h"
    #endif
    // <h> nRF_Drivers 
    
    //==========================================================
    // <q> PERIPHERAL_RESOURCE_SHARING_ENABLED  - nrf_drv_common - Peripheral drivers common module
     
    
    #ifndef PERIPHERAL_RESOURCE_SHARING_ENABLED
    #define PERIPHERAL_RESOURCE_SHARING_ENABLED 0
    #endif
    
    // <e> SPI_ENABLED - nrf_drv_spi - SPI/SPIM peripheral driver
    //==========================================================
    #ifndef SPI_ENABLED
    #define SPI_ENABLED 1
    #endif
    // <o> SPI_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    
    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef SPI_DEFAULT_CONFIG_IRQ_PRIORITY
    #define SPI_DEFAULT_CONFIG_IRQ_PRIORITY 7
    #endif
    
    // <o> SPI_DEFAULT_FREQUENCY  - SPI frequency
     
    // <33554432=> 125 kHz 
    // <67108864=> 250 kHz 
    // <134217728=> 500 kHz 
    // <268435456=> 1 MHz 
    // <536870912=> 2 MHz 
    // <1073741824=> 4 MHz 
    // <2147483648=> 8 MHz 
    
    #ifndef SPI_DEFAULT_FREQUENCY
    #define SPI_DEFAULT_FREQUENCY 1073741824
    #endif
    
    // <o> NRF_SPI_DRV_MISO_PULLUP_CFG  - MISO PIN pull-up configuration.
     
    // <0=> NRF_GPIO_PIN_NOPULL 
    // <1=> NRF_GPIO_PIN_PULLDOWN 
    // <3=> NRF_GPIO_PIN_PULLUP 
    
    #ifndef NRF_SPI_DRV_MISO_PULLUP_CFG
    #define NRF_SPI_DRV_MISO_PULLUP_CFG 1
    #endif
    
    // <e> SPI0_ENABLED - Enable SPI0 instance
    //==========================================================
    #ifndef SPI0_ENABLED
    #define SPI0_ENABLED 1
    #endif
    // <q> SPI0_USE_EASY_DMA  - Use EasyDMA
     
    
    #ifndef SPI0_USE_EASY_DMA
    #define SPI0_USE_EASY_DMA 1
    #endif
    
    // </e>
    
    // <e> SPI1_ENABLED - Enable SPI1 instance
    //==========================================================
    #ifndef SPI1_ENABLED
    #define SPI1_ENABLED 1
    #endif
    // <q> SPI1_USE_EASY_DMA  - Use EasyDMA
     
    
    #ifndef SPI1_USE_EASY_DMA
    #define SPI1_USE_EASY_DMA 1
    #endif
    
    // </e>
    
    // <e> SPI2_ENABLED - Enable SPI2 instance
    //==========================================================
    #ifndef SPI2_ENABLED
    #define SPI2_ENABLED 0
    #endif
    // <q> SPI2_USE_EASY_DMA  - Use EasyDMA
     
    
    #ifndef SPI2_USE_EASY_DMA
    #define SPI2_USE_EASY_DMA 1
    #endif
    
    // </e>
    
    // </e>
    
    // <e> UART_ENABLED - nrf_drv_uart - UART/UARTE peripheral driver
    //==========================================================
    #ifndef UART_ENABLED
    #define UART_ENABLED 1
    #endif
    // <o> UART_DEFAULT_CONFIG_HWFC  - Hardware Flow Control
     
    // <0=> Disabled 
    // <1=> Enabled 
    
    #ifndef UART_DEFAULT_CONFIG_HWFC
    #define UART_DEFAULT_CONFIG_HWFC 0
    #endif
    
    // <o> UART_DEFAULT_CONFIG_PARITY  - Parity
     
    // <0=> Excluded 
    // <14=> Included 
    
    #ifndef UART_DEFAULT_CONFIG_PARITY
    #define UART_DEFAULT_CONFIG_PARITY 0
    #endif
    
    // <o> UART_DEFAULT_CONFIG_BAUDRATE  - Default Baudrate
     
    // <323584=> 1200 baud 
    // <643072=> 2400 baud 
    // <1290240=> 4800 baud 
    // <2576384=> 9600 baud 
    // <3862528=> 14400 baud 
    // <5152768=> 19200 baud 
    // <7716864=> 28800 baud 
    // <10289152=> 38400 baud 
    // <15400960=> 57600 baud 
    // <20615168=> 76800 baud 
    // <30801920=> 115200 baud 
    // <61865984=> 230400 baud 
    // <67108864=> 250000 baud 
    // <121634816=> 460800 baud 
    // <251658240=> 921600 baud 
    // <268435456=> 1000000 baud 
    
    #ifndef UART_DEFAULT_CONFIG_BAUDRATE
    #define UART_DEFAULT_CONFIG_BAUDRATE 30801920
    #endif
    
    // <o> UART_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    
    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef UART_DEFAULT_CONFIG_IRQ_PRIORITY
    #define UART_DEFAULT_CONFIG_IRQ_PRIORITY 7
    #endif
    
    // <q> UART_EASY_DMA_SUPPORT  - Driver supporting EasyDMA
     
    
    #ifndef UART_EASY_DMA_SUPPORT
    #define UART_EASY_DMA_SUPPORT 1
    #endif
    
    // <q> UART_LEGACY_SUPPORT  - Driver supporting Legacy mode
     
    
    #ifndef UART_LEGACY_SUPPORT
    #define UART_LEGACY_SUPPORT 1
    #endif
    
    // <e> UART0_ENABLED - Enable UART0 instance
    //==========================================================
    #ifndef UART0_ENABLED
    #define UART0_ENABLED 1
    #endif
    // <q> UART0_CONFIG_USE_EASY_DMA  - Default setting for using EasyDMA
     
    
    #ifndef UART0_CONFIG_USE_EASY_DMA
    #define UART0_CONFIG_USE_EASY_DMA 1
    #endif
    
    // </e>
    
    // <e> UART1_ENABLED - Enable UART1 instance
    //==========================================================
    #ifndef UART1_ENABLED
    #define UART1_ENABLED 0
    #endif
    // <q> UART1_CONFIG_USE_EASY_DMA  - Default setting for using EasyDMA
     
    
    #ifndef UART1_CONFIG_USE_EASY_DMA
    #define UART1_CONFIG_USE_EASY_DMA 1
    #endif
    
    // </e>
    
    // </e>
    
    // </h> 
    //==========================================================
    
    // <h> nRF_Libraries 
    
    //==========================================================
    // <q> APP_FIFO_ENABLED  - app_fifo - Software FIFO implementation
     
    
    #ifndef APP_FIFO_ENABLED
    #define APP_FIFO_ENABLED 1
    #endif
    
    // <e> APP_SDCARD_ENABLED - app_sdcard - SD/MMC card support using SPI
    //==========================================================
    #ifndef APP_SDCARD_ENABLED
    #define APP_SDCARD_ENABLED 1
    #endif
    // <o> APP_SDCARD_SPI_INSTANCE  - SPI instance used
     
    // <0=> 0 
    // <1=> 1 
    // <2=> 2 
    
    #ifndef APP_SDCARD_SPI_INSTANCE
    #define APP_SDCARD_SPI_INSTANCE 0
    #endif
    
    // <o> APP_SDCARD_FREQ_INIT  - SPI frequency
     
    // <33554432=> 125 kHz 
    // <67108864=> 250 kHz 
    // <134217728=> 500 kHz 
    // <268435456=> 1 MHz 
    // <536870912=> 2 MHz 
    // <1073741824=> 4 MHz 
    // <2147483648=> 8 MHz 
    
    #ifndef APP_SDCARD_FREQ_INIT
    #define APP_SDCARD_FREQ_INIT 67108864
    #endif
    
    // <o> APP_SDCARD_FREQ_DATA  - SPI frequency
     
    // <33554432=> 125 kHz 
    // <67108864=> 250 kHz 
    // <134217728=> 500 kHz 
    // <268435456=> 1 MHz 
    // <536870912=> 2 MHz 
    // <1073741824=> 4 MHz 
    // <2147483648=> 8 MHz 
    
    #ifndef APP_SDCARD_FREQ_DATA
    #define APP_SDCARD_FREQ_DATA 1073741824
    #endif
    
    // </e>
    
    // <e> APP_UART_ENABLED - app_uart - UART driver
    //==========================================================
    #ifndef APP_UART_ENABLED
    #define APP_UART_ENABLED 1
    #endif
    // <o> APP_UART_DRIVER_INSTANCE  - UART instance used
     
    // <0=> 0 
    
    #ifndef APP_UART_DRIVER_INSTANCE
    #define APP_UART_DRIVER_INSTANCE 0
    #endif
    
    // </e>
    
    // <e> NRF_BALLOC_ENABLED - nrf_balloc - Block allocator module
    //==========================================================
    #ifndef NRF_BALLOC_ENABLED
    #define NRF_BALLOC_ENABLED 1
    #endif
    // <e> NRF_BALLOC_CONFIG_DEBUG_ENABLED - Enables debug mode in the module.
    //==========================================================
    #ifndef NRF_BALLOC_CONFIG_DEBUG_ENABLED
    #define NRF_BALLOC_CONFIG_DEBUG_ENABLED 0
    #endif
    // <o> NRF_BALLOC_CONFIG_HEAD_GUARD_WORDS - Number of words used as head guard.  <0-255> 
    
    
    #ifndef NRF_BALLOC_CONFIG_HEAD_GUARD_WORDS
    #define NRF_BALLOC_CONFIG_HEAD_GUARD_WORDS 1
    #endif
    
    // <o> NRF_BALLOC_CONFIG_TAIL_GUARD_WORDS - Number of words used as tail guard.  <0-255> 
    
    
    #ifndef NRF_BALLOC_CONFIG_TAIL_GUARD_WORDS
    #define NRF_BALLOC_CONFIG_TAIL_GUARD_WORDS 1
    #endif
    
    // <q> NRF_BALLOC_CONFIG_BASIC_CHECKS_ENABLED  - Enables basic checks in this module.
     
    
    #ifndef NRF_BALLOC_CONFIG_BASIC_CHECKS_ENABLED
    #define NRF_BALLOC_CONFIG_BASIC_CHECKS_ENABLED 0
    #endif
    
    // <q> NRF_BALLOC_CONFIG_DOUBLE_FREE_CHECK_ENABLED  - Enables double memory free check in this module.
     
    
    #ifndef NRF_BALLOC_CONFIG_DOUBLE_FREE_CHECK_ENABLED
    #define NRF_BALLOC_CONFIG_DOUBLE_FREE_CHECK_ENABLED 0
    #endif
    
    // <q> NRF_BALLOC_CONFIG_DATA_TRASHING_CHECK_ENABLED  - Enables free memory corruption check in this module.
     
    
    #ifndef NRF_BALLOC_CONFIG_DATA_TRASHING_CHECK_ENABLED
    #define NRF_BALLOC_CONFIG_DATA_TRASHING_CHECK_ENABLED 0
    #endif
    
    // </e>
    
    // </e>
    
    // <q> NRF_FPRINTF_ENABLED  - nrf_fprintf - fprintf function.
     
    
    #ifndef NRF_FPRINTF_ENABLED
    #define NRF_FPRINTF_ENABLED 1
    #endif
    
    // <q> NRF_MEMOBJ_ENABLED  - nrf_memobj - Linked memory allocator module
     
    
    #ifndef NRF_MEMOBJ_ENABLED
    #define NRF_MEMOBJ_ENABLED 1
    #endif
    
    // <q> NRF_STRERROR_ENABLED  - nrf_strerror - Library for converting error code to string.
     
    
    #ifndef NRF_STRERROR_ENABLED
    #define NRF_STRERROR_ENABLED 1
    #endif
    
    // </h> 
    //==========================================================
    
    // <h> nRF_Log 
    
    //==========================================================
    // <e> NRF_LOG_BACKEND_RTT_ENABLED - nrf_log_backend_rtt - Log RTT backend
    //==========================================================
    #ifndef NRF_LOG_BACKEND_RTT_ENABLED
    #define NRF_LOG_BACKEND_RTT_ENABLED 0
    #endif
    // <o> NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE - Size of buffer for partially processed strings. 
    // <i> Size of the buffer is a trade-off between RAM usage and processing.
    // <i> if buffer is smaller then strings will often be fragmented.
    // <i> It is recommended to use size which will fit typical log and only the
    // <i> longer one will be fragmented.
    
    #ifndef NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE
    #define NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE 64
    #endif
    
    // </e>
    
    // <e> NRF_LOG_BACKEND_UART_ENABLED - nrf_log_backend_uart - Log UART backend
    //==========================================================
    #ifndef NRF_LOG_BACKEND_UART_ENABLED
    #define NRF_LOG_BACKEND_UART_ENABLED 1
    #endif
    // <o> NRF_LOG_BACKEND_UART_TX_PIN - UART TX pin 
    #ifndef NRF_LOG_BACKEND_UART_TX_PIN
    #define NRF_LOG_BACKEND_UART_TX_PIN 6
    #endif
    
    // <o> NRF_LOG_BACKEND_UART_BAUDRATE  - Default Baudrate
     
    // <323584=> 1200 baud 
    // <643072=> 2400 baud 
    // <1290240=> 4800 baud 
    // <2576384=> 9600 baud 
    // <3862528=> 14400 baud 
    // <5152768=> 19200 baud 
    // <7716864=> 28800 baud 
    // <10289152=> 38400 baud 
    // <15400960=> 57600 baud 
    // <20615168=> 76800 baud 
    // <30801920=> 115200 baud 
    // <61865984=> 230400 baud 
    // <67108864=> 250000 baud 
    // <121634816=> 460800 baud 
    // <251658240=> 921600 baud 
    // <268435456=> 1000000 baud 
    
    #ifndef NRF_LOG_BACKEND_UART_BAUDRATE
    #define NRF_LOG_BACKEND_UART_BAUDRATE 30801920
    #endif
    
    // <o> NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE - Size of buffer for partially processed strings. 
    // <i> Size of the buffer is a trade-off between RAM usage and processing.
    // <i> if buffer is smaller then strings will often be fragmented.
    // <i> It is recommended to use size which will fit typical log and only the
    // <i> longer one will be fragmented.
    
    #ifndef NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE
    #define NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE 64
    #endif
    
    // </e>
    
    // <h> nrf_log - Logging
    
    //==========================================================
    // <e> NRF_LOG_ENABLED - Logging module for nRF5 SDK
    //==========================================================
    #ifndef NRF_LOG_ENABLED
    #define NRF_LOG_ENABLED 1
    #endif
    // <e> NRF_LOG_USES_COLORS - If enabled then ANSI escape code for colors is prefixed to every string
    //==========================================================
    #ifndef NRF_LOG_USES_COLORS
    #define NRF_LOG_USES_COLORS 0
    #endif
    // <o> NRF_LOG_COLOR_DEFAULT  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRF_LOG_COLOR_DEFAULT
    #define NRF_LOG_COLOR_DEFAULT 0
    #endif
    
    // <o> NRF_LOG_ERROR_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRF_LOG_ERROR_COLOR
    #define NRF_LOG_ERROR_COLOR 0
    #endif
    
    // <o> NRF_LOG_WARNING_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRF_LOG_WARNING_COLOR
    #define NRF_LOG_WARNING_COLOR 0
    #endif
    
    // </e>
    
    // <o> NRF_LOG_DEFAULT_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRF_LOG_DEFAULT_LEVEL
    #define NRF_LOG_DEFAULT_LEVEL 3
    #endif
    
    // <q> NRF_LOG_DEFERRED  - Enable deffered logger.
     
    
    // <i> Log data is buffered and can be processed in idle.
    
    #ifndef NRF_LOG_DEFERRED
    #define NRF_LOG_DEFERRED 0
    #endif
    
    // <o> NRF_LOG_BUFSIZE  - Size of the buffer for storing logs (in bytes).
     
    
    // <i> Must be power of 2 and multiple of 4.
    // <i> If NRF_LOG_DEFERRED = 0 then buffer size can be reduced to minimum.
    // <128=> 128 
    // <256=> 256 
    // <512=> 512 
    // <1024=> 1024 
    // <2048=> 2048 
    // <4096=> 4096 
    // <8192=> 8192 
    // <16384=> 16384 
    
    #ifndef NRF_LOG_BUFSIZE
    #define NRF_LOG_BUFSIZE 1024
    #endif
    
    // <q> NRF_LOG_ALLOW_OVERFLOW  - Configures behavior when circular buffer is full.
     
    
    // <i> If set then oldest logs are overwritten. Otherwise a 
    // <i> marker is injected informing about overflow.
    
    #ifndef NRF_LOG_ALLOW_OVERFLOW
    #define NRF_LOG_ALLOW_OVERFLOW 1
    #endif
    
    // <q> NRF_LOG_USES_TIMESTAMP  - Enable timestamping
     
    
    // <i> Function for getting the timestamp is provided by the user
    
    #ifndef NRF_LOG_USES_TIMESTAMP
    #define NRF_LOG_USES_TIMESTAMP 0
    #endif
    
    // <q> NRF_LOG_FILTERS_ENABLED  - Enable dynamic filtering of logs.
     
    
    #ifndef NRF_LOG_FILTERS_ENABLED
    #define NRF_LOG_FILTERS_ENABLED 0
    #endif
    
    // <q> NRF_LOG_CLI_CMDS  - Enable CLI commands for the module.
     
    
    #ifndef NRF_LOG_CLI_CMDS
    #define NRF_LOG_CLI_CMDS 0
    #endif
    
    // <h> Log message pool - Configuration of log message pool
    
    //==========================================================
    // <o> NRF_LOG_MSGPOOL_ELEMENT_SIZE - Size of a single element in the pool of memory objects. 
    // <i> If a small value is set, then performance of logs processing
    // <i> is degraded because data is fragmented. Bigger value impacts
    // <i> RAM memory utilization. The size is set to fit a message with
    // <i> a timestamp and up to 2 arguments in a single memory object.
    
    #ifndef NRF_LOG_MSGPOOL_ELEMENT_SIZE
    #define NRF_LOG_MSGPOOL_ELEMENT_SIZE 20
    #endif
    
    // <o> NRF_LOG_MSGPOOL_ELEMENT_COUNT - Number of elements in the pool of memory objects 
    // <i> If a small value is set, then it may lead to a deadlock
    // <i> in certain cases if backend has high latency and holds
    // <i> multiple messages for long time. Bigger value impacts
    // <i> RAM memory usage.
    
    #ifndef NRF_LOG_MSGPOOL_ELEMENT_COUNT
    #define NRF_LOG_MSGPOOL_ELEMENT_COUNT 8
    #endif
    
    // </h> 
    //==========================================================
    
    // </e>
    
    // <h> nrf_log module configuration 
    
    //==========================================================
    // <h> nrf_log in nRF_Core 
    
    //==========================================================
    // <e> NRF_MPU_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef NRF_MPU_CONFIG_LOG_ENABLED
    #define NRF_MPU_CONFIG_LOG_ENABLED 0
    #endif
    // <o> NRF_MPU_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRF_MPU_CONFIG_LOG_LEVEL
    #define NRF_MPU_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> NRF_MPU_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRF_MPU_CONFIG_INFO_COLOR
    #define NRF_MPU_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> NRF_MPU_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRF_MPU_CONFIG_DEBUG_COLOR
    #define NRF_MPU_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> NRF_STACK_GUARD_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef NRF_STACK_GUARD_CONFIG_LOG_ENABLED
    #define NRF_STACK_GUARD_CONFIG_LOG_ENABLED 0
    #endif
    // <o> NRF_STACK_GUARD_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRF_STACK_GUARD_CONFIG_LOG_LEVEL
    #define NRF_STACK_GUARD_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> NRF_STACK_GUARD_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRF_STACK_GUARD_CONFIG_INFO_COLOR
    #define NRF_STACK_GUARD_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> NRF_STACK_GUARD_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRF_STACK_GUARD_CONFIG_DEBUG_COLOR
    #define NRF_STACK_GUARD_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> TASK_MANAGER_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef TASK_MANAGER_CONFIG_LOG_ENABLED
    #define TASK_MANAGER_CONFIG_LOG_ENABLED 0
    #endif
    // <o> TASK_MANAGER_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef TASK_MANAGER_CONFIG_LOG_LEVEL
    #define TASK_MANAGER_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> TASK_MANAGER_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef TASK_MANAGER_CONFIG_INFO_COLOR
    #define TASK_MANAGER_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> TASK_MANAGER_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef TASK_MANAGER_CONFIG_DEBUG_COLOR
    #define TASK_MANAGER_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // </h> 
    //==========================================================
    
    // <h> nrf_log in nRF_Drivers 
    
    //==========================================================
    // <e> CLOCK_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef CLOCK_CONFIG_LOG_ENABLED
    #define CLOCK_CONFIG_LOG_ENABLED 0
    #endif
    // <o> CLOCK_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef CLOCK_CONFIG_LOG_LEVEL
    #define CLOCK_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> CLOCK_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef CLOCK_CONFIG_INFO_COLOR
    #define CLOCK_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> CLOCK_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef CLOCK_CONFIG_DEBUG_COLOR
    #define CLOCK_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> COMMON_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef COMMON_CONFIG_LOG_ENABLED
    #define COMMON_CONFIG_LOG_ENABLED 0
    #endif
    // <o> COMMON_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef COMMON_CONFIG_LOG_LEVEL
    #define COMMON_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> COMMON_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef COMMON_CONFIG_INFO_COLOR
    #define COMMON_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> COMMON_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef COMMON_CONFIG_DEBUG_COLOR
    #define COMMON_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> COMP_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef COMP_CONFIG_LOG_ENABLED
    #define COMP_CONFIG_LOG_ENABLED 0
    #endif
    // <o> COMP_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef COMP_CONFIG_LOG_LEVEL
    #define COMP_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> COMP_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef COMP_CONFIG_INFO_COLOR
    #define COMP_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> COMP_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef COMP_CONFIG_DEBUG_COLOR
    #define COMP_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> GPIOTE_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef GPIOTE_CONFIG_LOG_ENABLED
    #define GPIOTE_CONFIG_LOG_ENABLED 0
    #endif
    // <o> GPIOTE_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef GPIOTE_CONFIG_LOG_LEVEL
    #define GPIOTE_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> GPIOTE_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef GPIOTE_CONFIG_INFO_COLOR
    #define GPIOTE_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> GPIOTE_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef GPIOTE_CONFIG_DEBUG_COLOR
    #define GPIOTE_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> I2S_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef I2S_CONFIG_LOG_ENABLED
    #define I2S_CONFIG_LOG_ENABLED 0
    #endif
    // <o> I2S_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef I2S_CONFIG_LOG_LEVEL
    #define I2S_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> I2S_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef I2S_CONFIG_INFO_COLOR
    #define I2S_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> I2S_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef I2S_CONFIG_DEBUG_COLOR
    #define I2S_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> LPCOMP_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef LPCOMP_CONFIG_LOG_ENABLED
    #define LPCOMP_CONFIG_LOG_ENABLED 0
    #endif
    // <o> LPCOMP_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef LPCOMP_CONFIG_LOG_LEVEL
    #define LPCOMP_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> LPCOMP_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef LPCOMP_CONFIG_INFO_COLOR
    #define LPCOMP_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> LPCOMP_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef LPCOMP_CONFIG_DEBUG_COLOR
    #define LPCOMP_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> PDM_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef PDM_CONFIG_LOG_ENABLED
    #define PDM_CONFIG_LOG_ENABLED 0
    #endif
    // <o> PDM_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef PDM_CONFIG_LOG_LEVEL
    #define PDM_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> PDM_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef PDM_CONFIG_INFO_COLOR
    #define PDM_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> PDM_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef PDM_CONFIG_DEBUG_COLOR
    #define PDM_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> PPI_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef PPI_CONFIG_LOG_ENABLED
    #define PPI_CONFIG_LOG_ENABLED 0
    #endif
    // <o> PPI_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef PPI_CONFIG_LOG_LEVEL
    #define PPI_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> PPI_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef PPI_CONFIG_INFO_COLOR
    #define PPI_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> PPI_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef PPI_CONFIG_DEBUG_COLOR
    #define PPI_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> PWM_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef PWM_CONFIG_LOG_ENABLED
    #define PWM_CONFIG_LOG_ENABLED 0
    #endif
    // <o> PWM_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef PWM_CONFIG_LOG_LEVEL
    #define PWM_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> PWM_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef PWM_CONFIG_INFO_COLOR
    #define PWM_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> PWM_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef PWM_CONFIG_DEBUG_COLOR
    #define PWM_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> QDEC_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef QDEC_CONFIG_LOG_ENABLED
    #define QDEC_CONFIG_LOG_ENABLED 0
    #endif
    // <o> QDEC_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef QDEC_CONFIG_LOG_LEVEL
    #define QDEC_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> QDEC_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef QDEC_CONFIG_INFO_COLOR
    #define QDEC_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> QDEC_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef QDEC_CONFIG_DEBUG_COLOR
    #define QDEC_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> RNG_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef RNG_CONFIG_LOG_ENABLED
    #define RNG_CONFIG_LOG_ENABLED 0
    #endif
    // <o> RNG_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef RNG_CONFIG_LOG_LEVEL
    #define RNG_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> RNG_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef RNG_CONFIG_INFO_COLOR
    #define RNG_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> RNG_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef RNG_CONFIG_DEBUG_COLOR
    #define RNG_CONFIG_DEBUG_COLOR 0
    #endif
    
    // <q> RNG_CONFIG_RANDOM_NUMBER_LOG_ENABLED  - Enables logging of random numbers.
     
    
    #ifndef RNG_CONFIG_RANDOM_NUMBER_LOG_ENABLED
    #define RNG_CONFIG_RANDOM_NUMBER_LOG_ENABLED 0
    #endif
    
    // </e>
    
    // <e> RTC_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef RTC_CONFIG_LOG_ENABLED
    #define RTC_CONFIG_LOG_ENABLED 0
    #endif
    // <o> RTC_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef RTC_CONFIG_LOG_LEVEL
    #define RTC_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> RTC_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef RTC_CONFIG_INFO_COLOR
    #define RTC_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> RTC_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef RTC_CONFIG_DEBUG_COLOR
    #define RTC_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> SAADC_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef SAADC_CONFIG_LOG_ENABLED
    #define SAADC_CONFIG_LOG_ENABLED 0
    #endif
    // <o> SAADC_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef SAADC_CONFIG_LOG_LEVEL
    #define SAADC_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> SAADC_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef SAADC_CONFIG_INFO_COLOR
    #define SAADC_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> SAADC_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef SAADC_CONFIG_DEBUG_COLOR
    #define SAADC_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> SPIS_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef SPIS_CONFIG_LOG_ENABLED
    #define SPIS_CONFIG_LOG_ENABLED 0
    #endif
    // <o> SPIS_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef SPIS_CONFIG_LOG_LEVEL
    #define SPIS_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> SPIS_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef SPIS_CONFIG_INFO_COLOR
    #define SPIS_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> SPIS_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef SPIS_CONFIG_DEBUG_COLOR
    #define SPIS_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> SPI_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef SPI_CONFIG_LOG_ENABLED
    #define SPI_CONFIG_LOG_ENABLED 0
    #endif
    // <o> SPI_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef SPI_CONFIG_LOG_LEVEL
    #define SPI_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> SPI_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef SPI_CONFIG_INFO_COLOR
    #define SPI_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> SPI_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef SPI_CONFIG_DEBUG_COLOR
    #define SPI_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> SWI_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef SWI_CONFIG_LOG_ENABLED
    #define SWI_CONFIG_LOG_ENABLED 0
    #endif
    // <o> SWI_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef SWI_CONFIG_LOG_LEVEL
    #define SWI_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> SWI_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef SWI_CONFIG_INFO_COLOR
    #define SWI_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> SWI_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef SWI_CONFIG_DEBUG_COLOR
    #define SWI_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> TIMER_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef TIMER_CONFIG_LOG_ENABLED
    #define TIMER_CONFIG_LOG_ENABLED 0
    #endif
    // <o> TIMER_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef TIMER_CONFIG_LOG_LEVEL
    #define TIMER_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> TIMER_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef TIMER_CONFIG_INFO_COLOR
    #define TIMER_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> TIMER_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef TIMER_CONFIG_DEBUG_COLOR
    #define TIMER_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> TWIS_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef TWIS_CONFIG_LOG_ENABLED
    #define TWIS_CONFIG_LOG_ENABLED 0
    #endif
    // <o> TWIS_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef TWIS_CONFIG_LOG_LEVEL
    #define TWIS_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> TWIS_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef TWIS_CONFIG_INFO_COLOR
    #define TWIS_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> TWIS_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef TWIS_CONFIG_DEBUG_COLOR
    #define TWIS_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> TWI_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef TWI_CONFIG_LOG_ENABLED
    #define TWI_CONFIG_LOG_ENABLED 0
    #endif
    // <o> TWI_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef TWI_CONFIG_LOG_LEVEL
    #define TWI_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> TWI_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef TWI_CONFIG_INFO_COLOR
    #define TWI_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> TWI_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef TWI_CONFIG_DEBUG_COLOR
    #define TWI_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> UART_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef UART_CONFIG_LOG_ENABLED
    #define UART_CONFIG_LOG_ENABLED 0
    #endif
    // <o> UART_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef UART_CONFIG_LOG_LEVEL
    #define UART_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> UART_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef UART_CONFIG_INFO_COLOR
    #define UART_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> UART_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef UART_CONFIG_DEBUG_COLOR
    #define UART_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> USBD_CONFIG_LOG_ENABLED - Enable logging in the module
    //==========================================================
    #ifndef USBD_CONFIG_LOG_ENABLED
    #define USBD_CONFIG_LOG_ENABLED 0
    #endif
    // <o> USBD_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef USBD_CONFIG_LOG_LEVEL
    #define USBD_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> USBD_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef USBD_CONFIG_INFO_COLOR
    #define USBD_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> USBD_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef USBD_CONFIG_DEBUG_COLOR
    #define USBD_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> WDT_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef WDT_CONFIG_LOG_ENABLED
    #define WDT_CONFIG_LOG_ENABLED 0
    #endif
    // <o> WDT_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef WDT_CONFIG_LOG_LEVEL
    #define WDT_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> WDT_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef WDT_CONFIG_INFO_COLOR
    #define WDT_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> WDT_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef WDT_CONFIG_DEBUG_COLOR
    #define WDT_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // </h> 
    //==========================================================
    
    // <h> nrf_log in nRF_Libraries 
    
    //==========================================================
    // <e> APP_USBD_CDC_ACM_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef APP_USBD_CDC_ACM_CONFIG_LOG_ENABLED
    #define APP_USBD_CDC_ACM_CONFIG_LOG_ENABLED 0
    #endif
    // <o> APP_USBD_CDC_ACM_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef APP_USBD_CDC_ACM_CONFIG_LOG_LEVEL
    #define APP_USBD_CDC_ACM_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> APP_USBD_CDC_ACM_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef APP_USBD_CDC_ACM_CONFIG_INFO_COLOR
    #define APP_USBD_CDC_ACM_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> APP_USBD_CDC_ACM_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef APP_USBD_CDC_ACM_CONFIG_DEBUG_COLOR
    #define APP_USBD_CDC_ACM_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> APP_USBD_MSC_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef APP_USBD_MSC_CONFIG_LOG_ENABLED
    #define APP_USBD_MSC_CONFIG_LOG_ENABLED 0
    #endif
    // <o> APP_USBD_MSC_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef APP_USBD_MSC_CONFIG_LOG_LEVEL
    #define APP_USBD_MSC_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> APP_USBD_MSC_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef APP_USBD_MSC_CONFIG_INFO_COLOR
    #define APP_USBD_MSC_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> APP_USBD_MSC_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef APP_USBD_MSC_CONFIG_DEBUG_COLOR
    #define APP_USBD_MSC_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> NRF_BALLOC_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef NRF_BALLOC_CONFIG_LOG_ENABLED
    #define NRF_BALLOC_CONFIG_LOG_ENABLED 0
    #endif
    // <o> NRF_BALLOC_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRF_BALLOC_CONFIG_LOG_LEVEL
    #define NRF_BALLOC_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> NRF_BALLOC_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRF_BALLOC_CONFIG_INFO_COLOR
    #define NRF_BALLOC_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> NRF_BALLOC_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRF_BALLOC_CONFIG_DEBUG_COLOR
    #define NRF_BALLOC_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> NRF_CLI_BLE_UART_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef NRF_CLI_BLE_UART_CONFIG_LOG_ENABLED
    #define NRF_CLI_BLE_UART_CONFIG_LOG_ENABLED 0
    #endif
    // <o> NRF_CLI_BLE_UART_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRF_CLI_BLE_UART_CONFIG_LOG_LEVEL
    #define NRF_CLI_BLE_UART_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> NRF_CLI_BLE_UART_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRF_CLI_BLE_UART_CONFIG_INFO_COLOR
    #define NRF_CLI_BLE_UART_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> NRF_CLI_BLE_UART_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRF_CLI_BLE_UART_CONFIG_DEBUG_COLOR
    #define NRF_CLI_BLE_UART_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> NRF_CLI_UART_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef NRF_CLI_UART_CONFIG_LOG_ENABLED
    #define NRF_CLI_UART_CONFIG_LOG_ENABLED 0
    #endif
    // <o> NRF_CLI_UART_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRF_CLI_UART_CONFIG_LOG_LEVEL
    #define NRF_CLI_UART_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> NRF_CLI_UART_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRF_CLI_UART_CONFIG_INFO_COLOR
    #define NRF_CLI_UART_CONFIG_INFO_COLOR 0
    #endif

    Thank you for your suggestions,

  • Swip, I need you to debug disk_initialize() by single-stepping through the execution of its code. What you're looking for is the state and state changes that prevents the initialization of the disk buffer. Usually this is present in the parameters passed to the function, but it can also be a global state in the library. 

    The return value of disk_initialize(0) will tell you where in the function you returned from. 

    I did not see anything in the sdk_config, but it has 2k of lines so it's easy to miss an invalid setting. The debugging of disk_initialize() will tell us where to look next. 

  • Thank you haakonsh for your guidance. So from the first tests with debugger, the code goes with no surprise in the disk_initialize function in diskio_blkdev.c

    Change happen between the two codes happen at the following lines

        ret_code_t err_code = nrf_blk_dev_init(m_drives[drv].config.p_block_device,
                                               block_dev_handler,
                                               (void *) (uint32_t) drv);
        if (err_code == NRF_SUCCESS)
        {
            while (m_drives[drv].busy)
            {
                m_drives[drv].config.wait_func();
            }
    
            if (m_drives[drv].last_result == NRF_BLOCK_DEV_RESULT_SUCCESS)
            {
                m_drives[drv].state &= ~STA_NOINIT;
            }
        }
    
        return m_drives[drv].state;

    In both cases the err_code is NRF_SUCCESS. But when waiting in the wait_function() for the communication to happen, using the custom board the m_drives[drv].last_result switches from NRF_BLOCK_DEV_RESULT_SUCCESS to NRF_BLOCK_DEV_RESULT_IO_ERROR (1).

    The nrf_blk_dev_init function seems to do the same things with the custom board or the nRF 52 DK.

    If I understand correctly what does the initialise communication, it is only 80 times a sort of false communication to switch into spi mode with no CS pin activated. What ever the sdk_config file, the pins for mosi, miso and sckl are given in the main.c file, the spi mode is set to 0 and no pull up resistor is activated

    from nrf_drv_spi_init function in nrf_drv_spi.c file

    nrf_gpio_cfg(p_config->sck_pin,
                     NRF_GPIO_PIN_DIR_OUTPUT,
                     NRF_GPIO_PIN_INPUT_CONNECT,
                     NRF_GPIO_PIN_NOPULL,
                     NRF_GPIO_PIN_S0S1,
                     NRF_GPIO_PIN_NOSENSE);
        // - MOSI (optional) - output with initial value 0,
        if (p_config->mosi_pin != NRF_DRV_SPI_PIN_NOT_USED)
        {
            mosi_pin = p_config->mosi_pin;
            nrf_gpio_pin_clear(mosi_pin);
            nrf_gpio_cfg_output(mosi_pin);
        }
        else
        {
            mosi_pin = NRF_SPI_PIN_NOT_CONNECTED;
        }
        // - MISO (optional) - input,
        if (p_config->miso_pin != NRF_DRV_SPI_PIN_NOT_USED)
        {
            miso_pin = p_config->miso_pin;
            nrf_gpio_cfg_input(miso_pin, (nrf_gpio_pin_pull_t)NRF_SPI_DRV_MISO_PULLUP_CFG);
        }

    I should add that I have tested 2 custom boards with 3 different micro SD cards without success for the moment.

Related