-
Notifications
You must be signed in to change notification settings - Fork 986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I2C SDA line stuck low after requestFrom with more than 1 byte - No I2C Stop sequence generated #2064
Comments
Hi @yec23 Note: I guess you have PU resistors on each I2C lines? |
Hi and thank you for your answer. Do you expect the Wire library example "master_reader_writer" ? Tell me. I don't have external resistors. Setup proved to be fine when compiled with RC so I concluded I did not have to investigate further this possibility. Isn’t it a good enough prove that the issue is not coming from that area? Thanks again for your help. |
Not necessarily as RC core could implement workaround and also probably set pins with PU. So please ensure to have PU on each I2C lines. |
Can I provide you with GPIOB->CRH: 0x4444DD44, |
Is it for RC or this core? |
You can add this to your sketch to enable internal PU (https://github.com/stm32duino/Arduino_Core_STM32/wiki/Custom-definitions#custom-pinmap-array):
|
Hi, I've added the two variables declaration. Result is the same: SDA low after requestFrom call. |
I have no more insight. Or maybe related to stretch feature anyway as I can not reproduce I could not help more. /Edit: |
1: Put 4.7K resitors in place of 2K Could you clarify following point : when in Master Receiver mode, STM32F103xx RM008 describes two methods |
Just the other day I updated the core STMicroelectronics v.2.6.0, and the |
I got an MPU 6050 and test your code and see no issue. |
If you have data in the fields of the magnetometer, then you have not |
I told 6050 not 6500... |
I overlooked ... I didn’t think at all that there was a 6050. |
@fpistm thank you for your additional tests and feedback. Sorry for the long answer. I performed same tests and in addition IMU_Zero.ino example from MPU6050 library. I faced the same issue with the Core. I also did the tests with a new blue pill and a new MPU-6050 (ITG-MPU). I then decided to open the code and have a look … HAL_I2C_Master_Receive implements scenarios depending on number of variables to read
Long story short, I now have a HAL_I2C_Master_Receive_Method1 function that works whith my Arduino test code and IMU_Zero example also. In addition, I performed the same tests with a compass (HMC5883) and a barometer (MS5611): both worked well with the Core ! (and the HAL_I2C_Master_Receive_Method1) … I would then conclude my MPU-6050 (ITG-MPU) is a bit “sensitive” but still HAL_I2C_Master_Receive function code is unclear to me. Thank you again for your help on that matter |
@yec23 |
"Are you sure you have a legacy STM32F103? " As I don't know how to answer that one, I can propose a photo but I guess that won't close the point of having a legacy. As wrote at the beginning, all works fine with RC framework, I can reproduce it on a different "blue pill" and MPU 6050, having HAL_I2C_Master_Receive following datasheet method1 makes it work. So, it is telling me there is a possibility it is coming from the Core but as you cannot reproduce it and I have seen other sensors working Ok, it makes it weird. For now, I propose we close on this and see if the community reopens it. Again, a big thank you for your time. |
Describe the bug
I2C SDA line stuck low after requestFrom with more than 1 byte. Master seems to not generate the I2C Stop sequence.
Same result in normal or fast mode.
Working ok when requesting 1 byte
Same hardware and code run well when compiled with Roger Clark environment on Arduino IDE 1.8 Linux.
To Reproduce
CR1: 1
CR2: 0x24
SR1: 0
SR2: 0
After requestFrom() call:
CR1: 0xA01 => POS and STOP set
CR2: 0x424 => ITBUFEN set
SR1: 0x240 => ARLO and RxNE set
SR2: 2 => BUSY set
Steps to reproduce the behaviour:
see code attached
Sourcecode.txt
Screenshots
With Arduino Core STM32: no I2C STOP generated
With Roger Clark, I2C STOP generated
Desktop (please complete the following information):
Board (please complete the following information):
Additional context
First version of the project was implemented with Roger Clarck STM32 environment. Project is being migrated to Arduino Core STM32 before implementing new features.
The text was updated successfully, but these errors were encountered: