Eduardo Estigoni

MC9S08 GT60 + MC13192 + customized SMAC :: Is it possible to  transmit data @ a faster rate?

Discussion created by Eduardo Estigoni on Aug 20, 2007
Latest reply on Aug 21, 2007 by Eduardo Estigoni
Hi guys,

I'm working on a project where I need to send data @ 2000 samples per second from one board to another. I've used the SMAC protocol as a start point, and all the init routines are working just fine.


My transmit routine that loops is pretty close to this rate, however I would like to now if it is possible to improve it somehow. May be doing the SPI transactions faster... I don't know...

The datasheet says that the MC13192 transmission rate can go up to 250kbps.

In this test routine I'm sending 6 bytes in the packet mode (already configured before) plus 2 bytes that are automatically added by the transceiver.

Please let me know if there is a faster way for doing it.


Cheers,


Ed.





void LoopRoutine(void)

{

  UINT8  E_u8TempValue;
 
  if (gu8RTxMode == IDLE_MODE)
  {

                /* Clear status register (possible SPRF, SPTEF): */ 
       E_u8TempValue = SPI1S;
           
     
              /* Coment1: Save context & disable the MC13192 interrupt source: */
       MC13192_IRQ_SOURCE = MC13192_IRQ_SOURCE & ~(0x06);
     
      
              /* Coment2: Asserts the MC13192 CE pin */
       MC13192_CE = 0;

              // #E#: send 0x02 via spi (SPI TX ram data register):
       SPI1D = 0x02;
              // Wait transfer done:
       while (!(SPI1S_SPTEF)) ;
                              
     
           
       SPI1D = 0x00;
       while (!(SPI1S_SPTEF));
      
       SPI1D = 0x05;
       while (!(SPI1S_SPTEF));
      
      
      
       SPI1D = 0x00;
       while (!(SPI1S_SPTEF));
      
     
       SPI1D = 0x01;
       while (!(SPI1S_SPTEF));
      
       SPI1D = 0xD0;
       while (!(SPI1S_SPTEF));
      
       SPI1D = COUNT;
       COUNT++;
       while (!(SPI1S_SPTEF));
      
            
           
     
              /* Deasserts the MC13192 CE pin: */ 
       MC13192_CE = 1;
       
              /* Restore MC13192 interrupt status */
              /* Restore the context of the IRQ register from global */
              /* Enables MC13192 transceiver */
       MC13192_IRQ_SOURCE = MC13192_IRQ_SOURCE | (0x02); 
         
               
                  /* Deassert RTXEN: */
                  /* in fact it is PTCD_PTCD3... Enables Transmission or Reception from SPI  */
        MC13192_RTXEN = 0;
       

                  /* Turn off the RX antenna */
        MC13192_ANT_CTRL2 = ANT_CTRL_OFF;
       
                  /* Turn on the TX antenna */  
        MC13192_ANT_CTRL = ANT_CTRL_ON;    
       
       
                //This var will be used by the "Switch" command in the interrupt routine when called.
        gu8RTxMode = TX_MODE;
         
         
         
        
         
         

                /* Clear status register (possible SPRF, SPTEF): */ 
        E_u8TempValue = SPI1S;
       
       
                /* Coment1: Save context & disable the MC13192 interrupt source: */
        MC13192_IRQ_SOURCE = MC13192_IRQ_SOURCE & ~(0x06);
              
               
                /* Coment1: Asserts the MC13192 CE pin */
        MC13192_CE = 0;
       

                // #E#: send 0x06 via spi (it is the address of Config Tx):
        SPI1D = 0x06;
        while (!(SPI1S_SPTEF));
       
                /* Write MSB */
        SPI1D = 0x47;
        while (!(SPI1S_SPTEF));
        
       
              /* Write LSB */
        SPI1D = 0x23;
        while (!(SPI1S_SPTEF));
        
       
                /* Deasserts the MC13192 CE pin: */ 
     
        MC13192_CE = 1;
     
                /* Restore MC13192 interrupt status */
                /* Restore the context of the IRQ register from global */
                /* Enables MC13192 transceiver */
        MC13192_IRQ_SOURCE = MC13192_IRQ_SOURCE | (0x02); 
                 
         
         
                     
     
        /* Assert RTXEN:  */
        /* in fact it is PTCD_PTCD3... Enables Transmission or Reception from SPI  */
        MC13192_RTXEN = 1;
       
         
         
        ///Here comes the interrupt routine...
     
     
     
      while (gu8RTxMode != IDLE_MODE)  //#E#: This loop runs 325 times if I drop the wait instruction.
      {
        _asm wait;
      }
     
 
  }//END if (gu8RTxMode == IDLE_MODE)
 
}







Outcomes