Регистры Allwinner H616

Сокращения  |  Дерево шин  |  Карта памяти


TWI_CNTR
9.1.5. TWI Control Register - адрес: 0x500200c 0x500240c 0x500280c 0x5002c0c 0x500300c 0x708140c (смещение: 0x000C)

Двухпроводной интерфейс: список регистров



31 ||||||||||||||||| 16
15 ||||||||||||||||| 00

  Unused

Bits 31 : 8

  INT_EN

Bit 7
R/W
0x0

Interrupt Enable
0: The interrupt line always low
1: The interrupt line will go high when INT_FLAG is set.


  BUS_EN

Bit 6
R/W
0x0

TWI Bus Enable
0: The TWI bus ISDA/ISCL is ignored and the TWI Controller will not respond
to any address on the bus
1: The TWI will respond to call to its slave address - and to the general call
address if the GCE bit in the ADDR register is set.
Note: In master operation mode, this bit should be set to 1 .


  M_STA

Bit 5
R/WAC
0x0

Master Mode Start
When M_STA is set to 1 , TWI Controller enters master mode and will
transmit a START condition on the bus when the bus is free. If the M_STA
bit is set to 1 when the TWI Controller is already in master mode and one
or more bytes have been transmitted, then a repeated START condition will
be sent. If the M_STA bit is set to 1 when the TWI is being accessed in
slave mode, the TWI will complete the data transfer in slave mode then
enter master mode when the bus has been released.
The M_STA bit is cleared automatically after a START condition has been
sent. Writing a '0' to this bit has no effect.


  M_STP

Bit 4
R/W1C
0x0

Master Mode Stop
If M_STP is set to 1 in master mode, a STOP condition is transmitted on the
TWI bus. If the M_STP bit is set to 1 in slave mode, the TWI will indicate if
a STOP condition has been received, but no STOP condition
will be transmitted on the TWI bus. If both M_STA and M_STP bits are set, the TWI
will first transmit the STOP condition (if in master mode) then transmit the
START condition.
The M_STP bit is cleared automatically: writing a '0' to this bit has no effect.


  INT_FLAG

Bit 3
R/W1C
0x0

Interrupt Flag
INT_FLAG is automatically set to 1 when any of 28 (out of the possible 29)
states is entered (see 'STAT Register' below). The only state that does not
set INT_FLAG is state F8h. If the INT_EN bit is set, the interrupt line goes
high when IFLG is set to 1 . If the TWI is operating in slave mode, data
transfer is suspended when INT_FLAG is set and the low period of the TWI
bus clock line (SCL) is stretched until 1 is written to INT_FLAG. The TWI
clock line is then released and the interrupt line goes low.


  A_ACK

Bit 2
R/W
0x0

Assert Acknowledge
When A_ACK is set to 1 , an Acknowledge (low level on SDA) will be sent
during the acknowledge clock pulse on the TWI bus if:
(1). Either the whole of a matching 7-bit slave address or the first or the
second byte of a matching 10-bit slave address has been received.
(2). The general call address has been received and the GCE bit in the ADDR
register is set to 1 .
(3). A data byte has been received in master or slave mode.
When A_ACK is '0', a Not Acknowledge (high level on SDA) will be sent
when a data byte is received in master or slave mode.
If A_ACK is cleared to '0' in slave transmitter mode, the byte in the DATA
register is assumed to be the 'last byte'. After this byte has been
transmitted, the TWI will enter state C8h then return to the idle state
(status code F8h) when INT_FLAG is cleared.
The TWI will not respond as a slave unless A_ACK is set.


  Unused

Bit 1

  CLK_COUNT_MODE

Bit 0
R/W
0x0

0: scl clock high period count on oscl
1: scl clock high period count on iscl



Команда U-Boot для чтения регистра

md 500200c 1
md 500240c 1
md 500280c 1
md 5002c0c 1
md 500300c 1
md 708140c 1



Bit fields structure

typedef union  twi_cntr
{
  struct
  {
   unsigned clk_count_mode : 1;
   unsigned unused0 : 1;
   unsigned a_ack : 1;
   unsigned int_flag : 1;
   unsigned m_stp : 1;
   unsigned m_sta : 1;
   unsigned bus_en : 1;
   unsigned int_en : 1;
   unsigned unused1 : 24;
  } b;
   unsigned long w;
} TWI_CNTR
   

Allwinner H616 Manual