|Line 75:||Line 75:|
== Firmware Download ==
== Firmware Download ==
Latest revision as of 18:36, 16 December 2013
 Basic information
The IDE is a Windows application that allows the user to program and manage all the functionalities of the Flyport modules.
- Project explorer to manage and modify all the project files (application files and external libraries);
- Powerful editor, with syntax highlight, autocomplete function and tooltip helpers;
- Offline quick reference manual for API usage - can be opened with F1 keyboard shortcut;
- Wizard tool, to properly configure the device and TCP/IP parameters;
- Serial monitor for debug purposes;
- Compiling through direct control of C30 Microchip compiler (user selectable versions from v3.24);
- Import and create external libraries in order to add new functions to the program, for example to interface with external devices;
- Serial firmware download tool that allows users to deploy the firmware directly on the Flyport;
- HTML project informations, to embed documentation inside the project folder
- Support for all Flyport Modules (Wifi, Wifi G, Ethernet and GPRS)
- Automatic conversion of old projects
 Download and install
Follow the Getting Started guide to download and install the C30 compiler and the IDE.
 Working area
The IDE working area contains all the elements to create and manage any Flyport project.
The main elements of the working area are:
- Title bar: displays name and version of the application, and project name.
- Menu bar: is composed by the Home tab and the View tab. The home tab contains the icons to perform any action inside the IDE, like open/save/close a project, compile and import elements, and modify the text, launch wizard tool and download firmware. In the view tab it's possible to switch on/off the output window, the project explorer and the serial monitor window, open the C30 compiler settings and project info documentation window, the offline helper and open the online wiki for others developer resources.
- Project explorer: it is shown an example of Flyport Wi-Fi project files that can be modified by the user. The application files are:
- taskFlyport.c: always present for all Flyport modules, can be used to develop user's custom firmware.
- WF_events.c: to manage all the wifi events, like connection established or lost (present only in Flyport Wi-Fi projects).
- HTTPApp.c: to manage the interaction with web server (present only if web server feature is activated using IDE Wizard).
- External libraries files: user can add libraries to communicate with displays, sensors or other devices.
NOTE: All the TCP stack files, operating system files and Flyport Framework libraries are modified “behind the scene” by the system, according to the settings of the IDE Wizard.
- Code editor window: to edit the code for any project file. It supports syntax highlight, autocompletion and tooltips. For every Framework API function user can double click on its name and press F1 keyboard button to see the related function API chapter.
- Output window: here is reported any message of the Compiler, and any other report about IDE operations. In case of error just double click on the message to pass at related file/line number on code editor window
- Serial monitor: an embedded serial monitor to communicate directly with the Flyport UART. Just set baud rate and COM port to receive debug messages and send strings to the device.
 IDE Shortcuts
Some helpful shortcuts are integrated on openPicus IDE. Here is a reference list:
- F1 open the Quick Reference manual. If you highlight a API (using double click) and press F1 the related chapter of quick reference will be opened
- F10 save the current project files and executes a "Compile"
- Ctrl+F10 save current project files and executes a "Recompile All" (IDE 2.4 or greater)
- F12 open Firmware Download tool window
- Ctrl+S save current files
- Ctrl+Z undo recent changes
- Ctrl+Y redo recent changes
- Ctrl+TAB / Ctrl+Shift+TAB move between opened files tab
- Ctrl+Q / Ctrl+Shift+Q comment/uncomment selected lines of code
- Ctrl+A select all text
- Ctrl+D duplicate selected text
- Ctrl+F / Ctrl+H launch "Find and Replace" tool
- Ctrl+C copy text
- Ctrl+V paste copied text
- Ctrl+X cut selected text
- Ctrl+U / Ctrl+Shift+U convert selected text to lowercase / UPPERCASE
- Ctrl+I launch embedded find
- Ctrl+L delete selected lines
- Ctrl+G open Go To Line window
- Ctrl+'+' / Ctrl+'-' / Ctrl+Mouse Scroll Wheel zoom code font in / out
 API Quick reference (F1)
