This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Need Help "PPP for 16 bit microcontroller"



Hai All

I am developing PPP for 16 bit micronotroller (EVB3067).Its a very minimal
implementation of PPP.

I am trying to establish connection between linux and hitachi evaluation board. I am
using 3 SCI port of Hitachi board. 1 for PPP connection 2nd for downloading the
code and 3rd is to provide debugging information on hyperterminal(as i can not use printf() function )

I am having the folowing problems:

- I am not able to convert the ASCI characters into Hexadecimal or Decimal format which i received in from Client.Is there a problem of Library,i mean i am using

newlib-1.8.2
gcc-2.95.2
binutils-2.9.1
gdb-4.18

I am using Hitachi Deg Interface under NT,for compiling the program i am using Linux

- I tested my program on Hyperterminal just to cheach if the it works fine as there is no other  i can cheack it before i started a real PPP connection.But now i am trying to do the real connection by using the PPP between linux and my hitachi board.But now the real problem started, i want to read the PPP frame which is in HDLC format and then reply to peer after doing the Frame cheack seq ...etc(all what is required by reall/standard PPP implementation)and cheacking if all the field is valid.

- But what i am getting is garbage, and what Linux is receiving is also garbage.Some how data is corrupted.and connection can not establish

- I also notice that some of my function is *NOT working properly (though there is nothing wrong in the C code it self).My question is is there any way to provide the more debugging info so that my HDI will read the program efficently,I tried O,O1,....no success



/******************************************************************************
First state machine for receiving the frame from PPP_BEGIN_FLAG to PPP_END_FLAG
*******************************************************************************/

void handle_char (unsigned char r){
unsigned char tmp[100];
unsigned char tmp1[100];
switch (state){
  case not_reading:
      if(r == PPP_BEGIN_FLAG)        
        putstring"PPP BEGIN FLAG received....\n");        
      state = reading;        
      break;         
      case reading:
 switch(r){       
 case PPP_END_FLAG:           
 printf(" PPP END FLAG is received\n ");           
 frame_check();           
 if (cheack_fcs() != 0)           
{            
putstring("not the correct packet\n\r");               
break;           
}            
buff[0] = PPP_BEGIN_FLAG;            
buff[1] = 0xff;            
buff[2] = 0x3;            
*(unsigned short *) &(buff[3]) = 0xc021;            
buff[4] = 0x2;             
 buff[41] = PPP_END_FLAG
for(num_char_transmit = 0;num_char_transmit < 41;num_char_transmit++)             transmit(buff[num_char_transmit]);            
memcpy(tmp,&buff[4],1);            
sprintf(tmp1,"%u",tmp);             
putstring("this is decimal field \n\r");             
putstring(tmp1);                        
putstring("received PPP FRAME: \n");                         
putstring(buff);              
num_char_read = 0;                      
state = not_reading;                      
break;           
default:          
if (num_char_read == BUFSIZE)           
{              
putstring("buffer is  FULL..\n\r" );                          
break;           
}else{               
 buff[num_char_read++] = r;                 
break;                          
      }                
    }     
  }  
}

======================================================

Any of the Help,idea or trick will be wellcome, as this is my thesis of BEng and i need to soon please reply

Best regards

Syed

-------------VTT - Technical Research Centre of Finland-----------
Syed Raza                               
VTT-Electronics                                 
P.O.Box 1100                                            
FIN-90571 Oulu, Finland                           

Email: Syed.Raza@vtt.fi   
URL: www.ele.vtt.fi
Tel: (Res)+358 8 880 4183
Tel: (off)  +358 8  551 2439.
Fax: (off) +358 8 551 2320.
--------------------------------------------------------------------------------- ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]