logo       

[Fwd: Re: atModem exception thrown is divisor is changed]: msg#00689

hardware.microcontrollers.tini

Subject: [Fwd: Re: atModem exception thrown is divisor is changed]


-------- Original Message --------
Subject: Re: atModem exception thrown is divisor is changed
Date: Wed, 25 Jun 2003 11:18:34 -0400
From: Peter Bauer <pbauer@xxxxxxxxxxxxxxxxx>
To: Nicolas Kral <Nicolas.Kral@xxxxxxxxxxx>
References: <3EF796D2.7070707@xxxxxxxxxxxxxxxxx> <1056471968.1928.13.camel@xxxxxxxxxxxxxxxxxxxx> <3EF89C75.1000008@xxxxxxxxxxxxxxxxx> <1056484687.1928.71.camel@xxxxxxxxxxxxxxxxxxxx> <3EF8C9CD.7000503@xxxxxxxxxxxxxxxxx> <1056550997.7207.59.camel@xxxxxxxxxxxxxxxxxxxx>


Hi Nick,

It looks like the @JPC is some kind of address to the member, but I'm not sure how to
decypher it.  Since there are 2 calls to setSerial I would assume the exception is thrown
from the first - this would be setSerial( int, int, int ).  I made sure to include a cast on the
last parameter to make sure I was calling the correct overloaded member.
   in com.dalsemi.system.TINIOS.setSerial(@JPC=3c0152)
   in com.dalsemi.system.TINIOS.setSerial(@JPC=3a002f)
I've attached the full project, directories, and, files for you to try on a 400 series board using
release 1.11 of TINI.  You may wish to try the PPPClient.tini as the first step, using serial port
0.

Please let me know the results.

Thanks,

Peter



Nicolas Kral wrote:
The stack trace points to an exception being thrown by SetSerial in the
openSerialPort method. Can you find out which setSerial is throwing the
exception?


  
I read some issues in the list about steam read and CR / LF causing
exceptions.  Could
this be related?
      

No, I don't think so. If an exception is thrown in your openSerialPort
method, then I don't think the serial port will be in a good state when
it reached atCommand.

Nick

On Tue, 2003-06-24 at 16:59, Peter Bauer wrote:
  
Hi Nick,

I read some issues in the list about steam read and CR / LF causing
exceptions.  Could
this be related?  Thinking about atCommand getting a response.  I'm
going to go deeper
into the code.  Will let you know if I can isolate it any further.

Thanks,

Peter


Stack trace added. Output shown here -
==========================
tini00f170 /> java PPPClient.tini 0 tinidata cactus 2221234
main
before library loaded
after library loaded
new client created
before start client
after start client
Starting PPP client
A
B
java.lang.RuntimeException
   in com.dalsemi.system.TINIOS.setSerial(@JPC=3c0152)
   in com.dalsemi.system.TINIOS.setSerial(@JPC=3a002f)
   in PPPClient.openSerialPort(@JPC=350056)
   in PPPClient.run(@JPC=220014)
   in java.lang.Thread.run(@JPC=22001a)
atCommand write java.lang.NullPointerException
atCommand write java.lang.NullPointerException
tini00f170 />


Nicolas Kral wrote:
    
If I set the divisor an exception is thrown, so this is a moot
point.  If I use 9600 baud it get much
further, but also throws an acception after connecting to the ISP.
Again, I'm not sure why or how
to debug.  Is there any way to set breakpoints, walk the stack,
etc... I'm used to JTAG type
development and debug.  Not sure how to debug in this environment,
yet.
      
          
Somebody else is looking into what is happening at 9600 baud - that
looks like a PPP logic issue. What concerns me here is if the TINI is
talking to the device correctly. JTAG does little good if serial is
turning to info into goo. Have you tried talking to the part using a PC
java program - setting the PC to 14400, sending simple AT commands, etc?

The exception you are seeing is with the atCommand, which is a function
in PPPClient. One thing you can change is the catch statement at the
bottom. Change it to:

        catch (Exception e)
        {
            e.printStackTrace();
        }

and this will dump the stack.

Nick

On Tue, 2003-06-24 at 13:46, Peter Bauer wrote:
  
      
Nicolas Kral wrote:
    
        
        
          
I got serial0 hooked up to the Cermetek module (which requires 14,400 
baud).  
      
          
              
Are you certain? This seems like an output bitrate, not an input serial
baud rate.
      
          
The cermetek manual makes a very specific statement about needing to
use 14,400 baud rate.
Also, I called them because of a typo on this very point.

    
        
I used the equation div = 65536 - ( 14747 / ( 32 x 14.4 )  ) = 65504 
(rounded up)
    
        
            
For the most part, this formula looks correct. Can you verify in any way
if TINI is actually sending or receiving at that baud rate?
      
          
If I set the divisor an exception is thrown, so this is a moot point.
If I use 9600 baud it get much
further, but also throws an acception after connecting to the ISP.
Again, I'm not sure why or how
to debug.  Is there any way to set breakpoints, walk the stack, etc...
I'm used to JTAG type
development and debug.  Not sure how to debug in this environment,
yet.

The main issue seems that I can't change the baud rate from the
predefined list.

    
        
