Thanks robots.
I read the notice emails, so I didn't see the edit until just now. Go ahead and make another post for faster service :)
I updated the functions as follows, and committed a new compile for v4 bootloader to the nightly folder. Have you upgraded bootloaders? I can make a compile for v2 bootloader if you need it.
http://code.google.com/p/the-bus-pirate/source/browse/trunk/firmware/v4-nightly/BPv3%26v2go/BPv3-OpenOCD-v0c-1.hexUpdates...
Main():
case WRITE_TDI:// buf[1]+buf[2] extra bytes?????
case READ_TDO:// buf[1]+buf[2] extra bytes?????
case WRITE_AND_READ:// buf[1]+buf[2] extra bytes?????
buf[1]=UART1RX();//get extra byte
buf[2]=UART1RX();//get extra byte
j=((uint8_t)buf[1]*256)+(uint8_t)buf[2]; //get data packet size
j=(j/8)+1;
for(i=0;i<j;i++){
buf[2+i]=UART1RX();
}
break;
WRITE_AND_READ
case WRITE_AND_READ:// buf[1]+buf[2] extra bytes?????
//write_and_read(buf,((uint8_t)buf[1]*256)+(uint8_t)buf[2]); // size = numbers of byte not bits!!! round up
j = ((uint8_t)buf[1]*256)+(uint8_t)buf[2];
write_and_read(buf+3, j); // skip 3 bytes on buf, size from openocd is actually number of bits used in the buffer (max 61 * 8 = 488)
#if 1
// tck 0 tms 0 tdi 0
CLEARBIT(BIT2_WRITE,BIT2); // clk
CLEARBIT(BIT1_WRITE,BIT1); // tdi
CLEARBIT(BIT3_WRITE,BIT3); // tms
// tck 1 tms 0 tdi 0
SETBIT(BIT2_WRITE,BIT2); // clk
#endif
// for(i=0;i<64;i++)
// answer[i]=buf[i];
j=(j/8)+1;
for(i=0;i<j;i++)
answer[i]=buf[i];
//CommandAnswer(64);
CommandAnswer(j); // for future use :) bigger packets
break;
Because WRITE_TDI, READ_TDO and WRITE_AND_READ all share that function in main, I made these updates too:
WriteTDI (now uses buf+3)
case WRITE_TDI:// buf[1]+buf[2] extra bytes?????
write_tdi(buf+3,((uint8_t)buf[1]*256)+(uint8_t)buf[2]); // size = numbers of byte not bits!!! round up
// tck 0 tms 0 tdi 0
CLEARBIT(BIT2_WRITE,BIT2); // clk
CLEARBIT(BIT1_WRITE,BIT1); // tdi
CLEARBIT(BIT3_WRITE,BIT3); // tms
// tck 1 tms 0 tdi 0
SETBIT(BIT2_WRITE,BIT2); // clk
break;Read TDO (uses same mods as WRITE_AND_READ
case READ_TDO:// buf[1]+buf[2] extra bytes?????
//read_tdo(buf,((uint8_t)buf[1]*256)+(uint8_t)buf[2]); // size = numbers of byte not bits!!! round up
j = ((uint8_t)buf[1]*256)+(uint8_t)buf[2];
read_tdo(buf+3,j); // size = numbers of byte not bits!!! round up
#if 1
// tck 0 tms 0 tdi 0
CLEARBIT(BIT2_WRITE,BIT2); // clk
CLEARBIT(BIT1_WRITE,BIT1); // tdi
CLEARBIT(BIT3_WRITE,BIT3); // tms
// tck 1 tms 0 tdi 0
SETBIT(BIT2_WRITE,BIT2); // clk
#endif
//for(i=0;i<64;i++)
// answer[i]=buf[i];
j=(j/8)+1;
for(i=0;i<j;i++)
answer[i]=buf[i];
//CommandAnswer(64);
CommandAnswer(j); // for future use :) bigger packets
break;Please let me know if you think any of these changes were unnecessary.