logo       

Re: atModem exception thrown is divisor is changed: msg#00652

hardware.microcontrollers.tini

Subject: Re: atModem exception thrown is divisor is changed

From the previous stack trace is was clear that two calls were being made to
setSerial. The first setSerial( int, int, int ) as shown in my sample code used to make
the call and then a call from within TINIOS.java to the 'real' setSerial( .... )
member.

The code hangs after printing - setSerial - before SERIAL_EX_SET_DIVISOR native

System.out.println("setSerial - before SERIAL_EX_SET_DIVISOR native");

return (tinios_DispatchNative( DISPATCH_EXTERNAL_SET_SERIAL_DIVISOR, dispatchBuffer) );

So, the problem seems obvious that the tinios_DispatchNative( DISPATCH_EXTERNAL_SET_SERIAL_DIVISOR, dispatchBuffer) is the cause of the exception. No?

Two days and zero headway on this issue.


Peter Bauer
ICT Computing, Inc.



public static synchronized int setSerial(int cmd, int port, byte [] arr) throws javax.comm.UnsupportedCommOperationException
{
System.out.println("setSerial - A");

switch(cmd)
{
case SERIAL_SET_ENABLE:
switch (port)
{
case 1:
enableSerialPort1(arr[0]==1);
break;
case 2:
case 3:
setExternalSerialPortEnable(port,arr[0]==1);
break;
default:
throw new javax.comm.UnsupportedCommOperationException("Operation not supported");
}
return 0;

case SERIAL_GET_ENABLE:
return (getExternalSerialPortEnable(port))?1:0;

case SERIAL_EX_SET_SEARCH_ENABLE:
setExternalSerialPortEnable(port,arr[0] == 1);
return 0;

case SERIAL_EX_GET_SEARCH_ENABLE:
return (getExternalSerialPortEnable(port))?1:0;

case SERIAL_EX_SET_PORT_ADDRESS:
int addy = (arr[0] & 0xFF) |
((arr[1] & 0xFF) << 8) |
((arr[2] & 0xFF) << 16) |
((arr[3] & 0xFF) << 24);
setExternalSerialPortAddress(port, addy);
return 0;

case SERIAL_EX_GET_PORT_ADDRESS:
return (getExternalSerialPortAddress(port));

case SERIAL_SET_BOOT_MESSAGE_STATE:
setSerialBootMessagesState(arr[0] == 1);
return 0;

case SERIAL_GET_BOOT_MESSAGE_STATE:
{
byte ret = sys_getDebugMessageStateNative();

return ((ret & BITBANG_DEBUG_MESSAGE_MASK) == 0)?1:0 ;
}


case SERIAL_SET_DEBUG_MESSAGE_STATE:
setDebugMessagesState(arr[0] == 1);
return 0;
case SERIAL_GET_DEBUG_MESSAGE_STATE:
{
byte ret = sys_getDebugMessageStateNative();

return ((ret & SERIAL_DEBUG_MESSAGE_MASK) == 0)?1:0 ;
}

case SERIAL_SET_RTSCTS_FLOW_CONTROL:
setRTSCTSFlowControlEnable(port, arr[0]==1);
return 0;
case SERIAL_GET_RTSCTS_FLOW_CONTROL:
return (getRTSCTSFlowControlEnable(port))?1:0;

case SERIAL_EX_GET_DIVISOR:
{
byte[] dispatchBuffer = new byte [4];

dispatchBuffer [0] = ( byte ) (port & 0xFF) ;

return (tinios_DispatchNative(
DISPATCH_EXTERNAL_GET_SERIAL_DIVISOR, dispatchBuffer) );
}
case SERIAL_EX_SET_DIVISOR:
{
byte[] dispatchBuffer = new byte [4];

dispatchBuffer [0] = ( byte ) (port & 0x0ff);
dispatchBuffer [1] = arr[0];
dispatchBuffer [2] = arr[1];

System.out.println("setSerial - before SERIAL_EX_SET_DIVISOR native");

return (tinios_DispatchNative(
DISPATCH_EXTERNAL_SET_SERIAL_DIVISOR, dispatchBuffer) );
}

default:
return -1;
}
}
/** setSerial is used to set serial port options in TINIOS
that can't be set using javax.comm. This is a helper
version for serial commands requireing boolean
arguments like SERIAL_SET_ENABLE.
@param cmd The serial port command to be executed
@param port The serial port to reference
@param arr For boolean operations, pass true or false.
@see com.dalsemi.system.TINIOS#setSerial(int,int,byte[])
*/

public static synchronized int setSerial(int cmd, int port, boolean arr) throws javax.comm.UnsupportedCommOperationException
{
System.out.println("setSerial - B");

setSerArgs[0] = (byte)((arr)?1:0);
return setSerial(cmd,port,setSerArgs);
}

/** setSerial is used to set serial port options in TINIOS
that can't be set using javax.comm. This is a helper
version for serial commands requireing integer
arguments like SERIAL_EX_SET_DIVISOR.
@param cmd The serial port command to be executed
@param port The serial port to reference
@param arr Integer argument to the command.
@see com.dalsemi.system.TINIOS#setSerial(int,int,byte[])
*/

public static synchronized int setSerial(int cmd, int port, int arr) throws javax.comm.UnsupportedCommOperationException
{
System.out.println("setSerial - C");

setSerArgs[0] = (byte)(arr & 0xFF);
setSerArgs[1] = (byte)((arr >> 8) & 0xFF);
setSerArgs[2] = (byte)((arr >> 16) & 0xFF);
setSerArgs[3] = (byte)((arr >> 24) & 0xFF);

return setSerial(cmd,port,setSerArgs);
}

_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/hBDgjK7y7TUQ@xxxxxxxxxxxxxxxx
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini



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

News | FAQ | advertise