-
Notifications
You must be signed in to change notification settings - Fork 3k
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
STM32 I2C block writes and block read bugs #4214
Comments
@Willem23 thanks for reporting the issue and sorry for the inconvenience. |
Note that I made a try with another target (F334R8) and it does not show the problem |
As reported in issue ARMmbed#4214, there are seen issues seen first on NUCLEO_F103RB in case of successive Reads of 1 byte at a time. This issue is due to a wrong state management in the end of read sequence. Also F1 i2c driver was not fully aligned to others, which is updated here.
@Willem23 Hey - sorry for the delay |
ST_INTERNAL_REF 33669 |
As reported in issue ARMmbed#4214, there are seen issues seen first on NUCLEO_F103RB in case of successive Reads of 1 byte at a time. This issue is due to a wrong state management in the end of read sequence. Also F1 i2c driver was not fully aligned to others, which is updated here.
As reported in issue #4214, there are seen issues seen first on NUCLEO_F103RB in case of successive Reads of 1 byte at a time. This issue is due to a wrong state management in the end of read sequence. Also F1 i2c driver was not fully aligned to others, which is updated here.
Description
#abc
Bug
Target
STM32 F103 and probably others
Expected behavior
I2C should work properly.
Actual behavior
I2C write fails on first Write after reset, Read fails on every other Read.
Ack does correctly report status and returns 1 when the slave is not present.
Steps to reproduce
#include "mbed.h"
#define PCF8574_ADDRESS 0x40
int ack;
uint8_t data = 0xAA;
I2C i2c(I2C_SDA,I2C_SCL);
DigitalOut led1(LED1);
Serial pc(USBTX, USBRX);
int main() {
pc.baud(9600);
pc.printf("\n\r");
pc.printf("Start I2C test\n\r");
led1 = 0;
wait(0.5);
led1 = 1;
wait(0.5);
led1 = 0;
#if(0)
// Set Port Expander
while(1) {
wait(1.0);
}
#else
// Get Port Expander
while(1) {
wait(1.0);
}
#endif
}
Result for Reads from PCF8574 using mbed rev 133 and higher:
Start I2C test
Read Ack = 0
Read Ack = 1
Read Error
Read Ack = 0
Read Ack = 1
Read Error
Read Ack = 0
Read Ack = 1
Read Error
Read Ack = 0
Read Ack = 1
Read Error
Result for Writes to PCF8574 using mbed rev 140:
Start I2C test
Write Ack = 1
Write Error
Write Ack = 0
Write Ack = 0
Write Ack = 0
Write Ack = 0
Write Ack = 0
Write Ack = 0
Write Ack = 0
The I2C lib worked as expected for mbed 132. Revision 133 starts failing for Read. Revision 140 is broken for Write. Have not yet tested at which revision Write starts to break, Read and Write seem to start having issues at different revisions..
Recommend
Inconsistent behavior should be fixed. Some component Libs now fail because the first Write after reset does not succeed. Some libs fail because they check Ack errors and/or get wrong read values.
See https://developer.mbed.org/questions/77809/Anyone-got-the-STM32F103RB-working-with-/
The text was updated successfully, but these errors were encountered: