This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

send NRF_LOG to external eeprom

Hello everyone, 

I work with a custom board with the nRF52840 chip on it. We have  pressure, humidity and temperature sensor and accelerometer sensor on the board. We need to read the sensor's values and logged it on an eeprom.

Our application is a BLE app with SoftDevice s140 and SDK 15.2.0.

My question is: It is possible to redirect NRF_LOG to the eeprom? 

In the low level is there a weak function that could be implement to take another method of log transmission? 

Thank you for your response. 

Etienne

Parents Reply Children
  • Hello, 

    I has written a function who write on the EEPROM and define macro who link to the function.

    like this : 

    #define MAX_LOG_LENGTH      50
    #define MAX_LOG_MODEM_DATA      (MAX_LOG_LENGTH - 5)
    #define MAX_LOG_DIAG_DATA       (MAX_LOG_LENGTH - 6)
    
    #define LOG_INFO_MASK       (uint8_t)0x00
    #define LOG_ERROR_MASK      (uint8_t)0x01
    #define LOG_WARNING_MASK    (uint8_t)0x02
    #define LOG_DEBUG_MASK      (uint8_t)0x03
    #define LOG_DEBUG_MODEM     (uint8_t)0x04
    
    #define LOG_EEPROM_INFO(log) log_eeprom(LOG_DIAG, LOG_INFO_MASK, log, MAX_LOG_DIAG_DATA)
    #define LOG_EEPROM_ERROR(log) log_eeprom(LOG_DIAG, LOG_ERROR_MASK, log, MAX_LOG_DIAG_DATA)
    #define LOG_EEPROM_WARNING(log) log_eeprom(LOG_DIAG, LOG_WARNING_MASK, log, MAX_LOG_DIAG_DATA)
    #define LOG_EEPROM_DEBUG(log) log_eeprom(LOG_DIAG, LOG_DEBUG_MASK, log, MAX_LOG_DIAG_DATA)
    #define LOG_EEPROM_MODEM(log) log_eeprom(LOG_MODEM, LOG_DEBUG_MODEM, log, MAX_LOG_MODEM_DATA)
    
    ret_code_t log_eeprom(uint8_t partitionId, uint8_t levelId, char const * const logText, uint8_t maxLength);

    Etienne

Related