Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Nov 8, 2018

Description

This PR contains reference implementations of the I2C HAL RFC changes for the FRDM-K64F and NUCLEO_F070RB boards.

Tasks

  • K64F Sync
  • STM32 Sync
  • STM32 Async
  • Driver API Sync
  • Driver API Async

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[X] Breaking change

@cmonr
Copy link
Contributor

cmonr commented Nov 8, 2018

@scartmell-arm Something about this PR's comit history and files changed does not look right. Could you double check?

@cmonr
Copy link
Contributor

cmonr commented Nov 15, 2018

@mbed-os-maintainers @ARMmbed/mbed-os-hal Readt for review when able.

Copy link
Contributor

@maciejbocianski maciejbocianski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have additional question to all HAL and DRIVERS API functions.
Whenever we passes device address it should be shifted left by 1 bit and filled by 1 or 0 (or LSB bit is ignored) depending of situation, it's valid for both 7bit and 10bit addressing?

{
int addr = (address & 0xFF) | 1;
i2c_slave_address(&_i2c, 0, addr, 0);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line:
int addr = (address & 0xFF) | 1;
breaks 10bit addressing

@cmonr
Copy link
Contributor

cmonr commented Dec 14, 2018

@scartmell-arm You have questions/comments waiting for your attention.

Copy link
Contributor

@LMESTM LMESTM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments or questions ...

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 16, 2019

@scartmell-arm Is it time to update this one and make sure reviewers find time to review?

@ghost
Copy link
Author

ghost commented Jan 16, 2019

@scartmell-arm Is it time to update this one and make sure reviewers find time to review?

There were a few outstanding concerns I was working through, I'll push a resolution to all of them soon.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 13, 2019

@scartmell-arm Who should review , anyone from @ARMmbed/mbed-os-hal or @maciejbocianski is sufficient (still some comments not addressed).

How can we progress i2c feature branch?

@cmonr
Copy link
Contributor

cmonr commented Feb 20, 2019

@scartmell-arm @ARMmbed/mbed-os-hal How can we progress this PR?

@cmonr
Copy link
Contributor

cmonr commented Feb 26, 2019

@ARMmbed/mbed-os-hal What do we need to move this forward? Or is this still being worked on?
This will soon be closed due to lack of communication.

@bulislaw @donatieng

@donatieng
Copy link
Contributor

@maciejbocianski could you have another look at this please?

Copy link
Contributor

@donatieng donatieng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing implementation of async in the driver - @scartmell-arm @maciejbocianski would you be able to pick this up so that we get this merged soon?

#if DEVICE_I2C_ASYNCH

int I2C::transfer(int address, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t &callback, int event, bool repeated)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that shouldn't be empty!

}
}

int i2c_byte_read(i2c_t *obj, int last)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scartmell-arm
i2c_byte_read and i2c_byte_write should be removed since it was removed from API

@maciejbocianski
Copy link
Contributor

After last fixes tests were successful for both reference implementations K64F and NUCLEO_F070RB

Following limitations were made:

  • 10bit addressing was disabled for both targets
  • slave mode was disabled due to some implementation problems for k64f

