CRC error on response With note.get call

Newby here, so take that into consideration!

I am still in “sandbox” mode where I am just playing with things to learn how the Notecard ecosystem works. My sandbox program is attempting to create a settings file, store some settings into it, then retrieve it.

The problem I have is that no matter what I have tried, my “note.get” calls have always failed with the “CRC error on response” being written to the [ERROR} output.

Example output is shown below. You will notice that I hub.set commands works fine, then I do a “card.time” request and set the system time of the ESP32. Then I attempt to load the settings file.

If the load of the settings file fails, I assume that the settings file is not correctly setup so I delete the settings file, then I create a default settings file.

I did sometimes get a failure on the delete with an error saying the file was still open. I assumed this was probably a sync problem, so for now I just added some time delays to slow things down.

My “file.delete” works fine.

My “note.add” works fine.

But my “note.get” has never worked.

At one point I connected a USB cable directly to the Notecarrier F and used the Blue.io quickstart terminal emulator to talk direcctly to the Notecard. The “note.get” works fine via this mechanism, but the exact same note.get call from my ESP32 always fails.

Please help.

Below is a log that shows everything from ESP32 boot time, including each request JSON and each response JSON string


03/15/2024 00:56:19.338: — Cleared @ 03/15/2024 00:56:19.338 —
03/15/2024 00:56:19.408: — Started @ 03/15/2024 00:56:19.408 —
03/15/2024 00:56:47.714: ets Jul 29 2019 12:21:46
03/15/2024 00:56:48.868:
03/15/2024 00:56:58.878: rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
03/15/2024 00:56:59.907: configsip: 0, SPIWP:0xee
03/15/2024 00:57:00.193: clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
03/15/2024 00:57:02.209: mode:DIO, clock div:1
03/15/2024 00:57:02.391: load:0x3fff0030,len:1184
03/15/2024 00:57:02.402: load:0x40078000,len:13260
03/15/2024 00:57:02.588: load:0x40080400,len:3028
03/15/2024 00:57:03.095: entry 0x400805e4
03/15/2024 00:57:03.275:
03/15/2024 00:57:03.782: ----------------------------
03/15/2024 00:57:03.962: BluesSandbox1 is starting…
03/15/2024 00:57:04.469: ----------------------------
03/15/2024 00:57:04.649: ------------------------------
03/15/2024 00:57:05.156: Booting…
03/15/2024 00:57:05.336: ------------------------------
03/15/2024 00:57:05.843: Initializing Notecard…
03/15/2024 00:57:06.023: req object:
03/15/2024 00:57:06.545: {
03/15/2024 00:57:07.560: “req”: “hub.set”,
03/15/2024 00:57:07.709: “product”: “OBSCURED_PRODUCT_STRING”,
03/15/2024 00:57:22.740: “mode”: “continuous”
03/15/2024 00:57:23.243: }
03/15/2024 00:58:23.269: [INFO] {“req”:“hub.set”,“product”:“OBSCURED_PRODUCT_STRING”,“mode”:“continuous”,“body”:{“agent”:“note-arduino”,“compiler”:“gcc 8.4.0”,“req_interface”:“i2c”,“cpu_name”:“esp32”},“crc”:“0000:3DDF411D”}
03/15/2024 00:58:23.451: [INFO] {}
03/15/2024 00:58:23.958: Notecard setup complete.
03/15/2024 00:58:26.019: [INFO] {“req”:“card.time”,“crc”:“0001:1110F247”}
03/15/2024 00:58:26.200: [INFO] {“minutes”:-240,“lat”:35.896837499999985,“lon”:-79.416890625,“area”:“Pleasant Hill NC region”,“country”:“US”,“zone”:“EDT,America/New_York”,“time”:1710478622}
03/15/2024 00:58:26.706: Status response:
03/15/2024 00:58:26.886: time : 1710478622
03/15/2024 00:58:27.408: minutes: -240
03/15/2024 00:58:28.423: ---------------------------------------
03/15/2024 00:58:28.572: System clock set to 00:57:02 03/15/2024
03/15/2024 00:58:43.603: ---------------------------------------
03/15/2024 00:58:44.106: ------------------------------
03/15/2024 00:59:44.130: Loading boat-settings.db file…
03/15/2024 00:59:44.314: req object:
03/15/2024 00:59:44.820: {
03/15/2024 00:59:45.001: “req”: “note.get”,
03/15/2024 00:59:45.508: “file”: “boat-settings.db”,
03/15/2024 00:59:45.688: “note”: “boat-settings”,
03/15/2024 00:59:46.195: “delete”: “false”
03/15/2024 00:59:46.375: }
03/15/2024 00:59:46.882: [INFO] {“req”:“note.get”,“file”:“boat-settings.db”,“note”:“boat-settings”,“delete”:“false”,“crc”:“0002:1431E8B2”}
03/15/2024 00:59:47.062: [ERROR] CRC error on response
03/15/2024 00:59:47.569: [INFO] {“req”:“note.get”,“file”:“boat-settings.db”,“note”:“boat-settings”,“delete”:“false”,“crc”:“0002:1431E8B2”}
03/15/2024 00:59:47.749: [ERROR] CRC error on response
03/15/2024 00:59:48.271: [INFO] {“req”:“note.get”,“file”:“boat-settings.db”,“note”:“boat-settings”,“delete”:“false”,“crc”:“0002:1431E8B2”}
03/15/2024 00:59:49.286: [ERROR] CRC error on response
03/15/2024 00:59:49.435: [INFO] {“req”:“note.get”,“file”:“boat-settings.db”,“note”:“boat-settings”,“delete”:“false”,“crc”:“0002:1431E8B2”}
03/15/2024 01:00:04.466: [ERROR] CRC error on response
03/15/2024 01:00:04.865: [INFO] {“req”:“note.get”,“file”:“boat-settings.db”,“note”:“boat-settings”,“delete”:“false”,“crc”:“0002:1431E8B2”}
03/15/2024 01:01:04.888: [ERROR] CRC error on response
03/15/2024 01:01:05.073: [INFO] {“req”:“note.get”,“file”:“boat-settings.db”,“note”:“boat-settings”,“delete”:“false”,“crc”:“0002:1431E8B2”}
03/15/2024 01:01:05.580: [ERROR] CRC error on response
03/15/2024 01:01:05.760: [ERROR] {“err”:“crc error {io}”,“src”:“note-c”}
03/15/2024 01:01:06.266: rsp object:
03/15/2024 01:01:06.447: {
03/15/2024 01:01:06.953: “err”: “crc error {io}”,
03/15/2024 01:01:07.134: “src”: “note-c”
03/15/2024 01:01:07.640: }
03/15/2024 01:01:07.821: err = crc error {io}
03/15/2024 01:01:08.328: ------------------------------
03/15/2024 01:01:08.508: Deleting the boat-settings.db file…
03/15/2024 01:01:09.029: req object:
03/15/2024 01:01:10.045: {
03/15/2024 01:01:10.399: “req”: “file.delete”,
03/15/2024 01:01:25.432: “files”: [“boat-settings.db”]
03/15/2024 01:01:25.703: }
03/15/2024 01:02:25.721: [INFO] {“req”:“file.delete”,“files”:[“boat-settings.db”],“crc”:“0003:725C262B”}
03/15/2024 01:02:25.904: [INFO] {}
03/15/2024 01:02:26.410: rsp object:
03/15/2024 01:02:26.590: {
03/15/2024 01:02:27.097: }
03/15/2024 01:02:27.278: Settings file was successfully deleted.
03/15/2024 01:02:27.785: Sleep 15 seconds…
03/15/2024 01:02:27.965: ------------------------------
03/15/2024 01:02:28.472: Create default settings (note.add)
03/15/2024 01:02:28.652: req object:
03/15/2024 01:02:29.158: {
03/15/2024 01:02:29.339: “req”: “note.add”,
03/15/2024 01:02:29.860: “note”: “boat-settings”,
03/15/2024 01:02:30.876: “file”: “boat-settings.db”,
03/15/2024 01:02:31.024: “body”: {
03/15/2024 01:02:46.056: “sensorReadInterval”: 60,
03/15/2024 01:02:46.714: “settingsCheckInterval”: 120
03/15/2024 01:03:46.739: },
03/15/2024 01:03:46.922: “sync”: true
03/15/2024 01:03:47.429: }
03/15/2024 01:03:47.612: [INFO] {“req”:“note.add”,“note”:“boat-settings”,“file”:“boat-settings.db”,“body”:{“sensorReadInterval”:60,“settingsCheckInterval”:120},“sync”:true,“crc”:“0004:A49ECC71”}
03/15/2024 01:03:48.117: [INFO] {“total”:1}
03/15/2024 01:03:48.297: rsp object:
03/15/2024 01:03:48.803: {
03/15/2024 01:03:48.984: “total”: 1
03/15/2024 01:03:49.490: }
03/15/2024 01:03:49.670: ------------------------------
03/15/2024 01:03:50.177: Default settings created (note.add)
03/15/2024 01:03:50.358: Sleep for 60 seconds…
03/15/2024 01:03:50.880: ------------------------------
03/15/2024 01:03:51.895: Loading boat-settings.db file…
03/15/2024 01:03:52.457: req object:
03/15/2024 01:04:07.489: {
03/15/2024 01:04:07.761: “req”: “note.get”,
03/15/2024 01:05:07.777: “file”: “boat-settings.db”,
03/15/2024 01:05:07.961: “note”: “boat-settings”,
03/15/2024 01:05:08.468: “delete”: “false”
03/15/2024 01:05:08.648: }
03/15/2024 01:05:09.157: [INFO] {“req”:“note.get”,“file”:“boat-settings.db”,“note”:“boat-settings”,“delete”:“false”,“crc”:“0005:1431E8B2”}
03/15/2024 01:05:09.335: [ERROR] CRC error on response
03/15/2024 01:05:09.844: [INFO] {“req”:“note.get”,“file”:“boat-settings.db”,“note”:“boat-settings”,“delete”:“false”,“crc”:“0005:1431E8B2”}
03/15/2024 01:05:10.023: [ERROR] CRC error on response
03/15/2024 01:05:10.531: [INFO] {“req”:“note.get”,“file”:“boat-settings.db”,“note”:“boat-settings”,“delete”:“false”,“crc”:“0005:1431E8B2”}
03/15/2024 01:05:10.710: [ERROR] CRC error on response
03/15/2024 01:05:11.218: [INFO] {“req”:“note.get”,“file”:“boat-settings.db”,“note”:“boat-settings”,“delete”:“false”,“crc”:“0005:1431E8B2”}
03/15/2024 01:05:11.397: [ERROR] CRC error on response
03/15/2024 01:05:11.920: [INFO] {“req”:“note.get”,“file”:“boat-settings.db”,“note”:“boat-settings”,“delete”:“false”,“crc”:“0005:1431E8B2”}
03/15/2024 01:05:12.934: [ERROR] CRC error on response
03/15/2024 01:05:13.446: [INFO] {“req”:“note.get”,“file”:“boat-settings.db”,“note”:“boat-settings”,“delete”:“false”,“crc”:“0005:1431E8B2”}

Hi @bradleyward,

Which Notecard SDK are you using (e.g. note-arduino or note-python) and what’s the firmware version running on the Notecard? I’m wondering if either (or both) are behind a bit and this issue may be addressed with the latest versions.

Rob

Here is the output from the card.version command:

> {"req":"card.version"}
{
 "version": "notecard-7.2.1.16425",
 "device": "dev:868032061546218",
 "name": "Blues Wireless Notecard",
 "sku": "NOTE-WBNA",
 "ordering_code": "XA0XT1N5AFAC",
 "board": "1.11",
 "cell": true,
 "gps": true,
 "api": 7,
 "body": {
  "org": "Blues Wireless",
  "product": "Notecard",
  "target": "r5",
  "version": "notecard-7.2.1",
  "ver_major": 7,
  "ver_minor": 2,
  "ver_patch": 1,
  "ver_build": 16425,
  "built": "Mar  5 2024 20:15:15"
 }
}

Oh, and I am using the Arduino library. I started with the Quickstart code from your website.

I forgot to state the version of the Arduino library: It is 1.5.4

image

Ok all looks good there. Would you mind posting your full sketch here (or DM me with it) so I can try to reproduce the problem? Also which ESP32 host are you using?

Rob

Hi Rob.

I am using an Adafruit ESP32 Feather (Huzzah) processor.

I stripped down my code to a very minimal state that still creates the error. See below.

The “err” code is “crc error (io)”.

Does this mean that an I/O error is occurring in the communincations between the ESP32 and either the Notecard or the Notecarrier? If so, I wondered if one of the sensors OR LCD screen I had hooked to the ESP32 was interfering with that communincation. To test this theory, I unplugged everything from the ESP32. So the only connections the ESP32 has outside of itself is (a) the USB cable plugged in between my Windows 10 PC and the ESP32, and (b) the electrical connections on the bottom of the ESP32 where it plugs into the Notecarrier-F V1.3 board.

Same results: crc error (io)

Here is my example sketch:

//
// Board setting:  Adafruit ESP32 Feather
//
#include <Arduino.h>
#include <TimeLib.h>
#include <Notecard.h>

Notecard notecard;

const char* SETTINGS_FILE_NAME = "settings.db";
const char* SETTINGS_NOTE_NAME = "settings";
const char* PRODUCT_UID = "net.wardsrus.brad:tutorial_project_20240227";

void setup() 
{
   StartSerial();
   SetupNotecard();
   LoadSettings();
}

void loop() 
{
}

void StartSerial()
{
   Serial.begin(115200);
   while (!Serial)
   {
      delay(50);
   }
   Serial.println("Starting NoteGetExample...");
}

void SetupNotecard()
{
   Serial.println("Initializing Notecard...");

   notecard.begin();

   // Tell the Notecard library to use Serial
   // for its debug output.
   // ------------------------------------------
   notecard.setDebugOutputStream(Serial);

   // Now, we'll configure the Notecard. 
   // Using the hub.set request, we associate this Notecard with the 
   // ProductUID of your project and set the Notecard to operate in 
   // continuous mode, which indicates that the device should 
   // immediately make a connection to Notehub and keep it active.
   // --------------------------------------------------------------
   J *req = notecard.newRequest("hub.set");
   JAddStringToObject(req, "product", PRODUCT_UID);
   JAddStringToObject(req, "mode", "continuous");
   PrintRequest(req);
   notecard.sendRequest(req);
   Serial.println("Notecard setup complete.");
}

void PrintRequest(J* request)
{
   Serial.printf("Request object:
%s
",JPrint(request));
}

void PrintResponse(J* response)
{
   Serial.printf("Response object:
%s
",JPrint(response));
}

void LoadSettings()
{
   Serial.printf("Loading %s file...
",SETTINGS_FILE_NAME);

   J *req = notecard.newRequest("note.get");
   if (req != NULL)
   {
      JAddStringToObject(req, "file", SETTINGS_FILE_NAME);
      JAddStringToObject(req, "note", SETTINGS_NOTE_NAME);
      JAddStringToObject(req, "delete", "false");
      PrintRequest(req);
      J* rsp = notecard.requestAndResponse(req);
      PrintResponse(rsp);

      const char* err = JGetString(rsp,"err");

      if (err != NULL && strlen(err) > 0)
      {
	 notecard.deleteResponse(rsp);

	 Serial.println("Settings file could not be loaded from Notecard!");
	 Serial.printf("err = %s
",err);
	 return;
      }

      // The settings file was successfully loaded
      // -----------------------------------------
      Serial.println("Settings file loaded from Notecard.");
      Serial.println("No further code in this example, as the 'note.get' call noow works.");
   }
   else
   {
      Serial.println("notecard.newRequest() returned NULL!");
   }
}