Frangiskos Hadjigeorgiou

SCI port data Overrun problem

Discussion created by Frangiskos Hadjigeorgiou on Jun 30, 2007
Latest reply on Jun 30, 2007 by Frangiskos Hadjigeorgiou
Hi.

I'm trying to receive data on an EVB9S12NE64 board's SCI1 port, and transmit them periodically on the Network.
Everything seems to work fine, but only a little problem.
Out of the ~2048 data values arriving to the SCI1 port, around 60 of them are lost.
I've implemented an ISR with Fifo for my SCI1 receiver, set it to high priority ( HPRIO = 0xD4; ), and removed any additional DEBUGOUT functions I placed for debugging purposes, as they proved to cause even greater data loss before.
Basically I believe the loss is caused by the CPU being busy preparing and transmitting a UDP packet for every 50 received values.
I'm operating the port at 19200 BAUD rate. I also tried 9200, but still the same problem. If everything works out, hopefully I will be able to increase the BAUD rate even further, to decrease the delay time of receiving the date.
Any ideas how I fix this problem?
If it helps, please find below my SCI1in -> UDP function.

Thanks


//--------Read Sensor Data----

void read_sensor(void){
  UINT16 i=0;
  UINT16 tempi=0;
  UINT8 pkno=0;
  UINT16 datalen = 0;

  RxFifo_Init(); //Reset fifo's contents

  SCI1OutString("SendMeData\n\r"); //Request data for a single Scan

  character = SCI1In();
  while (character != CR){ //Read all characters of a scan til CR

        net_buf[UDP_APP_OFFSET+tempi+5] = character; //Add character to buffer
        tempi++;
        if (character == SP){
          i++;
          if (i%50 == 0){ //Packetize and Tx every 50 pixels
              datalen=tempi+5;
              tempi = 0;       net_buf[UDP_APP_OFFSET+tempi]='R';
              tempi = 1;       net_buf[UDP_APP_OFFSET+tempi]='Y';
              tempi = 2;       net_buf[UDP_APP_OFFSET+tempi]='U';
              tempi = 3;       net_buf[UDP_APP_OFFSET+tempi]=(pkno+48);
              tempi = 4;       net_buf[UDP_APP_OFFSET+tempi]='@';
            
            
              // UDP Send 50 pixels

(void)udp_send(udp_demo_soch,UDP_DEMO_RMTHOST_IP,UDP_DEMO_RMTHOST_PRT,net_buf+UDP_APP_OFFSET,NETWORK_TX_BUFFER_SIZE-UDP_APP_OFFSET,datalen);
              pkno++;
              tempi=0;
          }
        }
        character = SCI1In();
      if (i>res){
        break; // Resolution value reached and no CR found
      }
    }
    //CR Found

  datalen = tempi+5;

  //Send remaining readings
  tempi = 0;       net_buf[UDP_APP_OFFSET+tempi]='R';
  tempi = 1;       net_buf[UDP_APP_OFFSET+tempi]='Y';
  tempi = 2;       net_buf[UDP_APP_OFFSET+tempi]='U';
  tempi = 3;       net_buf[UDP_APP_OFFSET+tempi]=47;
  tempi = 4;       net_buf[UDP_APP_OFFSET+tempi]='@';
  (void)udp_send(udp_demo_soch,UDP_DEMO_RMTHOST_IP,UDP_DEMO_RMTHOST_PRT,net_buf+UDP_APP_OFFSET,NETWORK_TX_BUFFER_SIZE-UDP_APP_OFFSET,datalen);
  Debugi(pkno+1);
  Debugt(" Packets sent over UDP>>>>>>>>>\n\r");
}

Outcomes