CI i2c test (#9564)

| target                | platform_name | test suite         | test case                                  | passed | failed | result | elapsed_time (sec) |
|-----------------------|---------------|--------------------|--------------------------------------------|--------|--------|--------|--------------------|
| NUCLEO_F070RB-GCC_ARM | NUCLEO_F070RB | tests-mbed_hal-i2c | i2c - enable/disable clock stretching test | 1      | 0      | OK     | 0.08               |
| NUCLEO_F070RB-GCC_ARM | NUCLEO_F070RB | tests-mbed_hal-i2c | i2c - get capabilities test                | 1      | 0      | OK     | 0.06               |
| NUCLEO_F070RB-GCC_ARM | NUCLEO_F070RB | tests-mbed_hal-i2c | i2c - init/free test                       | 1      | 0      | OK     | 0.04               |
| NUCLEO_F070RB-GCC_ARM | NUCLEO_F070RB | tests-mbed_hal-i2c | i2c - master read/write test               | 1      | 0      | OK     | 0.06               |
| NUCLEO_F070RB-GCC_ARM | NUCLEO_F070RB | tests-mbed_hal-i2c | i2c - set frequency test                   | 1      | 0      | OK     | 0.06               |
| NUCLEO_F070RB-GCC_ARM | NUCLEO_F070RB | tests-mbed_hal-i2c | i2c - setting slave address test           | 1      | 0      | OK     | 0.06               |
| NUCLEO_F070RB-GCC_ARM | NUCLEO_F070RB | tests-mbed_hal-i2c | i2c - slave state test                     | 1      | 0      | OK     | 0.06               |
| NUCLEO_F070RB-GCC_ARM | NUCLEO_F070RB | tests-mbed_hal-i2c | i2c - start signal test                    | 1      | 0      | OK     | 0.04               |
| NUCLEO_F070RB-GCC_ARM | NUCLEO_F070RB | tests-mbed_hal-i2c | i2c - stop signal test                     | 1      | 0      | OK     | 0.04               |
| NUCLEO_F070RB-GCC_ARM | NUCLEO_F070RB | tests-mbed_hal-i2c | i2c - transfer async test                  | 1      | 0      | OK     | 3.05               |


| target       | platform_name | test suite         | test case                    | passed | failed | result | elapsed_time (sec) |
|--------------|---------------|--------------------|------------------------------|--------|--------|--------|--------------------|
| K64F-GCC_ARM | K64F          | tests-mbed_hal-i2c | i2c - get capabilities test  | 1      | 0      | OK     | 0.06               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal-i2c | i2c - init/free test         | 1      | 0      | OK     | 0.06               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal-i2c | i2c - master read/write test | 1      | 0      | OK     | 0.06               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal-i2c | i2c - set frequency test     | 1      | 0      | OK     | 0.04               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal-i2c | i2c - start signal test      | 1      | 0      | OK     | 0.06               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal-i2c | i2c - stop signal test       | 1      | 0      | OK     | 0.06               |

I2C communication test (#9573)

master(NUCLEO_F070RB) - slave(NUCLEO_F070RB)
+--------------------------------------------------------------+---------+-------------+-------------+---------------+----------+
| Testcase                                                     | Verdict | Fail Reason | Skip Reason |   platforms   | duration |
+--------------------------------------------------------------+---------+-------------+-------------+---------------+----------+
| I2C_COM_MASTER-SLAVE_ASYNC_TRANSFER_1000B_MAX_FREQUENCY      |   pass  |             |             | NUCLEO_F070RB |  15.294  |
| I2C_COM_MASTER-SLAVE_ASYNC_TRANSFER_1025B_MIN_FREQUENCY      |   pass  |             |             | NUCLEO_F070RB |  3.516   |
| I2C_COM_MASTER-SLAVE_ASYNC_TRANSFER_10B_MAX_FREQUENCY        |   pass  |             |             | NUCLEO_F070RB |  2.009   |
| I2C_COM_MASTER-SLAVE_ASYNC_TRANSFER_10B_MIN_FREQUENCY        |   pass  |             |             | NUCLEO_F070RB |  2.136   |
| I2C_COM_MASTER-SLAVE_ASYNC_TRANSFER_1B_MAX_FREQUENCY         |   pass  |             |             | NUCLEO_F070RB |  1.959   |
| I2C_COM_MASTER-SLAVE_ASYNC_TRANSFER_1B_MIN_FREQUENCY         |   pass  |             |             | NUCLEO_F070RB |  2.015   |
| I2C_COM_MASTER-SLAVE_ASYNC_WRITE-READ_1025B_MAX_FREQUENCY    |   pass  |             |             | NUCLEO_F070RB |  2.151   |
| I2C_COM_MASTER-SLAVE_ASYNC_WRITE-READ_1025B_MIN_FREQUENCY    |   pass  |             |             | NUCLEO_F070RB |  3.485   |
| I2C_COM_MASTER-SLAVE_ASYNC_WRITE-READ_10B_MAX_FREQUENCY      |   pass  |             |             | NUCLEO_F070RB |  1.961   |
| I2C_COM_MASTER-SLAVE_ASYNC_WRITE-READ_10B_MIN_FREQUENCY      |   pass  |             |             | NUCLEO_F070RB |   1.96   |
| I2C_COM_MASTER-SLAVE_ASYNC_WRITE-READ_1B_MAX_FREQUENCY       |   pass  |             |             | NUCLEO_F070RB |   2.02   |
| I2C_COM_MASTER-SLAVE_ASYNC_WRITE-READ_1B_MIN_FREQUENCY       |   pass  |             |             | NUCLEO_F070RB |   1.97   |
| I2C_COM_MASTER-SLAVE_BLOCKING_WRITE-READ_1025B_MAX_FREQUENCY |   pass  |             |             | NUCLEO_F070RB |  2.271   |
| I2C_COM_MASTER-SLAVE_BLOCKING_WRITE-READ_1025B_MIN_FREQUENCY |   pass  |             |             | NUCLEO_F070RB |  3.491   |
| I2C_COM_MASTER-SLAVE_BLOCKING_WRITE-READ_10B_MAX_FREQUENCY   |   pass  |             |             | NUCLEO_F070RB |  1.961   |
| I2C_COM_MASTER-SLAVE_BLOCKING_WRITE-READ_10B_MIN_FREQUENCY   |   pass  |             |             | NUCLEO_F070RB |  2.036   |
| I2C_COM_MASTER-SLAVE_BLOCKING_WRITE-READ_1B_MAX_FREQUENCY    |   pass  |             |             | NUCLEO_F070RB |   1.95   |
| I2C_COM_MASTER-SLAVE_BLOCKING_WRITE-READ_1B_MIN_FREQUENCY    |   pass  |             |             | NUCLEO_F070RB |  1.912   |
+--------------------------------------------------------------+---------+-------------+-------------+---------------+----------+

master(K64F) - slave(NUCLEO_F070RB)
+--------------------------------------------------------------+---------+-------------+-------------+--------------------+----------+
| Testcase                                                     | Verdict | Fail Reason | Skip Reason |     platforms      | duration |
+--------------------------------------------------------------+---------+-------------+-------------+--------------------+----------+
| I2C_COM_MASTER-SLAVE_BLOCKING_WRITE-READ_1B_MAX_FREQUENCY    |   pass  |             |             | K64F,NUCLEO_F070RB |  4.535   |
| I2C_COM_MASTER-SLAVE_BLOCKING_WRITE-READ_1025B_MIN_FREQUENCY |   pass  |             |             | K64F,NUCLEO_F070RB |  5.889   |
| I2C_COM_MASTER-SLAVE_BLOCKING_WRITE-READ_1025B_MAX_FREQUENCY |   pass  |             |             | K64F,NUCLEO_F070RB |  4.649   |
| I2C_COM_MASTER-SLAVE_BLOCKING_WRITE-READ_1B_MIN_FREQUENCY    |   pass  |             |             | K64F,NUCLEO_F070RB |   4.53   |
| I2C_COM_MASTER-SLAVE_BLOCKING_WRITE-READ_10B_MAX_FREQUENCY   |   pass  |             |             | K64F,NUCLEO_F070RB |  4.515   |
| I2C_COM_MASTER-SLAVE_BLOCKING_WRITE-READ_10B_MIN_FREQUENCY   |   pass  |             |             | K64F,NUCLEO_F070RB |  4.539   |
+--------------------------------------------------------------+---------+-------------+-------------+--------------------+----------+

@maciejbocianski
Copy link
Contributor

maciejbocianski commented Mar 27, 2019

As most of issues was fixed can we move forward with this PR?
This new I2C API is essential for FPGA shield tests development thus it would be good to have it merged ASAP

@jamesbeyond
Copy link
Contributor

seems something wrong with Travis? @0xc0170

@cmonr
Copy link
Contributor

cmonr commented Mar 27, 2019

Travis should be good now.

@cmonr cmonr requested review from LMESTM, donatieng and maciejbocianski and removed request for LMESTM and donatieng March 27, 2019 20:08
@cmonr
Copy link
Contributor

cmonr commented Mar 27, 2019

@maciejbocianski @LMESTM @donatieng Any more comments for this PR?

@cmonr
Copy link
Contributor

cmonr commented Mar 27, 2019

@scartmell-arm I take it this won't be making it in?

Driver API Async

@cmonr
Copy link
Contributor

cmonr commented Apr 9, 2019

@donatieng @ARMmbed/mbed-os-hal Is this good to go?

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 10, 2019

cc @ithinuel

@maciejbocianski
Copy link
Contributor

@cmonr @0xc0170 @ithinuel
I'm working on missing implementations of slave/async modes.

@maciejbocianski maciejbocianski mentioned this pull request Apr 11, 2019
5 tasks
@cmonr
Copy link
Contributor

cmonr commented Apr 12, 2019

It contains all changes from #8682 plus:

Closing in favor of #10374

@cmonr cmonr closed this Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants