X

This Blog covers the latest Java technology for small devices and security in the IoT, mobile, ID and Payment

Java ME Embedded 8.1 brings Java to ARM Cortex M4 and provides Eclipse users with tools for embedded development

Guest Author
A couple days ago, Java ME Embedded 8.1 was released. The new version of the Java ME Embedded platform has two significant enhancements. First, it works on ARM Cortex M4 with very limited RAM size by delivering a port for Freescale K64F. Second, it provides Eclipse IDE support in Java ME SDK. The link to the release page: http://www.oracle.com/technetwork/java/embedded/javame/embed-me/overview/index.html
 
FRDM-K64F is based on  MK64FN1M0VLL12 MCU (120 MHz, 1 MB flash memory, 256 KB RAM, low-power, crystal-less USB, and 100 Low profile Quad Flat Package (LQFP)). It is has a form-factor of Arduino™ R3 pin layout. The FRDM-K64F goes with a lot of peripherals to enable rapid prototyping. In addition to UART, I2C, SPI, and GPIO interfaces on board, it has 3 LEDs and 2 switches which are accessible from Java Runtime. Another helpful device that is integrated into K64F is accelerometer-magnetometer with I2C interface (FXOS8700Q). You can easily access it from your Java application and create a compass application, for instance. Find the code example below the post..
 
Java ME SDK 8.1 brings smooth experience of Java Embedded developers to the Eclipse world. Java ME SDK plugin for Eclipse is based on the recently released Mobile Tools for Java TM (MTJ) 2.0 which had been done with significant efforts of Oracle's engineers. Now, all impressive features of Java ME SDK, such as on-device debugging, memory and network monitors, CPU profiling, and memory profiling are available in Eclipse. To install it, you need just to go the OTN web, download and install Java ME SDK with Eclipse plugin http://www.oracle.com/technetwork/java/embedded/javame/javame-sdk/downloads
 
 
If you have any questions or suggestions, please speak up at our forum: https://community.oracle.com/community/java/java_embedded/java_me_embedded
The best source of information about Java ME Embedded is Java ME Documentation portal: http://docs.oracle.com/javame
 
 
How to get a device ID from FXOS78700Q on K64F:
public class FXOS8700Q extends MIDlet {private I2CDevice fxos8700q;final int FXOS8700Q_STATUS = 0x00;final int FXOS8700Q_OUT_X_MSB = 0x01;final int FXOS8700Q_OUT_Y_MSB = 0x03;final int FXOS8700Q_OUT_Z_MSB = 0x05;final int FXOS8700Q_M_OUT_X_MSB = 0x33;final int FXOS8700Q_M_OUT_Y_MSB = 0x35;final int FXOS8700Q_M_OUT_Z_MSB = 0x37;final int FXOS8700Q_WHOAMI = 0x0D;final int FXOS8700Q_XYZ_DATA_CFG = 0x0E;final int FXOS8700Q_CTRL_REG1 = 0x2A;final int FXOS8700Q_M_CTRL_REG1 = 0x5B;final int FXOS8700Q_M_CTRL_REG2 = 0x5C;final int FXOS8700Q_WHOAMI_VAL = 0xC7;final int UINT14_MAX = 16383;@Overridepublic void startApp() {
        ByteBuffer buffer = ByteBuffer.allocateDirect(1);try {
            fxos8700q = DeviceManager.open(300, I2CDevice.class);
            buffer = read(FXOS8700Q_WHOAMI, 1, 1);} catch (IOException ex) {
            ex.printStackTrace();}
        String id = String.format("%8s", Integer.toBinaryString(buffer.get(0) & 0xFF)).replace(' ', '0');
        System.out.println(id);}@Overridepublic void destroyApp(boolean unconditional) {}void write(int address, int addressSize, ByteBuffer data) throws IOException {
        fxos8700q.begin();
        fxos8700q.write(address, addressSize, data);
        fxos8700q.end();}
    ByteBuffer read(int address, int addressSize, int bytesToRead) throws IOException {
        ByteBuffer buffer = ByteBuffer.allocateDirect(bytesToRead);
        fxos8700q.begin();
        fxos8700q.read(address, addressSize, buffer);
        fxos8700q.end();return buffer;}
}

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services