On the IDE there's a useful quick reference containing the description of the APIs. You can access to this tool by pressing HELP button under "View" menu or directly pressing F1.
You can also get help about a specific function on your code by selecting it and pressing F1.
 Firmware Download
Each Flyport module embeds a serial bootloader (a customized version of the ds30 loader) that enables the user to download the firmware simply using the serial port, instead a programmer. This makes everything easier and cheaper. The download tool integrated in the IDE communicates with the device and downloads the firmware directly on the Flyport, simply selecting the serial COM port and clicking “Download”. On the right is shown firmware size (green bar), free ROM memory (white bar) and bootloader size (orange bar, at the end of the program memory).
 Using FlyPort IDE
 Working with templates
Templates are models that can be used as starting point for the new projects. A template contains the application files, the configuration files and all the related compiled files for the project. Every templateis ready to be compiled and downloaded on the Flyport, without needing any further operation. Starting from one of the provided templates, you can change all the network settings, add your own code and modify/add/remove webpages. Then you can choose to save your own template to share it, or to reuse in future.
For example you could set Wizard parameters, then make the task Flyport do some standard operations you always want to include inside your firmware (for example a network scan, or a connection) and save them in a new template “my standard app”, so, every new project will have the correct network and device settings and the right initialization code.
 Create a New Project
IDE is provided of ready-to-use templates for each Flyport module. Just click on "New Project" menu button, choose the desired Flyport module model fro a drop down list, and start from the provided templates.
After choosing the template, you have to select the name for the project and related directory in which the project folder will be created.
 Save Templates
To save your own template, click the main “orb” icon and select “Save as template”. You can choose any folder as a destination for your template.
If you want to use the new template in the IDE, you have to put it inside the subfolder “..\Template\...”. At the startup the IDE will look in that folder for any .zip template file and will make it available for a new project.
WARNING: To properly save templates in IDE folder, it is needed to run the software with administrator privileges, or it could be impossible to write inside the “...\OpenPicus FlyPort IDE\Template” folder.
 Open Existing Project
To open an existing Flyport project, click on Open Project button, and choose the proper .conf file. In case you are trying to open an old IDE release project, the current IDE will automatically recognise and convert them.
In case of old project version it will be kept the following files:
- All the application files (taskFlyport.c, HTTPApp.c, WF_events.c);
- The compiled webpages and dynamic data (HTTPPrint.h, HTTPPrint.idx, MPFSImg2.s);
- The configuration files (TCPIPConfig.h and WF_Config.h);
- The external libraries files.
openPicus Framework files will be updated to the new IDE release.
 Advanced Features
 Import Web Pages - not valid for Flyport GPRS
To start the process, just click on the button Web Pages, and the import window will appear.
IMPORTANT: the webpages of the webserver not only contain static data, but also dynamic contents that interacts with the firmware. The integration with the firmware is managed by the file HTTPApp.c. So when the webpages are changed, also the code in HTTPApp.c must be changed (if there are differences with the previous dynamic contents), otherwise, compiling errors can arise.
 Flyport Ethernet and Flyport Wi-Fi G only
The compiled webpages can be located inside the PIC Flash Memory (embedded in firmware) like in Flyport WiFi (transceiver B version), or inside the expansion Flash memory mounted onboard of the Flyport modules. Using the “Memory EXT” option, the IDE will generate a MPFSImg2.bin file inside the project folder. This file can be loaded using a browser, with the mpsfupload webpage embedded inside Flyport firmware.
This page permits the upload of the MPFSImg2.bin file directly into the External Flash memory. In this way it is not needed to reboot the flyport to have a upgraded webserver.
 Add External Libraries
External libraries can be useful to extend Flyport functionalities (for example to connect to an external device, sensor, or display...). Libraries contain code that can be easily reused and shared with others.
To include the files, click on the External lib button, will appear a window to select the files to import in the project (.c, .s or .h), the source files and the header files will be automatically copied in the project subfolders "..\Libs\ExternalLib\ and ..\Libs\ExternalLib\Include\". It is also possible to create library files with the "create" button.
Libraries must then be included in the source code files (taskFlyport.c, HTTPApp.c, etc...) using the directive #include ”header_name.h”. The library notes will specify the header file to include. The files of the libraries can be added/removed using the same window.
 Find External Libraries
