Skip to content
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

K64F Fails to read I2C EEPROM #17

Closed
maclobdell opened this issue Dec 9, 2016 · 7 comments
Closed

K64F Fails to read I2C EEPROM #17

maclobdell opened this issue Dec 9, 2016 · 7 comments

Comments

@maclobdell
Copy link
Contributor

maclobdell commented Dec 9, 2016

After fixing the other unrelated issue: #16

The I2C EEPROM tests fail for K64F.

+--------------+---------------+---------------+------------------------------------+--------+--------+--------+--------------------+
| target       | platform_name | test suite    | test case                          | passed | failed | result | elapsed_time (sec) |
+--------------+---------------+---------------+------------------------------------+--------+--------+--------+--------------------+
| K64F-GCC_ARM | K64F          | tests-api-i2c | I2C -  EEProm WR 10  Bytes         | 0      | 3      | FAIL   | 0.5                |
| K64F-GCC_ARM | K64F          | tests-api-i2c | I2C -  EEProm WR 100 Bytes         | 0      | 1      | FAIL   | 0.8                |
| K64F-GCC_ARM | K64F          | tests-api-i2c | I2C -  EEProm WR 2 Bytes           | 0      | 3      | FAIL   | 0.47               |
| K64F-GCC_ARM | K64F          | tests-api-i2c | I2C -  EEProm WR Single Byte       | 0      | 2      | FAIL   | 0.31               |
| K64F-GCC_ARM | K64F          | tests-api-i2c | I2C -  Instantiation of I2C Object | 1      | 0      | OK     | 0.06               |
| K64F-GCC_ARM | K64F          | tests-api-i2c | I2C -  LM75B Temperature Read      | 1      | 0      | OK     | 0.12               |
+--------------+---------------+---------------+------------------------------------+--------+--------+--------+--------------------+
mbedgt: test case results: 4 FAIL / 2 OK

After the I2CEeprom library does a write to the EEPROM, it does a sequence of 0-byte writes every 1ms until it gets a ACK indicating the write finished on the EEPROM and it is ready to read. After it gets an Ack, then the read should happen.

But on the K64F the read doesn’t happen.

It seems that, if a 0-byte write cycle results in an Ack, there is no stop condition afterwards, and the next write cycle that is requested results in Bus Busy error.

I think that, for compatibility, the K64F hal implementation/driver needs to ensure that 0-byte write sequences (or all write sequences that are finished?), are followed by stop condition to release the bus.

@mmahadevan108

@mmahadevan108
Copy link
Collaborator

Where is this EEPROM chip located. I could not find it on the application shield board shown below:
https://developer.mbed.org/cookbook/mbed-application-shield

@mmahadevan108
Copy link
Collaborator

I realized I don't have a test-shield board, can you please try the attached patch.
0001-KSDK-I2C-Handle-0-byte-write.zip

@BlackstoneEngineering
Copy link
Contributor

@mmahadevan108 , if you're a partner please reach out to your partner enablement contact and they will send you a couple boards)

@mmahadevan108
Copy link
Collaborator

Thanks, I have contacted them.

@maclobdell
Copy link
Contributor Author

@mmahadevan108 I tried the patch, seems like an additional tweak is needed. With the patch the start condition isn't followed up by anything. Please give it a try on the test shield and let us know.
image

@0xc0170
Copy link
Collaborator

0xc0170 commented Dec 30, 2016

@maclobdell If you can retest latest master , there's a fix , I got all OK for i2c tests, using K64F target

@maclobdell
Copy link
Contributor Author

maclobdell commented Jan 10, 2017

I tested it with the master branch and confirm that everything passes now. @mmahadevan108 Thanks for the fix!

+--------------+---------------+---------------+------------------------------------+--------+--------+--------+--------------------+
| target       | platform_name | test suite    | test case                          | passed | failed | result | elapsed_time (sec) |
+--------------+---------------+---------------+------------------------------------+--------+--------+--------+--------------------+
| K64F-GCC_ARM | K64F          | tests-api-i2c | I2C -  EEProm WR 10  Bytes         | 1      | 0      | OK     | 0.32               |
| K64F-GCC_ARM | K64F          | tests-api-i2c | I2C -  EEProm WR 100 Bytes         | 1      | 0      | OK     | 0.73               |
| K64F-GCC_ARM | K64F          | tests-api-i2c | I2C -  EEProm WR 2 Bytes           | 1      | 0      | OK     | 0.29               |
| K64F-GCC_ARM | K64F          | tests-api-i2c | I2C -  EEProm WR Single Byte       | 1      | 0      | OK     | 0.16               |
| K64F-GCC_ARM | K64F          | tests-api-i2c | I2C -  Instantiation of I2C Object | 1      | 0      | OK     | 0.06               |
| K64F-GCC_ARM | K64F          | tests-api-i2c | I2C -  LM75B Temperature Read      | 1      | 0      | OK     | 0.12               |
+--------------+---------------+---------------+------------------------------------+--------+--------+--------+--------------------+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants