Error writing to I2C bus
-
@teastain Thanks for the clarification!
Yeah, I understood that these sensors likely use different communication protocols. Also, I attempted to use a different GPIO pin for the DS18B20, and it worked perfectly for me.
Now, my only concern is my second script. Here, I'm using different ports for the ENV sensor and AtomPoE base in AtomS3. However, when I connect with the MQTT client, it breaks the ENV sensor's communication. Any advice is greatly appreciated!
-
Have you check out my example in the Project zone as the MQTT has to be in a specific place in the code.
-
I appreciate your input! Could you please share the link or specify the topic name related to the example you mentioned in the Project zone? I'm interested in diving deeper.
-
@surya https://uiflow2.m5stack.com/?pkey=c1c7d2ca888b497aab31505e1091adc6
Another member on the forum was having difficulties so I shared the code I use for sending data over MQTT to my private server hosted on a CM4Stack.
-
Thank you so much for sharing your work!
Earlier, I successfully sent data over MQTT to AWS IoT Core in UIFlow2. However, in UIFlow2, I couldn't find a way to establish a (DHCP) Ethernet connection to AtomS3 using AtomPoE Base. That's why I decide to develop the code using PlatformIO. Do you have any reference Micropython script for an Ethernet connection?
-
Alas no as I don’t have one of those
-
-
Hello @felmue
I have already attempted a short delay, but unfortunately, that doesn't work for me. As for periodic code execution, I will give it a try.
Thanks
Surya -
Oops, I forgot to share the error message. Here it is
-
Hello @Surya
after long hours of searching and debugging I found the reason why I2C would fail. It starts to fail as soon as SSL is invoked. The SSL library uses an analog GPIO as input for its random seed. And in your code you used GPIO2 which is one of M5AtomS3 Groove GPIOs.
So to get rid of the I2C error try changing the GPIO used for random seed to GPIO10.
//SSLClient ethClientSSL(ethClient, TAs, (size_t)TAs_NUM, 2); SSLClient ethClientSSL(ethClient, TAs, (size_t)TAs_NUM, GPIO_NUM_10);
Thanks
Felix -
@felmue Laughed out loud, in brotherhood.
Great job! -
Hello @felmue
I implemented the change using GPIO10 for the random seed, and the I2C issue seems to be resolved. Your help is greatly appreciated!
Thank you for your fix!
Surya