Professional Documents
Culture Documents
Document history
coalesenses 2 / 30
research to innovate
iSense Ethernet Gateway User Guide
Contents
coalesenses 3 / 30
research to innovate
iSense Ethernet Gateway User Guide
coalesenses 4 / 30
research to innovate
iSense Ethernet Gateway User Guide
coalesenses 5 / 30
research to innovate
iSense Ethernet Gateway User Guide
1. General Description
The iSense Ethernet Gateway is based on a Jennic JN5148 wireless microcontroller [5], a chip that
combines the controller and the wireless communication transceiver in a single housing.
The controller provides 32 bit RISC computation and runs at a software-scalable frequency between 4
and 32 MHz. It comprises 128kbytes of memory that are shared by program code and data. The
advantage of this choice is that memory consumption of program code and data can be traded.
Opposite to other controllers where the user is limited to a certain amount of data and code memory,
free choices that are only bounded by the sum of both become possible here.
The radio part complies with the IEEE 802.15.4 standard [6]. It achieves a data rate of 250 kBit/s,
provides hardware AES encryption and is ZigBee-ready. Besides IEEE 802.15.4 standard compliant
operation, the radio transceiver provides two additional modes of operation, offering increased data
rates of 500 kBit/s and 667 kBit/s. It reaches a receive sensitivity of -98dBm (at 250 kBit/s) and a
transmit power of up to 10 dBm.
Apart from that the Ethernet Gateway is equipped with an IEEE 802.3i complaint 10BaseT 10Mbit
full-duplex interface which allows to build a gateway between IEEE 802.15.4 wireless sensor
networks and Ethernet based LAN infrastructures. Another benefit is the microSD slot which to allows
to read and write data to a microSD card.
To enable long, but still synchronous sleep and wakeup cycles, the module is equipped with a high
precision clock (error < 3ppm). The Core Module also features software-switchable LEDs for
debugging purposes.
There is a 34 pin connector (X1) on both sides of the module where other modules can be attached to
the Core Module. It can supply up to 500mA to other modules.
The controller can be programmed in various ways. While over-the-air programming (OTAP) is
possible and considered to be the standard procedure, the program can also be transferred via the
gateway module, or using a special programming adapter that mates with corresponding pads on the
module.
While by default powered by a wall mount adapter directly connected to the gateway, it can also be
supplied with power over the Ethernet cable by using an optional power injector, enabled by setting
the jumpers J1/J2.
coalesenses 6 / 30
research to innovate
iSense Ethernet Gateway User Guide
X1 System connector for plugging an iSense Core Module or other iSense modules
P Power Connector
SD microSD slot
B1 User Button
coalesenses 7 / 30
research to innovate
iSense Ethernet Gateway User Guide
coalesenses 8 / 30
research to innovate
iSense Ethernet Gateway User Guide
bool full_duplex );
Description:
Extended constructor of the Net10 module, which allows to set the MAC-Address of the Ethernet
interface, the length of the receive buffer and, and whether or not the interface should operate in full
duplex mode. Instances of SDCard and Enc28J60 are created as well, when activated in the systems
configuration file isense/config.h.
Parameters:
Net10Module::Net10Module( Os &os );
Description:
Initializes the Net10Module class. By default, the LEDs are switched off. Instances of SDCard and
Enc28J60 are created as well, when activated in the systems configuration file isense/config.h.
Parameters:
3.3. set_led
Description:
Switches on the modules LEDs (regardless of prior state).
Parameters:
led Number of LED to use. Use 0 to switch on LED1 and 1 to switch on LED2.
on Turns the LED on when set to true, turns the LED off when set to false
coalesenses 9 / 30
research to innovate
iSense Ethernet Gateway User Guide
3.4. set_button_handler
Description:
Sets the ButtonHandler that will be called when the button B1 is pressed or released. The
ButtonHandler class can be found in isense/button_handler.h
Parameters:
button_handler Instance of the class ButtonHandler that should be called when the
button is pressed or released.
Returns:
true if the ButtonHandler could be registered, false elsewise.
3.5. ethernet
Enc28J60* Net10Module::ethernet( );
Description:
Returns the instance of the Enc28J60 Ethernet module, that was instantiated together with the
Net10Module
Returns:
Pointer to the Enc28J60 instance of the Net10Module instantiated by the constructor
Required modules:
3.6. sd_card
SDCard* Net10Module::sd_card( );
Description:
Returns the instance of the SDCard module that was instantiated together with the Net10Module
Returns:
Pointer to the SDCard instance that was instantiated by the constructor of the Net10Module
Required modules:
coalesenses 10 / 30
research to innovate
iSense Ethernet Gateway User Guide
4.1. Constructor
SDCard::SDCard( OS& os );
Description:
Standard constructor. NOTE: An instance of SDCard is created when instantiating the
NET10Module. That instance can be obtained using the sd_card method, see 3.6.
Parameters:
4.2. is_ready
bool SDCard::is_ready( );
Description:
Returns if a fully initialized SD Card is in the SD card slot
Returns:
true if a SD-Card is inserted in the SD-Card slot which can be operated, false elsewise
4.3. is_write_protected
bool SDCard::is_write_protected( );
Description:
coalesenses 11 / 30
research to innovate
iSense Ethernet Gateway User Guide
4.4. get_number_of_blocks
uint32 SDCard::get_number_of_blocks( );
Description:
Returns the number of blocks of the currently inserted SD-Card
Returns:
Number of blocks of the SD-Card
4.5. access
Description:
Reads or writes data to the SD Card. The returned value is the status code. Its upper 3 bytes are don’t
care bits. A successful write operation is indicated with a value of 5, a successful read operation with
0.
Parameter:
buffer Pointer to a buffer to/from which blocks are copied from/to the SD Card
Returns:
Status code indicating whether the desired operation was successful or not. The upper three bits are
don’t care bits, the lower 5 indicate the status. A Value of 5 of the 5 lower bits indicate a successful
write operation, a value of 0 successful reading.
4.6. access_block
Description:
Reads or writes data to the SD Card
coalesenses 12 / 30
research to innovate
iSense Ethernet Gateway User Guide
Parameter:
length Determines how many bytes should be accessed. The length must be a
multiple of 512
buffer Pointer to a buffer to/from which blocks are copied from/to the SD card
Returns:
Status code indicating whether the desired block-operation was successful or not. The upper three bits
are don’t care bits, the lower 5 indicate the status. A Value of 5 of the 5 lower bits indicate a
successful write operation, a value of 0 successful reading.
4.7. read
Description:
Reads a given number of bytes from a certain address of the SD Card. The method behaves exactly
like access, since it only calls access with the parameter write set to false.
Parameter:
buffer Pointer to a buffer to which blocks are copied from the SD Card
Returns:
Status code indicating whether the desired read-operation was successful or not. The upper three bits
are don’t care bits, the lower 5 indicate the status. A value of 0 indicates success.
4.8. read_block
Description:
Reads a given number of blocks starting at a certain block from the SD card. The method behaves
exactly like access, since it only calls access with the parameter write set to false.
Parameter:
coalesenses 13 / 30
research to innovate
iSense Ethernet Gateway User Guide
length Determines how many bytes should be accessed. The length must be a
multiple of 512
buffer Pointer to a buffer to/from which blocks are copied from/to the SD Card
Returns:
Status code indicating whether the desired read-operation was successful or not. The upper three bits
are don’t care bits, the lower 5 indicate the status. A value of 0 indicates success.
4.9. write
Description:
Writes a given number of bytes to a certain address of the SD card. The method behaves exactly like
access, since it only calls access with the parameter write set to true.
Parameter:
buffer Pointer to a buffer to which blocks are copied from the SD Card
Returns:
Status code indicating whether the desired write-operation was successful or not. The upper three bits
are don’t care bits, the lower 5 indicate the status. A value of 5 indicates success.
4.10. write_block
Description:
Writes a given number of blocks starting at a certain block to the SD Card. The method behaves
exactly like access, since it only calls access with the parameter write set to true.
Parameter:
length Determines how many bytes should be written. The length should be a
multiple of 512
buffer Pointer to a buffer to which blocks are copied from the SD Card
Returns:
coalesenses 14 / 30
research to innovate
iSense Ethernet Gateway User Guide
Status code indicating whether the desired block-operation was successful or not. The upper three bits
are don’t care bits, the lower 5 indicate the status. A value of 5 indicates success.
5.1. constructor
Description:
Constructor of the Ethernet Module
Parameter:
full_duplex If true the full duplex mode will be turned on, half duplex when false
coalesenses 15 / 30
research to innovate
iSense Ethernet Gateway User Guide
5.2. send
void Enc28J60::send( const uint64 dest_addr, uint16 len, const uint8 buf,
uint8 options, Sender* sender );
Description:
Sends data using the Ethernet controller. The passed data will automatically embedded in an Ethernet
frame and sent to the interface with dest_addr.
Parameters:
5.3. enable
void Enc28J60::enable( );
Description:
Switches on the Ethernet controller
5.4. enable
void Enc28J60::disable( );
Description:
Switches off the Ethernet controller
5.5. set_receiver
Description:
Sets an instance of class Receiver, that will be called upon reception of Ethernet packets.
Parameters:
receiver Instance of class Receiver which should get passed received packets
coalesenses 16 / 30
research to innovate
iSense Ethernet Gateway User Guide
Returns:
true if the receiver was registered successful, false elsewise
5.6. address
uint64 Enc28J60::address( );
Description:
Returns the current MAC address of that interface
Returns:
Current MAC-Address of the Ethernet interface. REMEMBER: Only the lower 48bits must be
considered for determining the address, the upper 16bits are usually set to zero.
5.7. max_packet_size
uint32 Enc28J60::max_packet_size( );
Description:
Returns the maximum size of a packet that can be sent over that interface at once
Returns:
Maximum Transmission Unit (MTU) of the link. For Ethernet this value is 1500bytes.
coalesenses 17 / 30
research to innovate
iSense Ethernet Gateway User Guide
You can now import the application into Eclipse. Choose “File” “Import” from the menu bar to
open the “Import” dialog.
coalesenses 18 / 30
research to innovate
iSense Ethernet Gateway User Guide
Click on “Browse…”, and select the directory of the Core Module demo application, i.e.
NET10DemoApplication in the iApps directory.
coalesenses 19 / 30
research to innovate
iSense Ethernet Gateway User Guide
If it doesn’t, the typical reason is that there is already a project called “NET10DemoApplicati
“ DemoApplication” in
Eclipse, i.e.
• you imported the NET10DemoApplication
NET10 before or
• you created or imported a project with the same name before.
Be sure not to check “Copy projects into workspace” in the above dialog. Finish the import by clicking
on the “Finish” button.
NET10DemoApplication” project in the “Project Explorer”.
As a result, you will find the “NET10 Explorer”
coalesenses 20 / 30
research to innovate
iSense Ethernet Gateway User Guide
As a result, the “Console” view displays the compiler output during the build process. After that, it
should look similar to the output depicted below.
coalesenses 21 / 30
research to innovate
iSense Ethernet Gateway User Guide
After the build finished, the console output should look similar as shown above.
JN5148 iApps/NET10DemoApplication/bin/JN51
DemoApplication/bin/JN5148/NET10DemoApplication.bin
DemoApplication.bin
class UG_NET10DemoApplication
NET10DemoApplication :
public Application,
public ButtonHandler,
public Task
{
public:
UG_NET10DemoApplication
NET10DemoApplication(Os &os);
// inherited from application, called upon device boot
void boot();
coalesenses 22 / 30
research to innovate
iSense Ethernet Gateway User Guide
}
}
Within the boot() method, a Net10Module object is created. If the allocation was successful, the
application registers itself as ButtonHandler for button events of the Net10Module. Next the
pointer to the SDCard instance is retrieved. An instance of the SDCard is created together with the
Net10Module. If an instance of SDCard exists, a Task will be registered, that will periodically
queriy the SD Card slot until a card is inserted and then output the number of its sectors.
An application can register itself at the OS as a Task to receive a callback immediately, at a certain
time, or after a certain interval. Task callbacks are called in the regular application context. They
cannot interrupt other activities, and hence may be delayed. Task execution can take an arbitrary time,
and is hence suited for longer activities such as complex computations.
coalesenses 23 / 30
research to innovate
iSense Ethernet Gateway User Guide
Once a class inherits the isense::Task interface and implements the corresponding method, it is a
task and can be registered at the operating system for later callback.
For tasks, the OS provides three methods for registering tasks to be executed as soon as possible, at a
certain time, or after a certain interval from now on.
//-----------------------------------------------------------------------
/** This method enqueues the given task into the queue of tasks
* Its execute method is called during the main control flow
*
* \param task object implementing the Task interface, whose execute
* method is called
* \param userdata an arbitrary pointer that is passed back again
* to the callback
*
* \return true if task was enqueued successfully, false otherwise (e.g.
* if the task queue is full)
*
*/
bool add_task(Task *task, void* userdata);
//-----------------------------------------------------------------------
/** This method enqueues the given task in the queue of lower priority
* tasks. Its execute method is called during the main control flow
*
* \param interval Point in time when the callback will be called
* \param task object implementing the Task interface, whose execute
* method is called
* \param userdata an arbitrary pointer that is passed back again
* to the callback
*
* \return true if task was enqueued successfully, false otherwise (e.g.
* if the task queue is full)
*/
bool add_task_at(Time time, Task *task, void* userdata);
//---------------------------------------------------------------------
/** This method enqueues the given task in the queue of lower priority
* tasks. Its execute method is called during the main control flow
*
* \param interval Time period after which the callback will be called
* \param task object implementing the Task interface, whose execute
* method is called
* \param userdata an arbitrary pointer that is passed back again
* to the callback
*
* \return true if task was enqueued successfully, false otherwise (e.g.
* if the task queue is full)
*/
bool add_task_in(Time interval, Task *task, void* userdata);
All methods for registering tasks at the OS feature a so called userdata parameter. It can be used to
attach additional information to a task, that is then passed to the execute method when it is called. If
you don’t use the feature, simply pass NULL.
coalesenses 24 / 30
research to innovate
iSense Ethernet Gateway User Guide
void
NET10DemoApplication::
execute (void* userdata )
{
if ( userdata == (void*) USERDATA_SD_CARD_METRICS ){
//Check if a SD-Card is inserted
if ( sd_card_ -> is_ready( ) )
{
os_.debug(“SDCard has %d blocks”,
sd_card_->get_number_of_blocks( ) );
} else {
os_.debug(“SDCard is not inserted or ready”);
os_.add_task_in( Time( 2, 0 ), this,
(void*)USERDATA_SD_CARD_METRICS)
}
}
}
The execute-callback-method will be called the first time 1 second after boot, passing it
USERDATA_SD_CARD_METRICS as userdata parameter. It checks if a SD Card is inserted and if, it will
print the number of blocks of the inserted card. If no card was detected another Task is registered,
that will check the SDCard status again in 2 seconds. This will be repeated until a card is inserted.
An application can register itself at the Net10Module as a ButtonHandler to receive a callback,
when a certain button is pressed. ButtonHandler callbacks are called within a Task context, they
cannot interrupt other activities, and hence may be delayed.
coalesenses 25 / 30
research to innovate
iSense Ethernet Gateway User Guide
When the button of the Ethernet Gateway Module is pressed the led_value_ variable modified and
takes a value between 0 and 3 which represent one of the four possible combinations the two LEDs
can be stated in. After the LEDs have been switched the value of the button_counter_ is
incremented and written to the SD-Card. To verify that writing was successful, the previously written
data is read from the SD-Card and outputted to the iShell Serial Monitor . Any error is printed as well.
NOTE:
To be able to benefit from the SD-Card features without using a file system there are
several tools for the PC which allows for reading and writing from and to the SD-Card.
The simplest way to do so is to use Linux. To completely reset your card open a
Terminal window and figure out the device name of you your SD Card reader in the
/dev/ directory. Use DiskDump (dd) to reset your card. Type in
dd if=/dev/zero of=/dev/<SD Card reader device name>
To read all data from a SD Card use
coalesenses 26 / 30
research to innovate
iSense Ethernet Gateway User Guide
Reset SD-Card:
dd if=/dev/zero of=/dev/disk1
You can send character output to the outside world using the methods Os::debug and Os::fatal:
//-------------------------------------------------------
** Logs the given string depending on the log mode to a uart or radio.
*/
void debug( const char *format, ...);
//-------------------------------------------------------
/** Logs the given string depending on the log mode to a uart or radio.
*/
void fatal( const char *format, ...);
They work similar to the well-known sprintf functions in regular C, i.e. integer values etc. can be
printed using the % notation. For example
uint16 i = 128;
os().debug("value of i is %d, hex=%x", i, i);
will output „value of i is 128, hex=0x80“. The destination of the debug output can be set using
Os::set_log_mode, the corresponding constants can be found in iSense/src/isense/os.h.
//-------------------------------------------------------
/** Sets the log mode to the given value, e.g.
* (ISENSE_LOG_MODE_UART0 | ISENSE_LOG_MODE_RADIO)
*/
void set_log_mode( uint8 mode ) {log_mode_ = mode; }
By default, the output destination is set to UART0, i.e. the output is sent to a PC via a connected
iSense Gateway Module.
coalesenses 27 / 30
research to innovate
iSense Ethernet Gateway User Guide
Observing the output of the NET10DemoApplication with iShell yields the above result.
coalesenses 28 / 30
research to innovate
iSense Ethernet Gateway User Guide
7. References
[1] coalesenses Development Environment Setup User Guide, online available at
http://www.coalesenses.com/download/UG_development_environment_setup_v1.9_web.pdf
[2] Flashing iSense devices wirelessly, online available at
http://www.coalesenses.com/download/UG_flashing_isense_devices_wirelessly_1v3.pdf
[3] coalesenses iShell User Guide, online available at
http://www.coalesenses.com/download/UG_ishell_v1.3.pdf
[4] coalesenses Writing iSense Applications User Guide, online available at
http://www.coalesenses.com/download/UG_writing_isense_applications_1v1.pdf
[5] Advanced Data Sheet – JN513x, online available at
http://www.jennic.com/support/view_file.php?fileID=0000000111
[6] IEEE Computer Society, IEEE Standard for Information technology – Telecommunications and
information exchange between systems – Local and metropolitan area networks – Specific
requirements, Part 15.4: Wireless Medium Access Control (MAC) and Physical Layer (PHY)
Specifications for Low-Rate Wireless Personal Area Networks (LR-WPANs),
http://standards.ieee.org/getieee802/download/802.15.4-2003.pdf
[7] Documentations and Demo Applications for iSense Devices are available at
http://www.coalesenses.com/index.php?page=isense-demos
coalesenses 29 / 30
research to innovate
iSense Ethernet Gateway User Guide
coalesenses GmbH
Maria-Goeppert-Str. 1
23562 Lübeck
Germany
www.coalesenses.com
sales@coalesenses.com
coalesenses 30 / 30
research to innovate