We were also curious if you could tell us what kind of server you are
trying to connect to.
      
          
The ISP told us that they manage access with 3COM hyper cards and
hyper access cards.  They
validate using radius.

Thanks,

Peter
    
        
Nick

On Mon, 2003-06-23 at 19:09, Peter Bauer wrote:
  
      
          
Hi Nick,

I got serial0 hooked up to the Cermetek module (which requires 14,400 
baud).  When I
change the divisor to get a 14,400 baud rate and exeption is thrown 
(atCommand ...).
Included is the output of pppclient without and with, respectively, a 
divisor change.  Also
included is the openSerialPort member of the PPPClient.java example and 
the one line
that I have added to set the divisor.  This line is commented out in the 
first output and
uncommected for the second.

I used the equation div = 65536 - ( 14747 / ( 32 x 14.4 )  ) = 65504 
(rounded up)

I believe the first run is throwing an exception because I've used the 
wrong baud rate
( to be determined ).  Not sure why this is happening.

Thanks,

Peter Bauer
ICT Computing

Doco follows -
=========

// Received this error - using 9600 baud and no divisor change

tini00f170 /> java PPPClient.tini 0 u p 2221234
main
before library loaded
after library loaded
new client created
before start client
Starting PPP client
after start client
Dialing
Connected to ISP
java.lang.StringIndexOutOfBoundsException
   in java.lang.Throwable.???
   in java.lang.Throwable.<init>(@JPC=4)
   in java.lang.Exception.<init>(@JPC=2)
   in java.lang.RuntimeException.<init>(@JPC=2)
   in java.lang.IndexOutOfBoundsException.<init>(@JPC=2)
   in java.lang.StringIndexOutOfBoundsException.<init>(@JPC=2)
   in java.lang.String.<init>(@JPC=10001e)
   in java.lang.String.<init>(@JPC=f0006)
   in com.dalsemi.tininet.ppp.Pap.authNak(@JPC=1f0018)
   in com.dalsemi.tininet.ppp.Pap.newPacket(@JPC=e002d)
   in com.dalsemi.tininet.ppp.PPP.run(@JPC=220060)
   in java.lang.Thread.run(@JPC=22001a)


// Received this error when setting the divisor

tini00f170 />
tini00f170 /> java PPPClient.tini 0 u p 2221234
main
before library loaded
after library loaded
new client created
before start client
after start client
Starting PPP client
java.lang.RuntimeException
atCommand write java.lang.NullPointerException
atCommand write java.lang.NullPointerException
tini00f170 />


// Code snippet of openSerialPort member in PPPClient.java example - 
nothing else changed

    /**
     * Open serial port
     */
    private boolean openSerialPort(int portNum)
    {
        // Enable serial port
        try
        {
            if (portNum != 0)
                TINIOS.setSerial(TINIOS.SERIAL_SET_ENABLE, portNum, true);
        }
        catch (UnsupportedCommOperationException _)
        {
            System.out.println("Exception enabling serial port " + portNum);
            return false;
        }

        try
        {

            portId = CommPortIdentifier.getPortIdentifier("serial" + 
portNum);

            serialPort = (SerialPort)portId.open(interfaceName, 10);

            serialPort.setSerialPortParams(9600,
                                           SerialPort.DATABITS_8,
                                           SerialPort.STOPBITS_1,
                                           SerialPort.PARITY_NONE);

            // Change baud rate to 14,400 - THIS LINE WAS ADDED
            TINIOS.setSerial( TINIOS.SERIAL_EX_SET_DIVISOR, portNum, 
65504 );

            portId.addPortOwnershipListener(this);

            // If control signals are available, configure control 
signals for serial 0 and

1 then enable flow control
            if (haveControlLines)
            {
                if (portNum == 0)
                {
                    
TINIOS.setSerial(TINIOS.SERIAL_SET_RTSCTS_FLOW_CONTROL, 1, false);
                    
TINIOS.setSerial(TINIOS.SERIAL_SET_RTSCTS_FLOW_CONTROL, 0, true);
                }
                else if (portNum == 1)
                {
                    
TINIOS.setSerial(TINIOS.SERIAL_SET_RTSCTS_FLOW_CONTROL, 0, false);
                    
TINIOS.setSerial(TINIOS.SERIAL_SET_RTSCTS_FLOW_CONTROL, 1, true);
                }

                // Enable RTSCTS flow control
                
serialPort.setFlowControlMode(serialPort.FLOWCONTROL_RTSCTS_IN |

serialPort.FLOWCONTROL_RTSCTS_OUT);
            }
            // No control lines are available, disable control signals 
for serial 0 or 1

then disable flow control
            else
            {
                // Disable RTSCTS flow control
                serialPort.setFlowControlMode(serialPort.FLOWCONTROL_NONE);
            }


            modemInputStream = serialPort.getInputStream();

            modemOutputStream = serialPort.getOutputStream();

            // Clear any old input data
            long available = modemInputStream.available();
            if (available > 0)
                modemInputStream.skip(available);

            // Flush any old output data
            modemOutputStream.flush();

            // Reset modem
            resetModem();

        }
        catch (Exception e)
        {
            System.out.println(e.toString());
            return false;
        }

        return true;
    }
    
        
            
  
      
          
  
      


  

Attachment: setdiv.zip
Description: Zip compressed data

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise