2022-11-18 06:00 AM
we have been trying to get the I2C up on both the controller and no responses from anyone the cubeMx issue if I2C is really a problem..Kindly respond as we are trying to get I2C up ..
requesting the experience forum experts to respond.
Thanks
Ravi
Solved! Go to Solution.
2022-11-25 07:46 AM
from the ds you posted, i cannot say, what to do better.
now lets stop to play blind cow . 🙂
so look, what drivers exist and learn/copy from them :
here sensirion gives driver for their sensor:
https://github.com/Sensirion/embedded-i2c-scd30
and many others...(also in c++, rust etc.)
https://github.com/paulvha/scd30
https://github.com/sparkfun/SparkFun_SCD30_Arduino_Library
https://github.com/RequestForCoffee/scd30
https://github.com/adafruit/Adafruit_SCD30
https://github.com/Seeed-Studio/Seeed_SCD30
https://github.com/watterott/CO2-Ampel
https://github.com/sinewave-ee/scd30-rs
the driver by sensirion should show you, what to do.
2022-11-18 06:01 AM
2022-11-21 01:41 AM
Hi all,
Any update on this ...we are trying it out and not getting any response..is it more to do with STMCube Mx generating I2C for I2C1 or Is there any solution with I2C2 .??...
if there is any bit banging code for this where we can try this out by making the I2C pins GPIO out...
All these possibilities shall be tried out ...Kindly let us know the approach as we are stuck at a point where STM32F103C6 or C8 needed to be used ....will be of great help if some one can respond .
thanks
Ravi
2022-11-21 02:19 AM
Hello @RShiv.1
Did you tried to run the I2C example within STM32CubeF1 MCU package?
\Projects\STM32F103RB-Nucleo\Examples\I2C\
I advise you to review this article: STM32 I2C does not work and the I2C limitation in the STM32F103xC/D/E errata sheet.
Then, please have a look at this post and AN4655 which describes the steps to do I2C by SW.
Hope this helps you!
When your question is answered, please close this topic by choosing Select as Best.
Imen
2022-11-21 02:23 AM
Hi @RShiv.1,
I added a couple of topics for: "STM32 MCUs" and "I2C" developers to give a broader audience of this post.
Imen
2022-11-21 03:08 AM
Hi ,
As suggested and also going through the other post I have done the bitbanging approach for the I2C.
Here also I am seeing I2C_Transmit not passsing through...kindly let me know where I can change in the code for I2C_Transmit...it just hangs after the first I2Cwrite...I am not seeing any data in the SDA line at all...Let me know if you need more information.
This is for connecting Sensor SCD30 with the STM32F103C6
2022-11-21 03:11 AM
I am almost trying to get the SDC as follows
This is a sample code using adruino with libraries
Python code
from scd30_i2c import SCD30
scd30 = SCD30()
scd30.set_measurement_interval(2) //address is 0x4600
scd30.start_periodic_measurement() // 0x0010
time.sleep(2)
while True:
if scd30.get_data_ready(): 0x0202
m = scd30.read_measurement() // 0x0300
if m is not None:
print(f"CO2: {m[0]:.2f}ppm, temp: {m[1]:.2f}'C, rh: {m[2]:.2f}%")
time.sleep(2)
else:
time.sleep(0.2)
2022-11-21 03:12 AM
2022-11-21 03:14 AM
2022-11-21 03:27 AM
printf("B4 I2C \n");
ret = I2C_transmit(SLAVE_ADDR, _txBuffer, 4); //I2C hangs here and not seeing the data go through the line
printf("After I2C \n");