background image

 

 

 

 

 

16 / 30

 

iSense Ethernet Gateway User Guide  

coalesenses

 

research to innovate 

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: 

dest_addr 

Destination address of the data 

len 

Length of data to send 

buf 

Pointer to the data to send 

options 

Not considered 

sender 

Not considered 

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 

bool Enc28J60::set_receiver( Receiver* 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 

Summary of Contents for iSense

Page 1: ...iSense Ethernet Gateway User Guide ...

Page 2: ...2 30 iSense Ethernet Gateway User Guide coalesenses research to innovate Document history Version Date Changes 1 0 30 08 2011 Initial version 1 1 04 05 2012 Minor corrections ...

Page 3: ...cription 11 4 1 Constructor 11 4 2 is_ready 11 4 3 is_write_protected 11 4 4 get_number_of_blocks 12 4 5 access 12 4 6 access_block 12 4 7 read 13 4 8 read_block 13 4 9 write 14 4 10 write_block 14 5 Enc28J60 API Description 15 5 1 constructor 15 5 2 send 16 5 3 enable 16 5 4 enable 16 5 5 set_receiver 16 5 6 address 17 5 7 max_packet_size 17 6 Ethernet Gateway Module Demo Application 17 6 1 Obtai...

Page 4: ...iSense Ethernet Gateway User Guide coalesenses research to innovate 6 3 Flashing the Ethernet Gateway Module Demo Application 22 6 4 Ethernet Gateway Module Demo Application functionality 22 7 References 29 ...

Page 5: ...sented in Italic type This manual assumes that the reader has successfully installed the iSense development environment and obtained the iSense standard firmware For further information on these steps consult the Development Environment Setup User Guide 1 In addition it is assumed that the user is familiar with the use of iShell For further information on iShell consult the iShell User Guide 3 For...

Page 6: ...ivity 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 enab...

Page 7: ... connecting modules from or to other modules in operation can result in a reset of the device and other undesired effects All delivered components are intended for use in research application For using these components within other application domains consult coalesenses prior to use Coalesenses products are not intended for use in life support systems appliances or systems where malfunction of th...

Page 8: ... 3 3 Net10Module API Description The Net10Module class in the isense namespace contains all software functionality for operating the Core Module specific features including switching the LEDs handling of button events The NET10Module class is defined in src isense modules ethernet_module net10_module h in the iSense directory The iSense firmware is structured into a large number of software module...

Page 9: ...nly the lower 48bits will be considered rx_length Desired length of the receive buffer full_duplex Sets the interface to full duplex when set to true 3 2 Standard Constructor 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 con...

Page 10: ...r 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 Ethernet Module define ISENSE_ENABLE_ETHERNET_MODULE 3 6 sd_card SDCard Net10Module sd_card De...

Page 11: ...e directory Required Modules SD Card Module define ISENSE_ENABLE_ETHERNET_MODULE_SD_CARD SPI define ISENSE_ENABLE_SPI GPIO define ISENSE_ENABLE_GPIO 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 os Reference to the current instanc...

Page 12: ...don t care bits A successful write operation is indicated with a value of 5 a successful read operation with 0 Parameter address The address which shall be accessed length Determines how many bytes should be accessed buffer Pointer to a buffer to from which blocks are copied from to the SD Card write If true the access will be a writing operation otherwise it is a reading operation Returns Status ...

Page 13: ... uint32 length uint8 buffer 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 address Start address to read from length Determines how many bytes should be read buffer Pointer to a buffer to which blocks are copied from the SD Card Returns Status code indi...

Page 14: ...rite set to true Parameter address The address to which shall be written length Determines how many bytes should be read 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_bloc...

Page 15: ...nse directory Beneath the low level send and receive functionality as described in this document there also exist a high level API which enables the Ethernet Gateway to communicate with other network devices using IPv4 IPv6 as network layer protocol and TCP UDP for transport For further information on how to use IP based communication with the Ethernet Gateway please refer to 7 Required modules En...

Page 16: ..._addr Destination address of the data len Length of data to send buf Pointer to the data to send options Not considered sender Not considered 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 bool Enc28J60 set_receiver Receiver receiver Description Sets an instance of cl...

Page 17: ...r that interface at once Returns Maximum Transmission Unit MTU of the link For Ethernet this value is 1500bytes 6 Ethernet Gateway Module Demo Application The Ethernet Gateway Module demo application exemplifies how an application can make use of the Net10Module and SDCard API It shows how to switch on and off the LEDs set the ButtonHandler to handle events raised by pressing the button B1 as well...

Page 18: ...e open the Import dialog Choose Existing projects into workspace and click on Next User Guide Ethernet Gateway Demo Application Ethernet Gateway Module Demo Application If you want to use Eclipse for compiling Ethernet Gateway Demo Application open Eclipse and perspective You can now import the application into Eclipse Choose File Import from the menu bar to Choose Existing projects into workspace...

Page 19: ...on in the After doing so the NET10DemoApplication Import dialog User Guide Browse and select the directory of the Core Module demo application i e in the iApps directory DemoApplication project should appear in the projects list of the 19 30 Browse and select the directory of the Core Module demo application i e project should appear in the projects list of the ...

Page 20: ...Finish button As a result you will find the NET10 User Guide the typical reason is that there is already a project called NET10DemoApplicati NET10DemoApplication 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 NET10DemoApplication project in the Project Explorer 20 30 DemoAppli...

Page 21: ...on will appear in the Make Targets view Double click on all to build the demo application for all targets 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 Using the Command Line If you want to use the command line tools for building the Core Module Demo Application open a NET10DemoApplication directory...

Page 22: ...ation inherited from application called upon device boot void boot User Guide After the build finished the console output should look similar as shown above Ethernet Gateway Module Demo Application Ethernet Gateway Module and an iSense Gateway Module 2 with a USB cable configure the correct communication port and change to the Flash Loader view the appropriate binary according to the table below D...

Page 23: ...e sd_card_ net10_ sd_card if sd_card_ NULL new was successful os_ add_task_in Time 1 0 void void USERDATA_SD_CARD_METRICS 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...

Page 24: ...n 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 ...

Page 25: ... 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 class ButtonHandler public iSenseObject public This method is called when a button is pressed virtual void button_down uint8 button_no This method is called when a button is released virtual void button_u...

Page 26: ...ata else os_ fatal reading failed else os_ fatal ERROR Code d result 0x1F 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 verif...

Page 27: ... 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 debu...

Page 28: ...hernet Gateway User coalesenses research to innovate Observing the output of the NET10DemoApplication User Guide NET10DemoApplication with iShell yields the above result 28 30 with iShell yields the above result ...

Page 29: ...s 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 P...

Page 30: ...30 30 iSense Ethernet Gateway User Guide coalesenses research to innovate coalesenses GmbH Maria Goeppert Str 1 23562 Lübeck Germany www coalesenses com sales coalesenses com ...

Reviews: