This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

what does ff command do

I'm new to nrf8001 I'm trying to understand an existing example. in this example after sending set up commands generated by nrfgo studio , program sends 9 byte of 0xff command (invalid aci command) , waits for 20 ms and then send 4 byte of that again. why is this happening!?

void setup (void) {

  int m,j;
  unsigned char temp[10],k;
    for(m=0;m<NB_SETUP_MESSAGES;m++) 	{
	      REQN = 0;
            while (RDYN == 1);
	      k=setup_line[m][0];
            spi(k);
            for (j=1;j<=k;j++)
            {
	            spi(setup_line[m][j]);
            }
            REQN=1;
            while(RDYN==0);
            delay_ms(20); 	}

      REQN=0;
      while(RDYN==1);

      spi(ACI_CMD_INVALID);
      spi(ACI_CMD_INVALID);
      spi(ACI_CMD_INVALID);
      spi(ACI_CMD_INVALID);
      spi(ACI_CMD_INVALID);
      spi(ACI_CMD_INVALID);
      spi(ACI_CMD_INVALID);
      spi(ACI_CMD_INVALID);
      spi(ACI_CMD_INVALID);

      REQN=1;
      while(RDYN==0);
      delay_ms(20);
      REQN=0;
      while(RDYN==1);

      spi(ACI_CMD_INVALID);
      spi(ACI_CMD_INVALID);
      spi(ACI_CMD_INVALID);
      spi(ACI_CMD_INVALID); 	


switch(SPDR)				//SPDR = spi return value 	
{ 	
case 1:
	
      putsf("Device started in TEST mode. \n"); 		
break; 	
case 2: 		
putsf("Device started in SETUP mode. \n"); 		
break; 	
case 3: 		
putsf("Device started in STANDBY mode. \n"); 		
break;
      default:
            putsf("Something goes WRONG!!! \n");
            break; 	};
      spi(ACI_CMD_INVALID); 	
sprintf(temp,"Number of errors = %d \n",SPDR);
      puts(temp);
      spi(ACI_CMD_INVALID); 	
sprintf(temp,"Number of dataCommand buffers = %d \n",SPDR);
      puts(temp);

      REQN = 1;
      delay_ms(60);
      while (RDYN == 0); }

here is my bluetooth set up code. the ACI_CMD_INVALID contains 0xff value. I don't understand the need for this invalid opcode

Parents Reply Children
No Data
Related