VFO rp2040 si5351

Hi All

Hardware

Adafruit qt py rp2040, sh1106 oled diplay, si5351 Generator, RTC_DS3231, Adafriut seesaw endcoder.

All using the Stemma qt connectors. The Adafriut qt py rp2040 uses wire1 for the stemma qt.

All devices are working except for the si5351 gen. I have spent all afternoon trying to find how to get wire1 to work with the si5351.

I have my includes wire.h si5351.h I have tried

si5351 si5351(&Wire1); errors, I have tried Wire1.begin does not error but still does not work.

The Adafruit_Si5351 will not compile errors with a syntax error

Any ideas please help

Thank you

Jim

It might make things easier if you showed us a minimal sketch that demonstrated the syntax error.

under setup

Wire1.begin();

bool i2c_found;

i2c_found = si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0); //works on wire0

i2c_found = si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0, &Wire1); //errors

if(!i2c_found) { Serial.println("Device not found on I2C bus!"); }

si5351.set_correction(cal_factor, SI5351_PLL_INPUT_XO);

si5351.drive_strength(SI5351_CLK0, SI5351_DRIVE_4MA); si5351.set_freq(DF, SI5351_CLK0);

si5351.update_status(); si5351.set_freq(FR, SI5351_CLK0);

si5351.update_status();

That's not a compilable sketch, so I'm not surprised that you get syntax errors. It wouldn't matter if you used Wire, Wire1, or xyzzy.

EatherKit si5351 example will compile until you try to change to wire1

Here's a minimal compilable sketch that successfully compiles for the QT Py RP2040 with the Adafruit_Si5351 on Wire1 on my setup. I fixed a trivial incompatibility the library had with the rp2040 core but it was nothing that would hold you up for more than a minute or two so I look forward to seeing what you've uncovered.

#include <Adafruit_SI5351.h>

Adafruit_SI5351 clockgen = Adafruit_SI5351();

void setup(void) {
   Serial.begin(115200);

   if( clockgen.begin(&Wire1) != ERROR_NONE ) {
      Serial.println("No Si5351 detected");
      while( true ) {
         yield();
      }
   }

   Serial.println("Si5351 initialized");
}

void loop(void) {
}

Compile result:

arduino-cli compile -b rp2040:rp2040:adafruit_qtpy --warnings all --output-dir /home/me/tmp --no-color (in directory: /home/me/Documents/sketchbook/RP2040_Zero/test)
Sketch uses 62048 bytes (0%) of program storage space. Maximum is 8384512 bytes.
Global variables use 10044 bytes (3%) of dynamic memory, leaving 252100 bytes for local variables. Maximum is 262144 bytes.
Compilation finished successfully.

I'm afraid I have no idea what "EatherKit si5351 example" is, nor the inclination to go looking for it. If you want free help, then don't put up obstacles.

Etherkit Si5351 library

Really? Well, good luck with your project then.

Where did you get it, a link would help.
Does it have example code?

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

In the Arduino ide libraries Etherkit Si5351

Does the example work?

Tom.... :smiley: :+1: :coffee: :australia:

The example works if the si5351 is on wire0 it does not if it is on wire1

Why do you want it on wire 1?

Tom.... :smiley: :+1: :coffee: :australia:

Stemma QT is set on Wire1. I would like for my project to plug together not solder together

You didn't provide that information until 14 posts into the thread. As mentioned, you're asking for free help. So do you understand how making it difficult for people to help you will discourage them from doing so?

If you look in the file "si5351.cpp", you'll see that the library is hard coded to use only the wire object. You'll need to modify the library to use it. Or, use a different one.

I have tried to modify the si5351.cpp with no luck.

Have not posted for a long time sorry to take so long to get to the point.

Thank you all for the help.

Jim

Both si5351.cpp and si5351.h need to be modified. Perhaps if you post your attempts, someone would help you.

If it were my project, I'd modify the init() function of accept a Reference to a TwoWire object as an optional third parameter. Then change all hard coded uses of the Wire object to use the supplied reference instead.