First. Great details on the tutorials, my compliments.
Second. The Linux hint to apply the python-is python3 patch was a very helpful hint. I had been searching for that for a while.
Suggestions:
A VSCode/Codium setup with PlatformIO would be very useful for the millions of those IDEs users (like myself).
Display first the full code at the start of the tutorial and then g into the details. Having many separate code blocks to be pasted and looking where the code should be placed is a not so friendly user experience.
Add more tutorials.
Issues I was having with the tutorial code:
The two tutorials it was not mentioned the code should be combined to work correctly.
In the code:
With code:
J *req = notecard.newRequest(“hub.set”);
JAddStringToObject(req, “product”, productUID);
JAddStringToObject(req, “mode”, “continuous”);
notecard.sendRequest(req);
in Terminal:
{“req”:“hub.set”,“product”:“biz.yr-design.rob:kittywood”,“mode”:“continuous”}
{“err”:“cannot process request: unrecognized: z.yr-design.rob:kittywood","mode":"…”}
{“err”:“cannot process request: unrecognized: z.yr-design.rob:kittywood”,“mode”:"…"}
…along with what we’ve been able to reproduce here, it appears that the first 30 characters are being dropped. 30 characters is not a random amount of data, it is the length of the default Arduino I2C transaction.
To that end, it appears the first I2C transaction is being lost somewhere along the way. Let’s focus on the details that may affect the I2C transmission.
Can you share the following with me:
how are you powering the device
battery
one or two USB cables (connected to the ESP32, Notecarrier-AF, or both)
You mentioned you are using both VSCodium and the Arduino IDE. I’m unfamiliar with VSCodium and how that may fit in. Are you writing the software in VSCodium, then using the Arduino IDE to compile and install the binary on the ESP32?
I’m asking because I want to understand all the details of the power supplied to the ESP32, Notecard, and Notecarrier. It seems like either the ESP32 is not ready to send (power or otherwise), and/or the Notecard is not ready to receive the I2C transaction. Both of these seem like potential power supply issues to me.
Once I’ve reproduced your error, then I will attach an oscilloscope and figure out exactly what is happening. Whether it has to do with timing, power or logic.
After using Arduino for many years I was introduced to PlatformIO and VSCode/VSCodium by an intern at Safecast and since then I only use Arduino of fast simple code checks to see if the code I use, can be used in Arduino too. And I really like the Arduino Serial Plotter (sometimes need) and have not found a good replacement for it yet.
The integration of terminal/GitHub/intelligent suggestions for coding/etc. made me join the millions of VSCode/Codium users. And even when I could public my own theme ( at the marketplace at https://marketplace.visualstudio.com/items?itemName=robouden.robouden-dark) for my own theme, I am not intended to switch back to Arduino for coding.
I have recreated your project, but unfortunately I have not been able to reproduce your issue. The only difference between our setups, is that I am using the Arduino IDE directly.
Here is the code I was using to test:
#include <Notecard.h>
#define serialDebug Serial
#define productUID "biz.yr-design.rob:kittywood"
Notecard notecard;
void setup (void) {
serialDebug.begin(115200);
while (!serialDebug) {
; // wait for serial port to connect. Needed for native USB
}
notecard.begin();
notecard.setDebugOutputStream(serialDebug);
J *req = notecard.newRequest("hub.set");
JAddStringToObject(req, "product", productUID);
JAddStringToObject(req, "mode", "continuous");
notecard.sendRequest(req);
}
void loop (void) {
}
The code above is simple and directly tests the error case. However, the I2C transaction was successful on my hardware and I was unable to reproduce your issue. If you believe the code is too simple or I have missed something, feel free to comment and I will modify to your liking.
Reviewing the tests you ran from your post, it appears the first I2C message is being dropped, which leads me to believe either the Huzzah32 or the Notecard is not ready.
We recommend you to provide an additional USB cable (power only) to the Notecarrier’s micro-USB port. The Notecard draws significant current when attempting to use it’s cellular and GPS capabilities. When powered only through your PC’s USB port, this can cause brown-outs on the host MCU or the Notecard. Once you have additional power supplied to the Notecarrier, then we can be certain the Notecard is fully powered and ready to receive the I2C transaction. Then we could narrow our focus to the MCU.
One of my colleagues has hardware that can reproduce the issue, but he is on holiday so there will be a short delay before he is able to help us.
Hi Rob! At first glance, it looks like the I2C connection is unstable. But it seems you are using the Notecarrier-AF, which makes that a bit unlikely.
This is a bit of a stretch, but is there any chance you have the Notecarrier resting on a conductive surface that could be touching a couple of solder joints?
I’m brainstorming here, wondering what could cause the i2c to drop out somewhat randomly that we can’t reproduce using the same hardware. The first thought I had is wondering if there is something about the environment that could be causing this behavior.
Thanks for the reply. The Notecarrier-AF is on standoffs and not touching anything. I notice that there is an update on the Blues libraries to update to V1.2.9. I will have a look and test it on my setup and I will report back.
#define serialDebug Serial #define productUID “biz.yr-design.rob:kittywood”
Notecard notecard;
void setup (void) {
serialDebug.begin(115200);
while (!serialDebug) {
; // wait for serial port to connect. Needed for native USB
}
notecard.begin();
notecard.setDebugOutputStream(serialDebug);
— Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
— More details at Redirecting...
— Miniterm on /dev/ttyUSB0 115200,8,N,1 —
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H —
i2c reset
{“req”:“hub.set”}
{}