where the printing come from?

Hi,
I’m testing a sketch as the code attached, the Serial Monitor shown: ‘Enter setting mode fail’ …
My question is where the words ‘Enter setting mode fail’ text come from, there is nothing like it in the sketch.

#include <SPI.h>
#include "mcp_can.h"

///////////////////
// Configuration //
///////////////////

// CS pin for CAN bus shield.
// The default pin depends on the shield's version:
//  - 1.0: digital pin 10
//  - 1.1 and newer: digital pin 9
const int CS_PIN = 9;

// Serial port data rate
const long SERIAL_SPEED = 115200;

// CAN bus data rate
const byte CAN_SPEED = CAN_125KBPS;

///////////////////

MCP_CAN CAN(CS_PIN);
unsigned char len = 0;
byte buffer[8];

void setup() {
    //// Serial.begin(SERIAL_SPEED);

    Serial.begin(9600);
    byte canSpeed = CAN_SPEED;

    while (CAN.begin(canSpeed) != CAN_OK) {
      delay(100);
    }
}

void loop() {
    if (CAN.checkReceive() == CAN_MSGAVAIL) {
        CAN.readMsgBuf(&len, buffer);

        Serial.print("FRAME:ID=");
        Serial.print(CAN.getCanId());
        Serial.print(":LEN=");
        Serial.print(len);
        
        char tmp[3];
        for(int i = 0; i<len; i++) {
            Serial.print(":");
            
            snprintf(tmp, 3, "%02X", buffer[i]);
            
            Serial.print(tmp);
        }

        Serial.println();
    }
}

Thanks
Adam

post 26.JPG

I’m going to guess it comes from the library.
Why don’t you take a look?

If you don’t print it, then a library prints it: https://github.com/Seeed-Studio/CAN_BUS_Shield/blob/master/mcp_can.cpp#L665.

Thank you TheMemberFormerlyKnownAsAWOL and Koepel, you are right, it is from Lib.

All the best.

Adam

Koepel:
If you don't print it, then a library prints it: https://github.com/Seeed-Studio/CAN_BUS_Shield/blob/master/mcp_can.cpp#L665.

Thanks again Koepel,
Would you please let me know which line of the sketch trigged the printing?
Thanks
Adam

You use CAN.begin().

When you look into that file and search for "::begin", then it is at line 955. It calls mcp2515_init() which is at line 656 and when you scroll a little down, there it is.

When searching that file for "Serial.print" then you will see that they all are behind a "#if DEBUG_EN", wich is set to 1 in the file mcp_can_dfs.h.

Koepel:
You use CAN.begin().

When you look into that file and search for "::begin", then it is at line 955. It calls mcp2515_init() which is at line 656 and when you scroll a little down, there it is.

When searching that file for "Serial.print" then you will see that they all are behind a "#if DEBUG_EN", wich is set to 1 in the file mcp_can_dfs.h.

Thank you so much for help.
Best to you.
Adam