contrib/firmware: Add direction control for 'SCL' i2c signal
We want to keep the tri-state buffers located between the FPGA and the board, in 'Z' state until we launch an i2c connection. We launch an i2c start condition, make the SCL direction 'OUT' to start the i2c protocol and at the end of the i2c connection at the stop condition, we re-make the tri-state buffers at 'Z' state. Change-Id: Ic597a70d0427832547f6b539864c24ce20a18c64 Signed-off-by: Ahmed BOUDJELIDA <aboudjelida@nanoxplore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7989 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
committed by
Antonio Borneo
parent
995a7af21d
commit
c7073853eb
@@ -14,6 +14,9 @@
|
||||
|
||||
void start_cd(void)
|
||||
{
|
||||
PIN_SCL_DIR = 0;
|
||||
PIN_SDA_DIR = 0;
|
||||
delay_us(10);
|
||||
PIN_SDA = 0; //SDA = 1;
|
||||
delay_us(1);
|
||||
PIN_SCL = 0; //SCL = 1;
|
||||
@@ -40,6 +43,10 @@ void stop_cd(void)
|
||||
delay_us(1);
|
||||
PIN_SDA = 1;
|
||||
delay_us(1);
|
||||
PIN_SDA_DIR = 1;
|
||||
delay_us(1);
|
||||
PIN_SCL_DIR = 1;
|
||||
delay_us(1);
|
||||
}
|
||||
|
||||
void clock_cd(void)
|
||||
|
||||
@@ -886,9 +886,6 @@ void io_init(void)
|
||||
PORTACFG = 0x01; /* 0: normal ou 1: alternate function (each bit) */
|
||||
OEA = 0xEF; /* all OUT exept INIT_B IN */
|
||||
IOA = 0xFF;
|
||||
PIN_RDWR_B = 1;
|
||||
PIN_CSI_B = 1;
|
||||
PIN_PROGRAM_B = 1;
|
||||
|
||||
/* PORT B */
|
||||
OEB = 0xEF; /* all OUT exept TDO */
|
||||
@@ -899,8 +896,6 @@ void io_init(void)
|
||||
PIN_TDI = 0;
|
||||
PIN_SRST = 1;
|
||||
|
||||
|
||||
|
||||
/* PORT C */
|
||||
PORTCCFG = 0x00; /* 0: normal ou 1: alternate function (each bit) */
|
||||
OEC = 0xFF;
|
||||
@@ -909,5 +904,4 @@ void io_init(void)
|
||||
/* PORT D */
|
||||
OED = 0xFF;
|
||||
IOD = 0xFF;
|
||||
PIN_SDA_DIR = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user