This should allow for register inspection, but it doesn't. Is my board mis-soldered?
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 18 May 2010 19:23:46 +0000 (19:23 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 18 May 2010 19:23:46 +0000 (19:23 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@522 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/apps/radios/nrf.c
firmware/include/nrf.h

index d105af5..6b2ad59 100644 (file)
 #include "nrf.h"
 #include "spi.h"
 
 #include "nrf.h"
 #include "spi.h"
 
+//Weird HOPE badge wiring.  This was a fuckup.
+//BIT0 should be SS, but in point of fact it is IRQ.
+//BIT4 is actually SS, BIT5 is CE.
+#define SS BIT4
+
 //This could be more accurate.
 //Does it ever need to be?
 #define NRFSPEED 0
 //This could be more accurate.
 //Does it ever need to be?
 #define NRFSPEED 0
 
 //! Set up the pins for NRF mode.
 void nrfsetup(){
 
 //! Set up the pins for NRF mode.
 void nrfsetup(){
-  P5OUT|=SS;
-  P5DIR|=MOSI+SCK+SS;
+  P5OUT=SS;
   P5DIR&=~MISO;
   P5DIR&=~MISO;
+  P5DIR|=MOSI+SCK+SS;
+  
   
   //Begin a new transaction.
   P5OUT&=~SS; 
   
   //Begin a new transaction.
   P5OUT&=~SS; 
@@ -68,9 +74,7 @@ void nrfhandle(unsigned char app,
   //Raise !SS to end transaction, just in case we forgot.
   P5OUT|=SS;
   nrfsetup();
   //Raise !SS to end transaction, just in case we forgot.
   P5OUT|=SS;
   nrfsetup();
-  
-  debugstr("NRF Handler");
-  
+    
   switch(verb){
     //PEEK and POKE might come later.
   case READ:
   switch(verb){
     //PEEK and POKE might come later.
   case READ:
@@ -84,16 +88,20 @@ void nrfhandle(unsigned char app,
 
   case PEEK://Grab NRF Register
     P5OUT&=~SS; //Drop !SS to begin transaction.
 
   case PEEK://Grab NRF Register
     P5OUT&=~SS; //Drop !SS to begin transaction.
-    nrftrans8(0|(0x1F & cmddata[0])); //000A AAAA
+    nrftrans8(0|(NRF_R_REGISTER & cmddata[0])); //000A AAAA
     for(i=1;i<len;i++)
       cmddata[i]=nrftrans8(cmddata[i]);
     P5OUT|=SS;  //Raise !SS to end transaction.
     for(i=1;i<len;i++)
       cmddata[i]=nrftrans8(cmddata[i]);
     P5OUT|=SS;  //Raise !SS to end transaction.
-    txdata(app,verb,0);
+    txdata(app,verb,len);
     break;
     
   case POKE://Poke NRF Register
     break;
     
   case POKE://Poke NRF Register
-    
-    txdata(app,verb,0);
+    P5OUT&=~SS; //Drop !SS to begin transaction.
+    nrftrans8(0|(NRF_W_REGISTER & cmddata[0])); //001A AAAA
+    for(i=1;i<len;i++)
+      cmddata[i]=nrftrans8(cmddata[i]);
+    P5OUT|=SS;  //Raise !SS to end transaction.
+    txdata(app,verb,len);
     break;
     
   case SETUP:
     break;
     
   case SETUP:
index f7af527..ea3bbb3 100644 (file)
@@ -15,3 +15,5 @@
 
 
 
 
 
 
+//NRF24L01+ Registers
+//TODO add these