Fixed P4REN error that broke MSP430F1612 support."
[goodfet] / firmware / apps / spi / spi.c
index cba4796..dc1c286 100644 (file)
@@ -243,7 +243,7 @@ void spi_rw_em260(u8 app, u8 verb, u32 len){
     
   P4DIR=0; //TODO ASAP remove P4 references.
   P4OUT=0xFF;
     
   P4DIR=0; //TODO ASAP remove P4 references.
   P4OUT=0xFF;
-  P4REN=0xFF;
+  //P4REN=0xFF;
     
   //See GoodFETEM260.py for details.
   //The EM260 requires that the host wait for the client.
     
   //See GoodFETEM260.py for details.
   //The EM260 requires that the host wait for the client.
@@ -255,7 +255,6 @@ void spi_rw_em260(u8 app, u8 verb, u32 len){
     
   em260_wake();
   
     
   em260_wake();
   
- em260woken:
     
   SETMOSI; //Autodetected SPI mode.
   CLRSS; //Drop !SS to begin transaction.
     
   SETMOSI; //Autodetected SPI mode.
   CLRSS; //Drop !SS to begin transaction.
@@ -290,6 +289,9 @@ void spi_rw_em260(u8 app, u8 verb, u32 len){
   while(
        (cmddata[len++]=spitrans8(0xFF))!=0xA7
        );
   while(
        (cmddata[len++]=spitrans8(0xFF))!=0xA7
        );
+  if(cmddata[0]==0xFE)
+    while(len<cmddata[1]+3)
+      cmddata[len++]=spitrans8(0xFF);
   SETSS;  //Raise !SS to end transaction.
   
   txdata(app,verb,len);
   SETSS;  //Raise !SS to end transaction.
   
   txdata(app,verb,len);