After initialization, I2C is always busy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-13 2:21 AM
I am using the Nucelo board and communicating with an IKS02A1 trough I2C2 using PINs PA11 and PA12 with the following configuration:
I have initializaed the I2C folowing the guidelines in "stm32wlxx_hal_i2c.c", and when I use "HAL_I2C_IsDeviceReady()" function I always get BUSY_ERROR.
The initialization is done through:
DMA and interrups are both initialized even though I am not still usign them. I tried not initializing them them and the results are the same.
If I do not check "HAL_I2C_IsDeviceReady()" function and I directly use "HAL_I2C_Mem_Read()" or "HAL_I2C_Mem_Write()", I get ERROR_PERIPH_FAILURE.
I can not fix this and I am going crazy please help!
- Labels:
-
I2C
-
STM32WL series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-13 5:08 AM
What do the levels / signals look like on SDA and SCL ?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-14 4:00 AM
Problem fixed finally, thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-19 7:12 AM
Hi @AZube.2​ ,
Glad you manage to fix your issue.
Can you share your solution in case someone else encounter the same issue ?
Thank you
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-19 7:21 AM
Hi @Louis AUDOLY​ ,
I am sorry to say that I did not strictly find a solution for the issue. What I did was to start a new project and trust the CubeMX initialization code (which was the same thing I did when I got the issue). For some reason that is unknown to me, this time the issue never appeared.
Hope this helps to someone :)
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-19 5:38 PM
It could be a io vs i2c init sequencd and timing marginality. If it happened once, it could reappear when compile option changes or else. Get ready, implement a sw bit bang gpio function that generates 9 stop bits. Use it if sda is low or busy is set prior starting bus transaction to flush the bus.
Typically happens when debugging, reading data from slave and reset the mcu [and not the slave] by restarting the code.
Real application test would be esd gun near pcb i2c lines. Old test was use a drilling machine near the board.... rugged sw ? Knowledge makes the difference in the long term....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-20 12:00 AM
Sounds interesting, I would like to try it @S.Ma​ . Do you know any example I could use?
