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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

1,565件の閲覧回数
ehestigoni
Contributor III
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)
 
}







ラベル(1)
0 件の賞賛
返信
3 返答(返信)

572件の閲覧回数
bigmac
Specialist III
Hello Ed,
 
A quick calculation of throughput suggests the following -
 
2000 samples/sec -> 2000 send packets/sec -> 16,000 bytes/sec -> 128,000 bit/sec average send rate
 
This represents about 50% of the available transmission time, but does not include any data packets that need to be received, and any other overheads.  I suspect that 2000 samples per second would be close to the limit that can be practically achieved.
 
Regards,
Mac
 
0 件の賞賛
返信

572件の閲覧回数
rocco
Senior Contributor II
Unless you buffer the samples, and send a bundle of samples in each packet.
0 件の賞賛
返信

572件の閲覧回数
ehestigoni
Contributor III
Hi BigMac and Rocco,
 
Thanks for your help.
 
I agree with you guys. May be it's time to change the strategy.
The main goal of this board is to send results of AD conversions. I don't mind if one of the samples is lost, so that I don't need an Ack response. And also, there is nothing else to be done in this firmware. I only need to convert and send the 2 bytes with the values.
 
On the board 2 I will have to get all these data and put them on the USB trough an FTDI chip.
 
I was thinkink about to send more samples per packet...
However I don't know if it would work, as it is intended to be a "real time" system. There is a C++ software to collect the data from the USB and show it on the screen as well.
 
Anyway, I will keep cutting the edges. If you have any suggestion, please let me know..
 
 
Cheers,
 
Ed.
 
 
 
0 件の賞賛
返信