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-21 10:30 PM
*code is not entering into these loops at all..that is why I2C is failing..that means is the address not specified properly??..or Need to enable something else...???
2022-11-21 10:34 PM
2022-11-22 12:45 AM
so on clk line nothing happens at all? then adress right or wrong is same, because no adress sent at all.
so problem is something else - hardware ok ? pullups ? no short ? + (i always switch on port pin pullups also + set output speed low , to reduce reflections).
2022-11-22 01:15 AM
Hi,
Thanks for all your suggestion...I2C_Device_ready worked for STM32F103C8 (blue board) to which we connected the sensiron sensor. In our custom board we have used STM32F103C6...now we will change to C8..should be fine ??...
Thank you very much for all your suggestions..atleast HAL_ISdevice_ready is working.
regards
Ravi
2022-11-22 02:03 AM
if F103C8 working and need not much ram/flash, xxC6 should be ok also, but you have to do make separate project and compile for C6 . (has not same ram area).
I2C can have many members on one bus line, as long as they have different adress, to talk to them.
and sda/scl lines should not be more than 50cm long , because you catch more and more errors by external EMV spikes coming to the lines .
2022-11-22 02:30 AM
Hi ,
Thanks for your reply...as suggested I had created a separate project for C6 also in our custom board .
But this is where I2C is not working...but I read one more post where guys who tried on C6 mentioned that below missing piece will work for C6..but my cubeMx does not generate stm32f1xx_hal_msp.c
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
This code itself is not seen anywhere..any idea on this
Let me know if you have come across this so that we can change and move on...
regards
Ravi
2022-11-22 03:24 AM
I2C is now ...on pins : PB6+7 or PB8+9 ?
+
if some code is missing - just for test, copy and put it in by "hand" . :)
2022-11-22 03:53 AM
What is the value of the pullUp resistors for both lines? Are both lines at H level before comunication? What voltage is this level?
2022-11-22 03:59 AM
come on...read about I2C first - at least the basics.
yes, both hi , 3.3V if chips running on 3v3. and typical 4k7 pullups on every line.
read:
https://www.nxp.com/docs/en/application-note/AN10216.pdf
2022-11-22 04:46 AM
Hi,
Yes I2C is now on PB6 and PB7...as mentuioned by you I did try adding the above code..but did not see I2C going through..anyways will try someother way..GPIO struct is not defined in HA_init()..let me see
thanks
Ravi