Replies: 3 comments 3 replies
-
I'm pretty sure that both the RP2040 and SAMD21 port use hardware I2C when requested so. When set to 400kHz, I see 380kHz at the SAMD21 and about 250kHz at the RP2040 for For RP2040 one must look into the details, which most likely are part of the RP2040 SDK. But it seems that the granularity of frequencies are limited. When requesting 400kHz I get 250kHz, when requesting 600kHz and up, I get 500kHz, when requesting 200kHz, I get 165kHz. Looks like a frequency of 500k can only be divided by integers. But interestingly, when setting up SoftI2C I get 500kHz when 400kHz are requested. Note: According to the documentation, the value |
Beta Was this translation helpful? Give feedback.
-
@robert-hh I am going to close this issue as I will just use my SAMD21 board for precision I2C work. Thank you again for your time. |
Beta Was this translation helpful? Give feedback.
-
@robert-hh I am wanting to test an IC that my company is making for a customer. It is specified for both 400kHz and 1MHz operation. My current I2C master (FT4222) has a lot of latency between bus cycles and I wanted to perform many random bus cycles as quickly as possible to see if I ever missed a NACK. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have Pico and Xiao boards for RP2040 and a Xiao board for SAMD21. I am trying to get hardware I2C working at 400kHz and 1MHz, but the SCL frequency is much slower than expected (half the requested frequency in some cases). I suspect that software I2C is being used, as I see the same SCL frequencies on all 3 boards (even across different MCUs).
Here is my Pico instance:
(Bus 1 is for pins 2 and 3)
https://learn.adafruit.com/assets/99339
Here is my Xiao RP2040 instance:
(using Pico uf2 file and mapping the pins with the schematic, pins 6 and 7 are Bus 1)
https://files.seeedstudio.com/wiki/XIAO-RP2040/res/Seeed-Studio-XIAO-RP2040-v1.3.pdf
Here is my Xiao SAMD21 instance:
(pins 8 and 9 are for Bus 0)
https://wiki.seeedstudio.com/XIAO-SAMD21-MicroPython/#software-development
On all three instances I measure a SCL frequency of 200kHz when requesting 400kHz. When I request 100kHz I see 82kHz on all three instances. To get close to 400kHz I have to request 800kHz on all three instances. When I use mem32 to read the peripheral hardware registers I see expected values for 400kHz settings, but I always measure 200kHz. I have used both my oscilloscope and logic analyzer and I measure the same frequencies (I don't think this is an instrument issue). I can measure expected SPI frequencies using the same instruments (no issues there).
I suspect that hardware peripheral writes are being done, but at the pin level software I2C is being used. I was under the impression that software I2C would only be used if machine.SoftI2C is called.
Any ideas about what could be happening would be appreciated. I am using MicroPython version 1.22.2 on all three boards. I have 1k ohm pull-ups to 3.3V on all three boards with no slaves attached.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions