I2C not working and error on TX RX

Arduino Nano, Notecard cellular, Carrier A, Arduino IED 1.8.19

I’ll give 2 files as references. The first file is; Example6_SensorTutorial
I get this error: ‘Serial1’ was not declared in this scope and it’s on the #define txRx line.

// Include the Arduino library for the Notecard
#include <Notecard.h>
#include <NotecardPseudoSensor.h>

#define txRxPinsSerial Serial1 //‘Serial1’ was not declared in this scope

Secondary is a comment in the compiling of: "PRODUCT_UID is not defined in this example. It is defined and the sketch will compile.

So I comment the line out and it should run on I2C. It doesn’t. I get the right feedback with the serial monitor.

The second file is: Example0_LibrarylessCommunication.

The sketch compiles with the same "PRODUCT_UID is not defined in this example.

txRx does not give an error and wired that way everything works.

How do I I get the txRx to work in the Example6_SensorTutorial file since I2C doesn’t want to play nice? EDIT: Do I need resistors on the i2C lines? I guess I assumed they would already be n the carrier.

What’s with the "PRODUCT_UID is not defined in this example. message when it’s clearly defined?

Hey @rayjorgnsen,

Sorry you ran into issues here. And thanks for reporting these because it’s good feedback for us.

The sketch compiles with the same "PRODUCT_UID is not defined in this example.

Make sure you have a #define PRODUCT_UID that contains a non-empty string. It might be easiest to just replace this block.

// This is the unique Product Identifier for your device
#ifndef PRODUCT_UID
#define PRODUCT_UID ""
#pragma message "PRODUCT_UID is not defined in this example. Please ensure your Notecard has a product identifier set before running this example or define it in code here. More details at https://dev.blues.io/tools-and-sdks/samples/product-uid"
#endif

With a straightforward definition.

// This is the unique Product Identifier for your device
#define PRODUCT_UID "com.blues.tvantoll:getstarted"

And then for this error.

#define txRxPinsSerial Serial1 //‘Serial1’ was not declared in this scope

The Arduino Nano board only has one serial port and this example #6 assumes two. Serial - Arduino Reference When I run this example on a Blues Swan it runs fine because Serial1 exists. The reason example 0 works is because it doesn’t assume two serial ports are available.

I’m going to share this thread with our firmware team to see if they have any advice here.

TJ

I didn’t know the Nano only had one!! Could a software serial be used?

Also, If I use resisters will the I2C then work?

Hey @rayjorgnsen,

Sorry for the super late reply here—just getting back from an event and catching up on everything.

We think you might be hitting an active issue we’re working through with I2C in note-arduino. We have a release candidate that has a fix you might want to try. We can’t attach it here so we’re going to reach out via email.

Thanks,
TJ

2 Likes

There was a bug with I2C on 8-bit MCUs. It’s been fixed in the latest note-arduino release, version 1.5.4.

2 Likes

I still have to comment out the debugger line. Ill play. With it more this weekend and give you feedback

Hyden, If you’d rather get the bad news later in the day - don’t read on!!

I deleted all instances of Blues libraries. Then from the download of 1.5.4 library I installed from zip file.

I have to comment out //notecard.setDebugOutputStream(usbSerial); in order to get any data to flow. I also dug out an Uno and it’s the same with it. Let me know if I can help in any way.

Ray

1 Like

Hey Ray. That’s strange. That setDebugOutputStream call shouldn’t be compiled for Uno, because the NOTE_C_LOW_MEM macro should be defined. I’ll look into this.

1 Like

Hi Ray,

I’m not able to reproduce your problem locally. Here’s what I did:

  • Opened the Arduino IDE.
  • Used the library manager to update the Blues Wireless Notecard library to 1.5.4.
  • File > Examples > Blues Wireless Notecard > Example6_SensorTutorial.
  • Put in my ProductUID.
  • Built and uploaded to my Uno.

I’m getting logs in the Serial Monitor as expected, and data is flowing. Just to be sure, I deliberately added a syntax error to the code that shouldn’t be compiled:

#ifndef NOTE_C_LOW_MEM
    error
    notecard.setDebugOutputStream(usbSerial);
#else
#pragma message("INFO: Notecard debug logs disabled. (non-fatal)")
#endif // !NOTE_C_LOW_MEM
#endif // usbSerial

Indeed, the compiler didn’t care, because NOTE_C_LOW_MEM is defined.

Perhaps you have files from an older version of the library lingering somewhere?

Best,

Hayden

2 Likes

Almost forgot to report. Like you said I must have had something lingering. It took a while but I got the new library to take works fine.

2 Likes

Glad to hear it’s working!