Skip to content

library integration on ESP32  #66

Open

Description

@micfuc

Hi , I am integrating Si5351Arduino on an ESP32 micro using arduino IDE.
I get erratic behaveures when using the set_freq and set_freq_manual methods; in particular:

  1. the status is always as following
    SYS_INIT: 1 LOL_A: 1 LOL_B: 1 LOS: 1 REVID: 0
  2. when setting more then one CLK with set_freq no out is generated; with a single clk it works
  3. when setting frequencies > 10 Mhz the actual value obtained is completely wrong
  4. by using the set_freq_manual it works pretty good on a single clock
  5. by using the set_freq_manual with 2 or 3 clocks does not work...

can you please help to fix these issues ?

Thanks in advance for any help and thanks for the wonderfull work done ...

Mike

Activity

  1. NT7S commented on Dec 18, 2018

    @NT7S
    Member

    I recently acquired an ESP32, so at some point I should be able to look at this, but right now I'm in the middle of a crunch to get some other projects shipped, so this will have to wait a bit. Thanks for the report.

  2. paulh002 commented on Jul 3, 2019

    @paulh002

    I have exactly the same issue. I now use a interface developed by JF3HZB maybe there is some timing issue

  3. WA2FZW commented on Aug 15, 2019

    @WA2FZW

    Me three! I just reported this to Jason directly yesterday. Unlike Mike, however, when I look at the status bits, they all look good! The program I'm trying to make work is the "si5351_calibration" program from the examples that come with Jason's library. The only mods I've made to it (other than a million different approaches to trying to make it work) was to actually read the frequency and PLL frequencies from the Si5351 to display them instead of just displaying what the program thinks they are.

    I can also confirm that the JF3HZB software works as I have a modified version of his VFO working, and if I could figure out how to add the calibration function to it, I would!

    John

  4. WA2FZW commented on Aug 15, 2019

    @WA2FZW

    I tried the "si5351.set_freq_manual" function this morning - didn't help! Also tried different frequencies (5MHz, 10MHz and 15MHz) - Still just get a short burst of output then the Si5351 stops outputting. I'm only using CLK0 and PLLA, again in a slightly modified version of Jason's calibration program.

    The output I get is:

    Si5351 Calibration Program
    Waiting for Si5351 to come online!

    Si5351 is online!

    I2C Bus Speed: 100,000.00 Hz
    Actual correction: 0.00 Hz // Have this commented out
    Target Frequency: 15,000,000.00 Hz // What the program thinks
    Actual clock freq: 15,000,000.00 Hz // What the chip thinks
    PLL-A Frequency: 800,000,000.00 Hz // What the chip thinks
    PLL-B Frequency: 800,000,000.00 Hz // What the chip thinks

    SYS_INIT: 0 LOL_A: 0 LOL_B: 0 LOS: 0 REVID: 0

    Adjust until your frequency counter reads as close to 10 MHz as possible.
    Press 'q' when complete.
    Up: r t y u i o p
    Down: f g h j k l ;
    Hz: 0.01 0.1 1 10 100 1K 10k

    Everything except "Target Frequency" is actually being read out of the chip.

    And BTW, I'm using an Adafruit board; I see no significant electrical difference between the Adafruit board and the Etherkit board.

    The current version of my code is attached (change the extension from "txt" to "ino"). It is set up to work on non-standard I2C pins; it doesn't work on the standard ones either! Comment out the "Wire.begin" call to use the default pins.

    Si5351_Cal_With_Alternate_I2C.txt

    John

  5. WanderLG commented on Sep 10, 2019

    @WanderLG

    Most likely the problem is in the ESP32 Wire library, because using a logical parser, we can see that ESP32 loses I2C SCL sync.
    I am sending 2 files with si5351_calibration.ino i2c logical data
    Arduino vs ESP32

    If you want to verify both files, download the Saleae Software.
    https://www.saleae.com/pt/downloads/

    The 2 files are here.
    Analyzer Logic.zip

    Muito provavelmente o problema é na biblioteca Wire do ESP32, pois usando um analisador logico, podemos perceber que o ESP32 perde o sincronismo SCL do I2C.
    Estou enviando 2 arquivos com os dados lógicos i2c do si5351_calibration.ino
    Arduino vs ESP32

    Se quiserem verificar os dois arquivos, baixem o Software Saleae.
    https://www.saleae.com/pt/downloads/

    Os 2 arquivos estão aqui.
    Analyzer Logic.zip

  6. WA2FZW commented on Sep 10, 2019

    @WA2FZW
  7. WanderLG commented on Sep 10, 2019

    @WanderLG

    But something is happening and the package is getting lost.
    look at these two comparisons.

    This picture is the wire scanning for addresses. This one works perfectly.
    Scan

    and this is si5351_calibration.ino This does not work..

    Cal

  8. WanderLG commented on Sep 10, 2019

    @WanderLG

    The two photos are just the end of the package. In the first photo, both work, but in the second photo, Arduino Works and ESP32 does not work.

  9. WA2FZW commented on Sep 10, 2019

    @WA2FZW

    Oh, I agree something isn't working; just not sure what! You didn't say, but is the scanner program using the Wire library or not?

    I definitely see some differences in the data streams in the 2nd set of pictures, but I'm not sure what they mean. There are a couple of strange pulses on the SCL line also:

    image-1

    John
    WA2FZW

  10. WanderLG commented on Sep 10, 2019

    @WanderLG
  11. WA2FZW commented on Sep 10, 2019

    @WA2FZW
  12. WA2FZW commented on Sep 10, 2019

    @WA2FZW

    This didn't seem to get posted when I replied via email:

    Well, again, that would lead me to believe the problem is not in the Wire library, but in the Etherkit library. Again I am using the Wire library to communicate with a PCF8574 over the I2C bus with no problem, which would also lead me to believe the Wire library is OK.

    John
    WA2FZW

  13. ramapcsx2 commented on Sep 10, 2019

    @ramapcsx2

    Hey,
    the problem could be in the I2C implementation in the Si5351 chip itself.
    I2C features like clock stretching could be used and this is known to cause issues with the ESP32 in particular.
    So I recommend investigating for I2C protocol errors.
    Check active and closed issues on the esp32-arduino project such as this one: espressif/arduino-esp32#2301

    Good luck!

  14. WanderLG commented on Sep 10, 2019

    @WanderLG

    This is where the first error occurs.
    Note that using Arduino, we have between 16+ACK up to 12+ACK 9 high SCL pulses.

    But using ESP32 that doesn't happen and we only have 5 high pulses in SCL.

    erro1

    Jhon, I suspect the problem is with ESP32 i2c libraries as there are more people with this same problem using other i2c modules. Already the (JF3HZB) VFO works, because it built i2c communication without using the ESP32 specific libraries. It's not just Wire.h or Wire.cpp. There are others that are related.

  15. WanderLG commented on Sep 10, 2019

    @WanderLG

    But yes, there may be a way to work around this in the Etherkit SI5351 library without having to touch the ESP32 i2c libraries. I just don't know how to do this. But I'll try, if I can before you, post the result.

    Note: I am Brazilian and do not speak English. I'm using google translator.
    Wander. (PU4WLG)

  16. 13 remaining items

  17. vk4hat commented on Dec 24, 2020

    @vk4hat

    Hi Rob, in stead of moving to an other library, I changed the i2c part of etherkit. I also changed it to support multiple si5351's. You can get the code if you like on my github page. paulh002 By the way, I could not give comments to your blog, I think there is some issue 73 Paul Op do 24 dec. 2020 06:11 schreef vk4hat notifications@github.com:
    …
    The problem is something within the etherkit library, I never used to have this problem until i moved to platformio. My arduino implementation of ESP32 was old, very old and it worked flawlessly. But on anything new it fails. I have gone hunting for the issue but cant find it. I have other libraries for SI5351 that do work with ESP32 the one from adafruit and there is one by Pavel Milanes that works flawlessly, so my guess is that there is something not right in how the etherkit library is talking over I2C. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#66 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIOBYUFVQYAYEJ6JN3LMCATSWLEQFANCNFSM4GFIYFOQ .

    Thanks Paul, I will grab your code later and see if I can manage to make the quadrature SI5351 work with it. I did fix the comments on my blog, seems Jetpack changed settings and made people login with facebook or google to comment. That might explain why i have not had comments in a long time and no one let me know LOL

    Cheers Mate

  18. Hi-Tone commented on Jan 25, 2021

    @Hi-Tone

    I have a similar issue with this library (and all others who've contributed) and the ESP32. I've tried the Si5351_Cal_With_Alternate_I2C sketch by WA2FZW and I get an "Si5351 is online", however no frequency output.
    I've tried the Adafruit library and that works out of the box, however it not very beneficial, so I am eager to get this one working.

    I've looked into the I2C issues, however I've tried with all the sketches by various people commenting on this topic, and none of them gets me any output. In any case, working with ESP32, I always have to use:
    #define SDA 23
    #define SCL 22

    If I don't use these, together with Wire.begin(SDA, SCL); my i2c never works with any module or sensor.

    My setup is PlatformIO on VScode, NodeMCU-32s and an Adafruit module (I probably would have bought the Etherkit if I was aware of it before buying the Adafruit SI5351). I am measuring my output on a Agilent 53131A.

  19. vk4hat commented on Jan 26, 2021

    @vk4hat

    I have a similar issue with this library (and all others who've contributed) and the ESP32. I've tried the Si5351_Cal_With_Alternate_I2C sketch by WA2FZW and I get an "Si5351 is online", however no frequency output.
    I've tried the Adafruit library and that works out of the box, however it not very beneficial, so I am eager to get this one working.

    I've looked into the I2C issues, however I've tried with all the sketches by various people commenting on this topic, and none of them gets me any output. In any case, working with ESP32, I always have to use:
    #define SDA 23
    #define SCL 22

    If I don't use these, together with Wire.begin(SDA, SCL); my i2c never works with any module or sensor.

    My setup is PlatformIO on VScode, NodeMCU-32s and an Adafruit module (I probably would have bought the Etherkit if I was aware of it before buying the Adafruit SI5351). I am measuring my output on a Agilent 53131A.

    https://github.com/pavelmc/Si5351mcu This library does work with ESP32 out of the box. Its limited to 2 clocks only though. There is also a Russian\Ukrainian library that works as well, but dont have a link handy.

  20. Hi-Tone commented on Jan 26, 2021

    @Hi-Tone

    I got it somewhat working now. I used the library by pavelmc and by setting the standard I2C pins for ESP32 (SCL - pin 22; SDA - pin 21). I used the simple example, however at 60 MHz I get close to 55 MHz output. At 112.5 MHz, I get 104 MHz output. Is it normal for it to deviate that much?
    With the Adafruit library, I am able to get get 112.5 MHz by setting the 112.5MHz output.

    PS: I tried afterwards the library from both Etherkit and WA2FZW. Both not working.

    Update: I tried with an Arduino Uno I had laying around. I got it to work with the Etherkit example right away. Now I really would like it to work with the ESP32, because this proof that I can get the library working.

    @NT7S If your still doing some testing on this library and are in need of testers, please let me know, I'm here to help.

  21. vk4hat commented on Jan 26, 2021

    @vk4hat

    I got it somewhat working now. I used the library by pavelmc and by setting the standard I2C pins for ESP32 (SCL - pin 22; SDA - pin 21). I used the simple example, however at 60 MHz I get close to 55 MHz output. At 112.5 MHz, I get 104 MHz output. Is it normal for it to deviate that much?
    With the Adafruit library, I am able to get get 112.5 MHz by setting the 112.5MHz output.

    Reset the PPL's

  22. Hi-Tone commented on Jan 27, 2021

    @Hi-Tone

    I assume you mean the PLL? In the library you attached by pavelmc, this is already done as standard.

  23. vk4hat commented on Jan 27, 2021

    @vk4hat

    I assume you mean the PLL? In the library you attached by pavelmc, this is already done as standard.

    If you are making a jump of more than a meg or so, it needs to be called again. I do not have any problem with it being inaccurate.

  24. kd2eat commented on Feb 15, 2021

    @kd2eat

    Just an update on this problem. I tested the Etherkit library again with Espressif's Arduino esp32-1.0.5-rc6 build. Still no joy. The behavior seems about the same as with the 1.0.4 release. I was hoping the vendor lib's might fix it, since there have been updates in the wire code. Apparently not. :-(

    I'm having a few minor issues with Paul's "bit-banging" library. It doesn't seem to play well if I'm using I2C via the Wire library on the same pins. I either have to figure out why, or redesign my riser board to bit-bang on a different pair of GPIO ports for using the Si5351. Paul's also doesn't seem to disable transmit when I call:
    si5351.output_enable(OUTPUT_CLOCK, SI5351DISABLE);
    I may dig into that and see if I can sort it out. That's actually more problematic than the Wire() conflict at the moment.

    Anyway, I thought I'd share an update.
    Mike

  25. paulh002 commented on Feb 15, 2021

    @paulh002

    Sharing the same ports with Wire can indeed be a problem, in my project I only have si5351's attached. The output_enable function I did not use. But i will check. It is a pity that the wire lib does not work, I tried to look into it did some analysis with my scope that can decode i2c but no luck. Cost too much time to debug this issue.

  26. kd2eat commented on Feb 15, 2021

    @kd2eat

    Thanks Paul, I read through the code a bit last night and everything looked about right, though I didn't do any serious debugging. I was hoping it was something as simple as you hadn't implemented the routine and just stubbed it in.

    I'll try to hook up my logic analyzer in the next few days to get a capture of the behavior. If you want to take this offline, since it's not really related to the etherkit library, feel free to contact me at kd2eat at gmail.com. Thanks for writing back :-)

  27. paulh002 commented on Jun 18, 2021

    @paulh002

    That would be great, will test it

  28. paulh002 commented on Nov 20, 2021

    @paulh002

    Here's what works for me:

    In the SI5351::si5351_read method

    Change Wire.requestFrom(i2c_bus_addr, (uint8_t)1, (uint8_t)false);

    to Wire.requestFrom(i2c_bus_addr, (uint8_t)1);//, (uint8_t)false);

    Arduino 1.8.13

    ESP32 package 1.0.6

    Windows 10

    Regards,

    Dave

    I have tested this solution and it works good.
    Thanks

  29. PE2BS commented on Nov 9, 2022

    @PE2BS

    Thanks, works well. It was the solution for the problem with the ESP32 and the Si5351 board.
    73
    Ruud / PE2BS

  30. vk4hat commented on Nov 9, 2022

    @vk4hat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions