Explore I2C

This commit is contained in:
Lee Lup Yuen 2023-10-18 17:31:29 +08:00
parent 0a9c37ab8e
commit ce7826f368

100
README.md
View file

@ -7889,6 +7889,106 @@ JH7110 I2C is based on [DesignWare I2C](https://github.com/torvalds/linux/blob/m
[(Search for "DesignWare DW_apb_i2c Databook")](https://www.google.com/search?q=%22DesignWare+DW_apb_i2c+Databook%22)
See Page 252: "Figure 8-2: Flowchart for DW_apb_i2c Master"
```text
Write 0 to
IC_ENABLE to
disable
DW_apb_i2c
Program IC_CON register fields as
required:
1. Set IC_SLAVE_DISABLE to 1 Slave
disabled
2. Set IC_RESTART_EN to 1 Enable
restart mode
3. Set IC_10BITADDR_MASTER to 0
7-bit addressing
4. Set IC_10BITADDR_SLAVE to 0 7-bit
addressing
5. Set IC_MAX_SPEED_MODE to 1
Standard mode
6. Set IC_MASTER_MODE to 1 Master
enabled
Set address of
target Slave by
writing it to TAR
Write to
IC_SS_HCNT to
set HIGH period
of SCL
Write to
IC_SS_LCNT to
set LOW period
of SCL
Write to
IC_INTR_MASK to
enable all
interrupts
Write to
IC_RX_TL to
set Rx FIFO
threshold level
Write to
IC_TX_TL to
set Tx FIFO
threshold level
Write 1 to
IC_ENABLE to
enable
DW_apb_i2c
Write to IC_DATA_CMD to
push Write command and write data
or Read command Tx FIFO
Command is
Write?
N:
RX_FULL
interrupt
asserted?
Y:
Read
IC_DATA_CMD[7:0]
to retrieve
received byte
Y:
TX_EMPTY
interrupt
asserted?
Y:
More
commands
to send?
Y:
Write to IC_DATA_CMD...
N:
Is IC_STATUS[5]
(MST_ACTIVITY)
= 0?
Y:
Write 0 to
IC_ENABLE to
disable
DW_apb_i2c
```
Which is implemented by this NuttX Driver:
- [arch/arm/src/cxd56xx/cxd56_i2c.c](https://github.com/apache/nuttx/blob/master/arch/arm/src/cxd56xx/cxd56_i2c.c)