Ok, I did some tests, and I have some odd results. Below is a table of the tests I ran and their outcomes. I ran the same test code every time, which attempts to send a total of 4 requests. The first is a simple sync. This is a small request and response, so it should tell us if the connection works at all. The second is a somewhat big non-templated Notefile, which should tell us if sending a bunch of data to the Notecard is a problem. Next is a card.wireless request, which gives a long response back to the MCU, telling us if the problem is receiving too much data. Last is the templated Notefile, which is the request that has been giving me trouble this whole time. As for the tests, the first was my existing circuit, connecting to the Notecard through only the QWIIC port. I tried also running a direct ground wire between the Notecard and MCU, but this was actually unsuccessful, oddly enough. Powering the Notecard through the VUSB pin (and using a direct ground) worked differently depending on how I powered the pullup resistors, but even the better of the two was iffy. I couldn’t get the clock rate change to work either, it seemed to bug out right away (I tried this on the QWIIC only circuit).
| Test | Sync | Non-template | Wireless | Template
| QWIIC Only | Y | Y | Y | N
| Direct Ground | N | N | N | N
| Same Power, QWIIC Power for Pullups | Y | N | N | N
| Same Power, USB Power for Pullups | Y | Y | N* | N
| Changed I2C Clock | N | N | N | N
*This did work when I added a LiPo to the Notecard. This was the only change from adding a LiPo.
Also, with the filesystem, after doing the card.restore you recommended, I ended up finding a new oddity. I forgot to do hub.set: mode:minimum, which was the mode I had been using, and until I did, the connection became very poor, if it worked at all. Even while using the original QWIIC only circuit, I was getting the I2C error on sync requests. This did go away after setting the mode to minimum, but it’s still very strange to me that the default mode would cause issues.
As an extra test, I left the MCU running for about 15 minutes sending non-template packets every 30 seconds (on the original circuit), and I saw no communication errors the whole time. This test made it seem like the I2C connection works just fine, but clearly something is unusual here. Between the strange filesystem error, errors when the mode is not set to minimum, and of course the problem with templated Notefiles, I’m thoroughly confused.
Again, I’d appreciate any help.
Thanks,
eddy_w
In case anyone wants to see, here’s what a typical output looks like for one of these tests:
[INFO] {"req":"hub.sync","crc":"0000:10BAC79A"}
[INFO] {}
[INFO] {"req":"note.add","file":"data.qo","full":true,"sync":true,"body":{"temp":73.19999694824219,"charge":92.40000152587891,"flow":true,"alert":false,"humidity":50,"power":50,"text":"a really long string of text to send a lot of data"},"crc":"0001:67409E2F"}
[INFO] {"total":1}
[INFO] {"req":"card.wireless","crc":"0002:3CE09784"}
[INFO] {"status":"{modem-off}","mode":"auto","count":3,"net":{"imei":"--:--:--:--:--:--","modem":"v5.2.1","ssid":"<ssid>","bssid":"--:--:--:--:--:--","rat":"wifi-2.4","rssi":-68,"bars":3,"cid":9,"updated":1776294236}}
[INFO] {"req":"note.add","file":"fast.qo","full":true,"sync":true,"body":{"temp":73.19999694824219,"charge":92.40000152587891,"flow":true,"alert":false},"crc":"0003:083FCDFE"}
[ERROR] i2c|rx: no response to read request {io}{i2c}
[WARN] i2c: reattempting to read Notecard response
[ERROR] serial-over-i2c|rx: unexpected protocol byte count {io}{i2c}
[WARN] i2c: reattempting to read Notecard response
[ERROR] serial-over-i2c|rx: unexpected protocol byte count {io}{i2c}
[WARN] i2c: reattempting to read Notecard response
[ERROR] serial-over-i2c|rx: unexpected protocol byte count {io}{i2c}
[WARN] i2c: reattempting to read Notecard response
[ERROR] serial-over-i2c|rx: unexpected protocol byte count {io}{i2c}
[ERROR] failed to query Notecard
[WARN] retrying... transaction failure
Also for reference, here are the packets I’m sending:
void notecard_sync() {
J *req = notecard.newRequest("hub.sync");
if (req != NULL) {
notecard.sendRequest(req);
}
}
void notecard_network() {
J *req = notecard.newRequest("card.wireless");
if (req != NULL) {
notecard.sendRequest(req);
}
}
void notecard_send_data() {
J *req = notecard.newRequest("note.add");
if (req != NULL) {
JAddStringToObject(req, "file", "data.qo");
JAddBoolToObject(req, "full", true);
JAddBoolToObject(req, "sync", true);
J *body = JAddObjectToObject(req, "body");
if (body != NULL) {
JAddNumberToObject(body, "temp", temp);
JAddNumberToObject(body, "charge", charge);
JAddBoolToObject(body, "flow", flow);
JAddBoolToObject(body, "alert", alertStatus);
JAddNumberToObject(body, "humidity", 50.0);
JAddNumberToObject(body, "power", 50.0);
JAddStringToObject(body, "text", "a really long string of text to send a lot of data");
}
notecard.sendRequestWithRetry(req, 1);
}
}
void notecard_send_fast() {
J *req = notecard.newRequest("note.add");
if (req != NULL) {
JAddStringToObject(req, "file", "fast.qo");
JAddBoolToObject(req, "full", true);
JAddBoolToObject(req, "sync", true);
J *body = JAddObjectToObject(req, "body");
if (body != NULL) {
JAddNumberToObject(body, "temp", temp);
JAddNumberToObject(body, "charge", charge);
JAddBoolToObject(body, "flow", flow);
JAddBoolToObject(body, "alert", alertStatus);
}
notecard.sendRequestWithRetry(req, 1);
}
}