Problem with gpio from nano to uno

Hello. mighty forum,

I have a simple setup where uno is connected to nano. uno 5v and gnd goto vin and gnd of nano. D7 of uno goes to D2 of nano and D8 of uno goes to D8 of nano.

I am trying to send one byte of info from nano to uno ( yeah, there are other ways, i wanted to play with gpio)

Uno being master raises a high on D7 (for 20us) and then low and nano gets this , as I have registered an interrupt. This works well and my ISR gets called on Nano. and now, nano send the byte with a start 'bit' - does the same high to low . and this is where the problem is , on Uno, am not able to receive this. I tried reading in a loop, interrupt but nothing. to test if nano is generating the signal, i have connected D8 of nano to D13 of uno (and set the pin13 to output) and LED blinks appropriately ( i changed the 20 us to a second and in a loop to confirm this)

so, my question is what am I doing wrong ? I have setup D8 on uno as INPUT and D8 on nano as OUTPUT and tried the ISR FALLING ( as this is similar to setup when uno does to nano) .

thanks
O

so, my question is what am I doing wrong ?

Not posting both the codes!

ok. sorry ! here it is

UNO code :

#define NUM_CLIENTS 1

#define BASE_WRITE  7
#define BASE_READ   8

void setup() {
 // put your setup code here, to run once:

   int i;
   for( i = 0; i < NUM_CLIENTS; i++) {
       pinMode((BASE_WRITE) + (i*2),OUTPUT);
       pinMode((BASE_READ) + (i*2),INPUT);
   }
   pinMode(13, OUTPUT);
   attachInterrupt(digitalPinToInterrupt(BASE_READ), boo, FALLING);
   Serial.begin(9600); // Initialize serial communications with the PC
   while (!Serial);    // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)

}

void loop() {
 // put your main code here, to run repeatedly:
   int i = 0, count = 0, data;
   //Serial.print(F("Hello Uno"));
   while (count < 2) {
       for (i = 0; i < NUM_CLIENTS; i++) {
             Serial.print("Reading from Client...");
             Serial.println(i);
             noInterrupts();
             digitalWrite(BASE_WRITE, HIGH);
             delayMicroseconds(10);
             digitalWrite(BASE_WRITE, LOW);
             interrupts();
//              data = read();
//              if (data < 0 )  {
//                
//                Serial.print("No Data from Client...");
//                Serial.println(data);
//              }else   {
//
//                Serial.print("Read Data from Client...");
//                Serial.println(data);
//              }
       }
       count ++;
       delay(1000);

   }
   Serial.print(F("Hello Uno End"));
   while (1);
}

void boo()  {
 Serial.print(F("In Boo"));
}
int read () {
   int i, ret = -1;
   unsigned long duration;
   
   noInterrupts();
 
   while(1)  {
     duration = pulseIn(BASE_READ, HIGH, 100);
     Serial.print("Reading initial signal...");
     Serial.println(duration);
     if (duration > 0 ) break;
   }
   interrupts();
   return ret;
}


Nano code:
#define BASE_WRITE  8
#define BASE_READ   2

volatile int send_data = 0;
void setup() {
 // put your setup code here, to run once:
   pinMode(BASE_READ, INPUT);
   pinMode(BASE_WRITE, OUTPUT);
   attachInterrupt(digitalPinToInterrupt(BASE_READ), boo, FALLING);
   Serial.begin(9600); // Initialize serial communications with the PC
   while (!Serial);    // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)

}

void loop() {
 // put your main code here, to run repeatedly:
//  Serial.print("LED..");
//  digitalWrite(BASE_WRITE, HIGH);
//  delay(1000);
//  digitalWrite(BASE_WRITE, LOW);
//  delay(1000);
 
 if(send_data) {
   Serial.print("Sending Data...");
   Serial.println(send_data);
   _write( random(8) );
   noInterrupts();
   send_data = send_data - 1; 
   interrupts();   
 }
}

void boo()  {
   Serial.print(F("In Boo "));
   send_data = send_data + 1;
   Serial.println(send_data);
}

void _write( unsigned long data ) {
 unsigned long mask = 1;
 int k = 0;
 
 Serial.print("Writing ...");
 Serial.println(data);
 noInterrupts();
 digitalWrite(BASE_WRITE, HIGH);
 delayMicroseconds(20);
 digitalWrite(BASE_WRITE, LOW);
 delayMicroseconds(20);

//  for ( k = 0; k < 8; k++ ) {
//
//      if ( mask & data )  {
//          digitalWrite(BASE_WRITE, HIGH);
//          delayMicroseconds(20);
//          Serial.print("Writing High...");
//        
//      } else  {
//          digitalWrite(BASE_WRITE, LOW);  
//          delayMicroseconds(20);
//          Serial.print("Writing Low...");      
//      }
//      Serial.println(mask);
//      mask = mask << 1;
//  }
 interrupts();
}

(Code tags added by moderator - please use the </> button to add them yourself in the future. Thanks, Moderator)