This is an automated email from Gerrit.

"Adrien Charruel <acharr...@nanoxplore.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8716

-- gerrit

commit bdeacf80f2cda82cce850216644492e29f7690d4
Author: Ahmed BOUDJELIDA <aboudjel...@nanoxplore.com>
Date:   Thu Dec 12 10:27:14 2024 +0100

    contrib/firmware/angie: add dev-board power detection
    
    Add a check if i2c SDA pin state is HIGH.
    if its HIGH, the dev-board is ON, we receive
    number of Ack.
    in its LOW, the board is OFF, we send this
    information back to driver.
    
    Change-Id: Ia40d3910675cc10e0208d8bc0060a19c12b1409d
    Signed-off-by: Ahmed BOUDJELIDA <aboudjel...@nanoxplore.com>

diff --git a/contrib/firmware/angie/c/src/i2c.c 
b/contrib/firmware/angie/c/src/i2c.c
index 5d25373321..4cf82955fc 100644
--- a/contrib/firmware/angie/c/src/i2c.c
+++ b/contrib/firmware/angie/c/src/i2c.c
@@ -15,7 +15,7 @@
 bool get_status(void)
 {
        PIN_SDA_DIR = 1;
-       OEA = 0xFB;
+       OEA = 0xF7;
        delay_us(1);
        bool sda_state = PIN_SDA;
        PIN_T0 = sda_state;
diff --git a/contrib/firmware/angie/c/src/main.c 
b/contrib/firmware/angie/c/src/main.c
index c5a04626bf..657694b6c1 100644
--- a/contrib/firmware/angie/c/src/main.c
+++ b/contrib/firmware/angie/c/src/main.c
@@ -11,6 +11,7 @@
 *****************************************************************************/
 
 #include "usb.h"
+#include "serial.h"
 #include "delay.h"
 #include "reg_ezusb.h"
 #include <stdio.h>
diff --git a/contrib/firmware/angie/c/src/usb.c 
b/contrib/firmware/angie/c/src/usb.c
index 5506114ec4..c14254c81d 100644
--- a/contrib/firmware/angie/c/src/usb.c
+++ b/contrib/firmware/angie/c/src/usb.c
@@ -713,7 +713,6 @@ void i2c_recieve(void)
                uint8_t adr = EP6FIFOBUF[3];    //address
                uint8_t address = get_address(adr, rdwr);   //address byte 
(read command)
                uint8_t address_2 = get_address(adr, 0);   //address byte 2 
(write command)
-
                /*  start:   */
                start_cd();
                /*  address:   */
@@ -764,6 +763,10 @@ void i2c_recieve(void)
                uint8_t adr = EP6FIFOBUF[2];    //address
                uint8_t address = get_address(adr, rdwr);   //address byte 
(read command)
                uint8_t ack_cnt = 0;
+               bool i2c_state = true;
+
+               if (!get_status())
+                       i2c_state = false;
 
                /*  start():   */
                start_cd();
@@ -783,6 +786,11 @@ void i2c_recieve(void)
                /*   stop   */
                stop_cd();
 
+               if (i2c_state)
+                       EP8FIFOBUF[0] = ack_cnt;
+               else
+                       EP8FIFOBUF[0] = 0;
+
                EP8BCH = 0; //EP8
                syncdelay(3);
                EP8BCL = 1; //EP8
diff --git a/src/jtag/drivers/angie/angie_firmware.bin 
b/src/jtag/drivers/angie/angie_firmware.bin
index 3475ce956a..6b05547254 100644
Binary files a/src/jtag/drivers/angie/angie_firmware.bin and 
b/src/jtag/drivers/angie/angie_firmware.bin differ

-- 

Reply via email to