Wednesday Feb 12, 2014

Register today for the Oracle Java ME Embedded MOOC!

https://apex.oracle.com/pls/apex/f?p=44785:145:2756555862650::NO::P145_EVENT_ID,P145_PREV_PAGE:861,148

We are pleased to announce that the Oracle Massive Open Online Course: Develop Java Embedded Applications Using a Raspberry Pi is open for enrollment.

The course will start March 31st!

Enroll

Java Embedded leverages your experience with Java to open the world of the Internet of Things by providing direct access to electronic sensors and mechanical devices.

This free course, designed for Java developers, is delivered over 5-weeks. Take the course at your own pace - weekly we will add new lessons, quizzes and homework assignments.

You will work on a real-world application to:

  • Read input data from switches and drive LED's using the GPIO interface
  • Read temperature and barometric pressure from an I2C device
  • Read the device's current location using a GPS UART device
  • Store and manage data collected
  • Report data to a client through a variety of communication options
  • And more!

See you in class!

Monday Oct 21, 2013

Are you interested in a free course on Java Embedded on the Raspberry Pi?

www.raspberrypi.org We are developing a free, on-line course on developing Oracle Java Embedded applications using a Raspberry Pi as the development platform. Interested? Read more about the course and give us your feedback in this short survey.

Monday Jul 29, 2013

Emulating I2C Devices with Java ME Embedded 3.3

In this post, I will show you how to create an emulated inter-integrated circuit (I2C) device using the Oracle Java ME SDK 3.3 Custom Device Editor and the Embedded Support API.

Oracle's Java ME SDK 3.3 is a fantastic tool to learn how to create applications for embedded devices. The focus of ME Embedded is the Information Module Profile - Next Generation (IMP-NG) headless devices - simple micro controllers with 160KB of memory (or more) designed to read sensor input or control small mechanical devices. The embedded market is growing rapidly as more devices become connected to the "internet of things."

New in the 3.3 version of the SDK is support for a host of peripheral devices, including GPIO, ADC/DAC, UART, I2C, SPI, MMIO and more. The SDK includes an emulator (for Windows) and you can choose between one of two default devices that support IMP-NG.

While the default emulator is useful to start learning Java ME Embedded, at some point you will want an emulator that resembles the target embedded device. This is where the Java ME SDK really shines, by allowing you to design your own emulator. Through the Custom Device Editor, provided with the Java ME SDK 3.3, you select the peripheral devices your physical embedded device supports, including all of relevant information to access the peripherals: hardware port number, pin number, trigger mode, etc. Designing an emulator that matches your physical embedded device can greatly shorten the development cycle of an embedded application.

Start the Custom Device Editor from the command line C:\Java_ME_platform_SDK_3.3\bin\device-editor.exe or through NetBeans and Eclipse. Using the editor, you specify GPIO pins and ports, ADC and DAC devices, and pulse counters as needed. To add serial communication devices (I2C, SPI and MMIO), the editor provides two options: add a simple loopback that echoes back bytes as they are written to the device, or add an implementation of the device using the embedded support API.

Of the three serial bus specifications, I2C is the simplest. It is a two-wire protocol, thus requiring only four lines. For more detailed information on the specification, click here.

The installation directory of the Java ME SDK 3.3, C:\Java_ME_platform_SDK_3.3, contains the documentation and a JAR for the Embedded Support API. Expand the embedded-support-api.zip file located under \docs\api and look at the com.oracle.jme.toolkit.deviceaccess.i2c package.

To emulate an I2C device, you create a class that implements the I2CSlaveBus interface. In NetBeans (or Eclipse) create a Java ME Embedded Application project. Add the \lib\embedded-support-api.jar to the project, then add a Java class that implements the interface:

public class TMP102Device implements I2CSlaveBus { ... }

There are just four methods to implement:

  • int read(byte[] data, int len, I2CSlaveBus.I2CSlaveIdentifier id)
  • void write(byte[] data, I2CSlaveBus.I2CSlaveIdentifier id)
  • void initialize(I2CSlaveBus.I2CSlaveIdentifier id)
  • void close(I2CSlaveBus.I2CSlaveIdentifier id)

The read method writes bytes into the byte array passed to the method as an argument and returns a count of the bytes written to the array. The write method can be used to signal the device for some action. The initialize method is called every time the device is accessed through a PeripheralManager.open call - this method can be used to reset the internal state of your emulated device. Finally, the close method should release any resources the emulated device is using.

I choose to emulate a simple I2C temperature device, the Texas Instruments TMP102, a digital temperature sensor with I2C communication capability. After power-on, this device returns two bytes from an internal buffer every time it is read. The first byte contains the left-most 8 bits of a 12-bit word, and the second byte contains the 4 least significant bytes.

This 12-bit value represents a count of 0.0625 degree (Celsius) increments, using the first high order bit to indicate values below 0. Positive temperature values are converted directly to an integer and multiplied by the increment to get the temperature value. For example, if the 12-bit word is 0x320 (0011 0010 000), the temperature is calculated as 0x320 = 800 * 0.0625 = 50 degrees Celsius.

Negative temperature values have a 1 in the high-order bit, and the temperature value is calculated by the 2's complement of the count minus 1. For example, if the 12-bit word is 0xE70 (1110 0111 0000), the temperature is calculated as 0xE70 - 1 = 0xE6F (1110 0110 1111), 2's complement = 0001 1001 000 = 400 * (-0.0625) = -25 degrees C.

Rather than just create a static TMP102 device (returning the same temperature over and over), the class I wrote simulates temperature fluctuations with a thread that randomly changes the "temperature" value by a maximum of +/- .5 degree C every 5 seconds. I start this thread in the initialize method and kill it through the close method. The timing and range of temperature fluctuations is adjustable. To see the complete code, click here to download the NetBeans project for the TMP102 emulator.

 To add the TMP102 device to a custom emulator, start by creating a jar file of the project. In NetBeans, you can right-click the project and select Build. A jar file will be created in the dist folder of your NetBeans project.

Next create or modify an existing custom IMP-NG emulator. Start the Custom Device Editor from the command line or through your IDE. Select IMP-NG in the Custom Device Editor Dialog and click New to create a new IMP-NG emulator device, or select one you already have and click Edit.

In the IMP-NG Device editor window, select the I2C tab. Click Custom, then click the Browse button to navigate to the directory where the jar file is located. The implementation class name is the fully qualified name of the I2CSlaveBus class. Enter oracle.example.TMP102Device in the Implementation Class Name field. Click the Add button in the lower right to create a Slave entry.

At this point, you can choose to modify the ID, Name, Bus Number, Address Size and Address of the slave device by clicking in each field and typing. Since my design goal is to emulate a TMP102 device connected to a Raspberry Pi, Model B, I changed the bus number to 1 and the address to 48 (this is a hex number). I2C devices on the Pi use bus 1, and the default address and address size of the TMP102 is 0x48 (72) and 7-bit.

Finally, click OK, and in a few minutes you will see a message that the new/updated emulator is registered with the Device manager. Next, write some code to test the emulated I2C device. You could open the device using the String name of the emulated device like this:

I2CDevice tmp102 = (I2CDevice) PeripheralManager.open("Slave0", I2CDevice.class, null);

However, to emulate opening the device the way it would be opened when attached to a Raspberry Pi, you need to create an I2CConfig object first and pass that to PeripheralManager to open the device:

I2CDeviceConfig config = new I2CDeviceConfig(1, 0x48, 7, 10000); // Bus 1, address 0x48, 7-bit addressing, 10KHz clock

I2CDevice tmp102 = (I2CDevice) PeripheralManager.open(config);

If you prefer, you can run this small NetBeans embedded application project I created to test the emulated TMP102 device.

Enjoy!

Friday May 03, 2013

Are You Ready to Start Java Embedded Programming?

Oracle has produced some excellent demonstrations and documentation that show you how to get started programming embedded devices using the Java language. The two devices highlighted are the Keil ARM evaluation board and the Raspberry Pi board.

Check out Working with Java ME Embedded and Raspberry Pi - Series and Working with Java ME Embedded on the Keil ARM Evaluation Board - Series.

You will learn how to install the Java binaries on the boards and run sample Java application on the board. Have fun.

Wednesday Feb 06, 2013

JavaOne 2012 Videos Posted on OracleLearning YouTube Channel

Did you miss the 201OracleLearning YouTube Channel JavaOne Playlists2 JavaOne? Well, now you can catch up on many of the sessions, including conference presentations, birds-of-a-feather events, and tutorials. We posted most of the recorded sessions on the Oracle Learning Library's YouTube channel. The videos are sorted in playlists by the session tracks, and there are a total of 7 tracks. We have over 450 JavaOne videos for you to view!


Friday Jul 20, 2012

New and Updated Java Courses

The Java Curriculum team has developed several courses that are available through Oracle University.  The courses are available as instructor-led training (ILT), live virtual classrooms (LVC), and training on demand. Our titles include:

Java SE 7 Fundamentals - The Java SE 7 Fundamentals teaches students who have little or no programming experience about the Java programming language. The course teaches students the significance of object-oriented programming, the keywords and constructs of the Java programming language, and the steps required to create simple Java technology programs.">

Java SE 7 Programming - The second of two courses that cover the Java Standard Edition 7 (Java SE 7) Platform explores the core Application Programming Interfaces (API) developers use to design and develop object-oriented applications with Java.

Java SE7: Develop Rich Client Applications - The course takes students through the process of designing a rich client application in a case study approach – analysis and design, and development of the key components of the application using the rich set of JavaFX graphics and media API.

Java SE 7 New Features - This new features course delves into the major changes and enhancements in the Oracle Java SE 7 release. This course is meant for the Java professionals who are already proficient with developing Java programs using Java SE 6 or earlier Java SE platforms.

Java ME: Develop Applications for Mobile Phones - This course teaches students how to use Connected Device Limited Configuration (CDLC) and the Mobile, Interface Device Profile (MIDP), and the Lightweight User Interface Toolkit (LWUIT) to develop applications for smart phones. Students get to develop applications that access a mobile database, and leverage the Location and Payment APIs.

Several of our courses support the Java Certification programs, which you can search for on the Oracle University Certification pages

If you are interested in free Java training, we are posting new Java content on the Oracle Learning Library on a regular basis. If you want to stay current, subscribe to the OLL using the RSS feed.

About

Information relating to Java training development and events.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today