Program: 5517
Project: 5517
Buggy source:
public void dataReceived(USARTSource source,int data){
  outputSPI=status;
  if (DEBUG) {
    log("String_Node_Str" + Utils.hex8(data) + "String_Node_Str"+ ((data >= ' ' && data <= 'Z') ? (char)data : '.')+ ')'+ "String_Node_Str"+ chipSelect+ "String_Node_Str"+ 0+ "String_Node_Str"+ stateMachine);
  }
  if (!chipSelect) {
    return;
  }
  if (stateMachine == RadioState.VREG_OFF) {
    source.byteReceived(0);
    logw("String_Node_Str");
    return;
  }
  if (command == null) {
    command=cc2520SPI.getCommand(data);
    if (command == null) {
      logw("String_Node_Str" + data);
    }
 else {
      logw("String_Node_Str" + command.name);
    }
  }
  spiData[spiLen]=data;
  if (spiLen < (spiData.length - 1))   spiLen++;
  if (command != null) {
    command.dataReceived(data);
    if (spiLen == command.commandLen) {
      command.executeSPICommand();
      command=null;
      spiLen=0;
    }
  }
  if (instruction == -1) {
    if ((data & 0xc0) == INS_REGRD) {
      source.byteReceived(memory[data & 0x3f]);
      return;
    }
    if ((data & 0xc0) == INS_REGWR) {
      instruction=data;
      source.byteReceived(outputSPI);
      return;
    }
    if ((data & 0xf0) == INS_MEMRD || (data & 0xf0) == INS_MEMWR) {
      instruction=data;
      source.byteReceived(outputSPI);
      return;
    }
switch (data & 0xff) {
case INS_SNOP:
      break;
case INS_IBUFLD:
    instruction=data & 0xff;
  break;
case INS_SIBUFEX:
break;
case INS_SSAMPLECCA:
break;
case INS_SRES:
break;
case INS_RXBUF:
break;
case INS_RXBUFCP:
break;
case INS_RXBUFMOV:
break;
case INS_TXBUF:
break;
case INS_TXBUFCP:
break;
case INS_RANDOM:
break;
case INS_SXOSCON:
break;
case INS_STXCAL:
break;
case INS_SRXON:
break;
case INS_STXON:
break;
case INS_STXONCCA:
break;
case INS_SRFOFF:
break;
case INS_SXOSCOFF:
break;
case INS_SFLUSHRX:
break;
case INS_SFLUSHTX:
break;
case INS_SACK:
break;
case INS_SACKPEND:
break;
case INS_SNACK:
break;
case INS_SRXMASKBITSET:
break;
case INS_SRXMASKBITCLR:
break;
case INS_RXMASKAND:
break;
case INS_RXMASKOR:
break;
case INS_MEMCP:
break;
case INS_MEMCPR:
break;
case INS_MEMXCP:
break;
case INS_MEMXWR:
break;
case INS_BCLR:
break;
case INS_BSET:
break;
case INS_CTR:
break;
case INS_CBCMAC:
break;
case INS_UCBCMAC:
break;
case INS_CCM:
break;
case INS_UCCM:
break;
case INS_ECB:
break;
case INS_ECBO:
break;
case INS_ECBX:
break;
case INS_ECBXO:
break;
case INS_INC:
break;
case INS_ABORT:
break;
default :
logw("String_Node_Str" + data);
break;
}
source.byteReceived(outputSPI);
return;
}
}

Fixed version (ground truth):
public void dataReceived(USARTSource source,int data){
  outputSPI=status;
  if (DEBUG) {
    log("String_Node_Str" + Utils.hex8(data) + "String_Node_Str"+ ((data >= ' ' && data <= 'Z') ? (char)data : '.')+ ')'+ "String_Node_Str"+ chipSelect+ "String_Node_Str"+ 0+ "String_Node_Str"+ stateMachine);
  }
  if (!chipSelect) {
    return;
  }
  if (stateMachine == RadioState.VREG_OFF) {
    source.byteReceived(0);
    logw("String_Node_Str");
    return;
  }
  if (command == null) {
    command=cc2520SPI.getCommand(data);
    if (command == null) {
      logw("String_Node_Str" + data);
    }
 else {
      if (!"String_Node_Str".equals(command.name)) {
        logw("String_Node_Str" + command.name);
      }
    }
  }
  spiData[spiLen]=data;
  if (spiLen < (spiData.length - 1))   spiLen++;
  if (command != null) {
    command.dataReceived(data);
    if (spiLen == command.commandLen) {
      command.executeSPICommand();
      command=null;
      spiLen=0;
    }
  }
  if (instruction == -1) {
    if ((data & 0xc0) == INS_REGRD) {
      source.byteReceived(memory[data & 0x3f]);
      return;
    }
    if ((data & 0xc0) == INS_REGWR) {
      instruction=data;
      source.byteReceived(outputSPI);
      return;
    }
    if ((data & 0xf0) == INS_MEMRD || (data & 0xf0) == INS_MEMWR) {
      instruction=data;
      source.byteReceived(outputSPI);
      return;
    }
switch (data & 0xff) {
case INS_SNOP:
      break;
case INS_IBUFLD:
    instruction=data & 0xff;
  break;
case INS_SIBUFEX:
break;
case INS_SSAMPLECCA:
break;
case INS_SRES:
break;
case INS_RXBUF:
break;
case INS_RXBUFCP:
break;
case INS_RXBUFMOV:
break;
case INS_TXBUF:
break;
case INS_TXBUFCP:
break;
case INS_RANDOM:
break;
case INS_SXOSCON:
break;
case INS_STXCAL:
break;
case INS_SRXON:
break;
case INS_STXON:
break;
case INS_STXONCCA:
break;
case INS_SRFOFF:
break;
case INS_SXOSCOFF:
break;
case INS_SFLUSHRX:
break;
case INS_SFLUSHTX:
break;
case INS_SACK:
break;
case INS_SACKPEND:
break;
case INS_SNACK:
break;
case INS_SRXMASKBITSET:
break;
case INS_SRXMASKBITCLR:
break;
case INS_RXMASKAND:
break;
case INS_RXMASKOR:
break;
case INS_MEMCP:
break;
case INS_MEMCPR:
break;
case INS_MEMXCP:
break;
case INS_MEMXWR:
break;
case INS_BCLR:
break;
case INS_BSET:
break;
case INS_CTR:
break;
case INS_CBCMAC:
break;
case INS_UCBCMAC:
break;
case INS_CCM:
break;
case INS_UCCM:
break;
case INS_ECB:
break;
case INS_ECBO:
break;
case INS_ECBX:
break;
case INS_ECBXO:
break;
case INS_INC:
break;
case INS_ABORT:
break;
default :
logw("String_Node_Str" + data);
break;
}
source.byteReceived(outputSPI);
return;
}
}