Forum Stats

  • 3,852,357 Users
  • 2,264,095 Discussions
  • 7,905,046 Comments

Discussions

Setting static IP Address in Java ME 8.1 for Freescale MBED K64F

luisdiaz-Oracle
luisdiaz-Oracle Member Posts: 5 Employee
edited Oct 6, 2014 8:55AM in Java ME Embedded

Having a few issues setting the IP address statically on the K64F.  I've placed the jwc_properties.ini file in the java directory on the SD card with the additional entries placed at the bottom of the file:

ip_method=static

ip_address=192.168.32.2

ip_netmask=255.255.255.0

ip_gateway=192.168.32.1

However, it always defaults to DHCP, how can I verify if the jwc_properties.ini file is being read?  Also, when trying to start the CLI I receive an exception as such:

C:\Users\lad\Desktop\oracle-jmee-8-1-dp-fs-k64-mbed-bin\util>java -jar proxy.jar -socket 192.168.32.2

Proxy CLI shell failed to start listen due to java.net.BindException: Address already in use: JVM_Bind

java.net.BindException: Address already in use: JVM_Bind

        at java.net.DualStackPlainSocketImpl.bind0(Native Method)

        at java.net.DualStackPlainSocketImpl.socketBind(Unknown Source)

        at java.net.AbstractPlainSocketImpl.bind(Unknown Source)

        at java.net.PlainSocketImpl.bind(Unknown Source)

        at java.net.ServerSocket.bind(Unknown Source)

        at java.net.ServerSocket.<init>(Unknown Source)

        at com.oracle.midp.cli.TcpTransport.startListen(TcpTransport.java:41)

        at com.oracle.midp.cli.ShellImpl$CLIShellThread.run(ShellImpl.java:132)

        at java.lang.Thread.run(Unknown Source)

Trying to open socket connection with device: 192.168.32.2:2201

Connected to the socket: Socket[addr=/192.168.32.2,port=2201,localport=49448]

Open channel 8 with hash 0x7d87edff

Channel 8 CLOSED -> OPENED

notifyResponse AVAILABLE_RESPONSE on channel 8

Channel 8 OPENED -> AVAILABLE

Open channel 9 with hash 0x0

Channel 8 AVAILABLE -> REQUEST_SENT

notifyResponse ACK_RESPONSE on channel 8

Channel 8 REQUEST_SENT -> ACKNOWLEDGED

Channel 8 ACKNOWLEDGED -> DATA_SENT

notifyResponse AVAILABLE_RESPONSE on channel 8

Channel 8 DATA_SENT -> AVAILABLE

Channel 8 AVAILABLE -> REQUEST_SENT

notifyResponse ACK_RESPONSE on channel 8

Channel 8 REQUEST_SENT -> ACKNOWLEDGED

Channel 8 ACKNOWLEDGED -> DATA_SENT

notifyResponse AVAILABLE_RESPONSE on channel 8

Channel 8 DATA_SENT -> AVAILABLE

Any ideas?

Thanks,
Luis

Answers

  • luisdiaz-Oracle
    luisdiaz-Oracle Member Posts: 5 Employee

    One clarification, I configured the dhcp server on my Mac to serve up the 192.168.32.2 IP address via a reservation for now, but I would ideally like to set the IP address statically.

  • luisdiaz-Oracle
    luisdiaz-Oracle Member Posts: 5 Employee

    I'm starting to think I'm having a larger issue at hand.  Writing a simple MIDLet that opens the LEDS port using the DeviceManager, the application continually hangs:

    public class K64F_LEDTest extends MIDlet {

        static final int LED_PORT_ID = 8;

        static final String LED_PORT_NAME = "LEDS";

       

        private GPIOPort ledPort = null;

       

        @Override

        public void startApp() {

            System.out.println("In startApp()");

           

            try {  

                System.out.println("Assigning LED Port...");  

                ledPort = (GPIOPort)DeviceManager.open(LED_PORT_ID);

            } catch (Exception ex) {

                Logger.getLogger(JavaMEApplication6.class.getName()).log(Level.SEVERE, null, ex);               

            }

    ...

    The error on the console is:

    [ERROR] [FILE] iso=-1:can't calculate utf16 file name length

    Could this be related to the SD card issue?

  • Yes, sorry, we are seeing some issues with setting static IP addresses. I just posted this:

    Update on tooling with Java ME Embedded 8.1 Developer Preview

    -- Terrence

  • Hi,

    There is no LED port 8, only 1 to 3. PLease check the list of preconfigured devices in the Getting Started Guide (Device I/O Preconfigured List) and let me know if that works.

    Best,

    -- Terrence

  • luisdiaz-Oracle
    luisdiaz-Oracle Member Posts: 5 Employee

    Terrence,

       Thank you for responding and confirming the issues I'm having with static addressing.  As far as the example above, I do have the standard LEDs working correctly, however, the example I'm referring to above is from the JavaME samples using the GPIO Port for the LEDS, according to the Device I/O Preconfigured List you referenced:

    GPIO Ports

    The following GPIO ports are preconfigured.

    Devicel IDDevice NameMappedConfiguration

    8

    LEDS

    PTB22

    PTE26

    PTB21

    direction = 1 (Output only)

    initValue = 0

    GPIOPins:

    controllerNumber = 1

    pinNumber = 22

    mode = 4 (Push-pull mode)

    controllerNumber = 4

    pinNumber = 26

    mode = 4 (Push-pull mode)

    controllerNumber = 1

    pinNumber = 21

    mode = 4 (Push-pull mode)

    So is the assumption that using GPIOPort for accessing the GPIO port for Device ID 8 as listed in the Device I/O Preconfigured list not supported?

  • Hi,

    Sorry, my mistake, I mixed up ports and pins. Yes, the port is defined as DeviceID 8, but you don't actually have to open the port. Just open the GPIO pin you need.

    Also, what do you mean by "the application continually hangs"?

    PS:

    The console output "[ERROR] [FILE] iso=-1:can't calculate utf16 file name length" can be ignored ... it is a known problem and should not affect the operation of your application.

    Best,

    -- Terrence

  • Hi Luis,

    With regards to CLI problem, you seem to have Device Manager from ME SDK running on your host and it conflicts with the proxy you're starting manually by using the same TCP port. You should either:

    1. connect ME SDK to the K64 board using it's Device Manager. Then connect to CLI port provided by ME SDK

    2. stop ME SDK Device Manager (use icon in windows tray) and start proxy manually (java -jar proxy.jar ...)

    but approaches 1 and 2 could not be used simultaneously!

    Regards,

    Andrey

This discussion has been closed.