Flyport libraries are provided by the Flyport community and are freely available. The most common place to look for libraries is the wiki's Libraries page. In case of Grove Board projects, each device library can be found on the dedicated page. A list of available devices can be found here.
 IDE Wizard
IDE wizard is a tool to properly configure some Hardware and Firmware parameters. For Flyport Ethernet and Wi-Fi it permits also to configure the TCP/IP stack, the service available on the device, and the network configuration (like IP address, SSID, security... ). The network configuration is needed to make the Flyport run in the right way, and connect to the desired network, the selection of the services is needed to minimize the resources used by the TCP/IP stack. IDE wizard changes with the model of Flyport module you choosen.
Two different wizards are generated if you are using
 Flyport Wi-Fi and Ethernet
The Flyport is an embedded device, running a bootloader, a real time operating system, the TCP/IP stack and the user firmware. A lot of thing for an embedded microcontroller with a limited amount of resources, especially program and data memory. So, optimizing these resources it's a primary issue. For example, if your project doesn't use the webserver, maybe it's better if you not include it, so you'll have more memory available for your application, and the task managing the TCP stack will be lighter and faster.
 Select Services
This is the first page of the Wizard. Here it is possible to select the service to include inside the Flyport. In this way it is possible to reduce at the minimum the size of the code for the TCP stack according to your needing.
The services that can be enabled/disabled are the following:
- Webserver: enabling this service, the Flyport can be accessed through a classic HTML browser, and will display dynamic HTML pages.
- POST method: enabling/disabling the suppoort for the POST method in the Flyport Webserver.
- DHCP client: if the Flyport is connected to an infrastructure network where is present a DHCP server, this service will allow the Flyport to acquire a dynamic IP address assigned by the server.
NOTE: in the user application is possible to enable/disable at runtime the DHCP client, but if it has not been selected in the wizard, the DHCP client will not be present in the TCP stack, so the instruction will be useless. If you think you may need the client in your app, select it, you'll always be able to turn off it at runtime.
- DHCP server: useful in Wi-Fi ad hoc networks, or for a point-to-point ethernet link. It's a DHCP server capable of assign up to one IP address.
- ICMP client: client to send ping requests to a remote server (demo).
- ICMP server: a server to respond to remote ping requests. So if you want to ping the Flyport from your pc, you have to enable this service.
- DNS server: simulates a DNS server, answering with a dummy reply (with Flyport address) to DNS requests. Can be useful to simulate the presence of a DNS inside a network.
- DNS client: allows the Flyport to access to a remote DNS server to resolve host names (for example www.openpicus.com). It will be possible to make requests using host names instead of IP address.
- Announce service: sends an UDP announcement packet at boot and upon DHCP events. The Microchip Ethernet Discoverer can be used to reveal this announcement.
- NetBIOS name service: the Flyport will be able to answer to NetBIOS name queries.
- ZeroConfig (BETA): this service allows flyport to use the “Zeroconfig” service, but it is a very beta version, to use only for development.
- Dynamic DNS: a client for dynamic DNS, like dyndns.org.
- TCP debug on UART1: all the TCP events will be communicated on UART1 (19200, 8, N, 1). Disable it if you need to communicate with another device on UART1.
- SNTP client: obtain the current time from a pool of SNTP servers. Time is returned like number of seconds from 1st jan 1970, 00:00 (beta).
- Remote reboot service: allows the remote reboot of the Flyport, if receive special message on defined port (by default, port 69, char 'R', only allowed device inside the Flyport subnet).
 Network Configuration
Next, comes the Network Configuration screen. Here you can configure options like:
- Host name: the host name the Flyport will respond to (if NetBIOS enabled).
- MAC Address: any network device has it's own MAC address (you can find the Flyport Wi-Fi one printed on the wireless module, it should start with 00:1E:C0...). If you need i can experiment changing that MAC address with your own selecting Custom and writing the desired MAC Address.
NOTE: inserting the MAC address 00:04:A3:00:00:00 (the default mode) the Flyport will use it's default MAC address (printed on the wireless module). This is just a convention, because the IDE doesn't know the Flyport MAC, so that address is used like “standard” for all the devices. So if you let that address, even if you have selected “Custom” you'll se the default Flyport address.
- IP Address: the starting IP address of the Flyport (will be overwritten if using DHCP client, in a network with a DHCP server different from Flyport itself).
- Subnet mask: the subnet mask of the network (overwritten by DHCP).
- Gateway: default gateway (overwritten by DHCP).
- Primary DNS server: default primary DNS server (overwritten by DHCP).
- Secondary DNS server: default secondary DNS server (overwritten by DHCP).
 Wireless Network Configuration
Only for WiFi projects!
Through this page you can configure wireless parameters such as:
- The SSID: the name of the network to create or to join to.
- The Default network type: defines if Flyport must create an adhoc network, create a soft Access Point (Flyport Wi-Fi G only) or join an existent infrastructure network.
- The Scan channels: channels to scan when searching for networks.
- The Default PS poll: enables or disables power save mode.
- Default scan type: active scan (with probe request sending) or passive scan (just listening for beacons).
 Wireless Security Configuration
In this page is possible to choose between the following security mode:
- Open: no security.
- WEP: WEP security, at 40 or 104 bits.
- WPA or WPA2: WPA, WPA2, or automatic detection. NOT AVAILABLE FOR AD HOC NETWORKS.
When using WPA or WPA2 you can choose to insert the PSK key or the PSK passphrase. Inserting the passphrase, the Flyport will calculate the key. This is a LONG process and needs many operations, so it will took about 20-30 seconds to complete. The connection using the PSK key is much faster (few seconds). You can calculate your key from the passphrase and the SSID using one of the many online tools, for example: http://www.wireshark.org/tools/wpa-psk.html .
 Socket Configuration
This page contains advanced socket configuration to select the number of available socket for each service and the memory allocated (TX and RX) for each socket.
NOTE: the memory indicated is allocated in the wireless module, not inside the PIC. The maximum quantity available is about 8100, so the wizard will block you from allocating more memory.
The memory for each socket refers to the receive and transmit buffer of each socket, the number (count) refers to the number of socket for each service. So, if you want to create two servers on the Flyport, listening on two different ports, you'll have to select count=2 for GENERIC_TCP_SERVER. This will allow you to create two different listening sockets. The default amount of memory has been decided using standard application, but obviously you can change it, for example if you have to send very long strings over TCP, increase the TX buffer, or you can delete FTP sockets if you don't need them, or TCP client if you're just using the server, and so on. You are advised not to delete the “DEFAULT” socket, since it's used by the TCP stack for standard operations.
 UDP Socket Configuration
This screen allows users to configure the UDP sockets needed by user application and their related buffers.
On the left of the page it is possible to enable up to 4 different sockets configuring also their buffer size.
To properly check the memory occupation of UDP sockets there is the sum of all the buffers occupation on the right side of the page. If the user tries to configure buffers size bigger than 6144 Bytes, the wizard will automatically block the process.
 Hardware Configuration
Last configuration screen :-)
This page allows in-depth configuration of the UART modules. Since version 2.5 it is possible to configure the buffer size for each UART module separately, as well as the number of modules active, and the speed of the default debug port on UART1.The buffers are used by Interrupt Handlers for every UART module enabled to easily access received data, so they should be big enough to handle the strings received by other devices connected to the Flyport. Other buffers can be created by the user in his application.
On top of the page is possible to enable up to 4 UART modules Buffers, configuring also their size. To properly check the memory occupation of UART Receive Buffers there is the sum of all the buffers occupation on the bottom side of the page, and the extra memory free space. If the user tries to configure buffers size bigger than 6144 Bytes, the wizard will automatically block the process.
 Complete Wizard Configuration
The whole configuration is now ready to be compiled on Flyport's project! Click “Finish” and Remember to compile again the application before to download the firmware.
 Flyport GPRS
IDE wizard for Flyport GPRS helps user to properly setup UART configuration:
- How many ports enabled
- UART Receive buffer size
- Default baud rate for debug UART