crosscontrol CrossFire IX Manual del propietario

Revision: 1.18
CrossFire IX –Freely Programmable - Data Logger Edition -
Programming Manual
2018-12-21
www.crosscontrol.com
CrossFire IX
Freely Programmable - Data Logger Edition -
Programming Manual

Revision: 1.18
CrossFire IX –Freely Programmable - Data Logger Edition -
Programming Manual
2018-12-21
2
Contents
1. Introduction ..................................................................................................................................4
2. Validity ..........................................................................................................................................4
3. Security..........................................................................................................................................4
4. Folder structure.............................................................................................................................4
5. Architectural Overview ...............................................................................................................4
6. Development environment.........................................................................................................5
7. Debugging ....................................................................................................................................6
8. Boot Loader...................................................................................................................................7
9. Libraries .........................................................................................................................................7
10.CrossFire IX Data Logger API ......................................................................................................7
11.Interrupts .......................................................................................................................................7
12.Hardware resources ....................................................................................................................8
13.Testing............................................................................................................................................8
14.Tools ...............................................................................................................................................8
14.1. Upgrading the firmware of the CrossFire IX over Wi-Fi ............................................... 8
15.Functionality of the Data Logger Edition .................................................................................10
15.1. Real Time Clock ............................................................................................................... 10
15.2. External FLASH Memory .................................................................................................. 11
15.3. The Wi-Fi module.............................................................................................................. 12
16.Examples.....................................................................................................................................13
16.1. The CANWifiGateway example ................................................................................... 13
16.2. The ThingSpeak example............................................................................................... 15
16.3. The CAN logger example .............................................................................................. 16
16.4. The FOTA (Firmware Over The Air) example............................................................... 17
17.References ..................................................................................................................................17
18.Trademark, etc. ..........................................................................................................................19

Revision: 1.18
CrossFire IX –Freely Programmable - Data Logger Edition -
Programming Manual
2018-12-21
3
Revision history
1.0
First release
CMM
2018-06-18
1.1
Various updates
CMM
2018-09-10
1.2
Updates regarding examples
CMM
2018-09-18
1.3
Updates regarding development environment
CMM
2018-09-26
1.4
Added FOTA example. Improved document structure.
CMM
2018-10-19
1.5
Additional security info
CMM
2018-10-26
1.6
Added info about the examples
CMM
2018-11-07
1.7
Minor changes regarding the Wi-Fi module
CMM
2018-11-09
1.8
Updated examples chapter
CMM
2018-11-20
1.9
Name change to Programming Manual
CMM
2018-11-21
1.10
Corrections and clarifications
CMM
2018-11-27
1.11
Added info about firmware upgrade
CMM
2018-11-29
1.12
Updates for release 0.9 of SDK. Minor corrections.
CMM
2018-11-30
1.13
Review
CMM
2018-12-03
1.14
Added summary for data logger API
CMM
2018-12-07
1.15
Review
CMM
2018-12-10
1.16
Review
CMM
2018-12-11
1.17
Review
CMM
2018-12-12
1.18
Moved tool information to main manual
CMM
2018-12-21

Revision: 1.18
CrossFire IX –Freely Programmable - Data Logger Edition -
Programming Manual
2018-12-21
4
1. Introduction
This document describes the differences between the CrossFire IX CANopen version and the
CrossFire IX Data Logger Edition.
The CrossFire IX Data Logger Edition contains the following additional functionality compared to
the CANopen version:
4/8 MB (depending on version) of external SPI FLASH memory.
Real Time Clock (RTC) with battery backup.
Wi-Fi module (ESP-WROOM-02) connected to the IX main processor through an UART.
2. Validity
This manual is valid for version 1.1 of the CrossFire IX Freely Programmable SDK.
3. Security
It is absolutely necessary to take the security implications of a Wi-Fi connection seriously.
The Wi-Fi chip should normally not be active during machine operation. Instead, it is
recommended to only activate the Wi-Fi chip during machine commissioning and service or when
the machine is used during special supervision. Especially if the firmware written allows messages
coming over Wi-Fi to control outputs or to send CAN messages. However, note that even if outputs
or CAN is not controlled over Wi-Fi, you must also consider the risk of flooding the STM32 with
serial data or bugs that can cause the STM32 to act in an undesired way because of data sent over
the serial link from the Wi-Fi chip.
If connecting the CrossFire IX to the Internet, make sure to have an appropriate firewall between
the CrossFire IX and the Internet.
Make sure to change the standard password used for connecting to the CrossFire IX. All units
should have a unique password.
4. Folder structure
There are some folders specific for the Data Logger Edition (DLE).
Delivery/BootLoader DLE –Bootloader for the DLE version
Src/ESP8266 –Example code for the ESP8266 Wi-Fi processor
Src/DataLoggerAPI –Source code for the data logger API
Tools/CrossFireIXWIFITool –Service Tool using Wi-Fi
5. Architectural Overview
The CrossFire IX Data Logger Edition contains a Wi-Fi slave processor not available in the
CANopen version.

Revision: 1.18
CrossFire IX –Freely Programmable - Data Logger Edition -
Programming Manual
2018-12-21
5
6. Development environment
Development environment for the main processor is the same as for the CANopen version (Atollic
TrueSTUDIO for STM32 or IAR Embedded Workbench).
For programming the Wi-Fi slave processor several development environments are available. The
development environment recommended by CrossControl is the Arduino IDE. The Arduino IDE
can be downloaded from https://www.arduino.cc/en/Main/Software.
To make it possible to develop for the ESP8266 using Arduino IDE, also the Arduino core for
ESP8266 must be installed. The homepage for the Arduino core for ESP8266 is
https://github.com/esp8266/Arduino.

Revision: 1.18
CrossFire IX –Freely Programmable - Data Logger Edition -
Programming Manual
2018-12-21
6
To make the Arduino IDE find the Arduino core for ESP8266, the URL for the Arduino core for
ESP8266 (http://arduino.esp8266.com/stable/package_esp8266com_index.json) must be added
to the Additional Board Manager URL:s.
The version of the Arduino core for ESP8266 can be checked in the Boards Manager.
In the menu under Tools/Board, make sure to select the NodeMCU 0.9 (this is not exactly right but
close enough).
To create a binary for CrossFire IX select Sketch/Export compiled binary. The binary can then be
downloaded to CrossFire IX using the CrossFire IX Tool.
7. Debugging
For writing code running for the Wi-Fi slave processor, a separate Wi-Fi module (NodeMCU or
similar) can be used during development. This module contains an ESP8266 (same circuit as in
CrossFire IX) and a serial to USB converter. This can be handy as with a NodeMCU, code can be

Revision: 1.18
CrossFire IX –Freely Programmable - Data Logger Edition -
Programming Manual
2018-12-21
7
downloaded directly from the Arduino IDE to the Wi-Fi module. This is not possible with the Wi-Fi
module built into the CrossFire IX as there is no direct serial connection to the outside world.
Two tools that can be very handy for debugging network traffic are Packet Sender and Wire Shark.
Packet Sender is a basic, easy to use tool which can log and send network traffic. Wire Shark is a
very capable tool but is more difficult to learn.
8. Boot Loader
The CrossFire IX Data Logger Edition has a special version of the CrossFire IX bootloader
supporting update of the Wi-Fi slave processor. The bootloader is available in binary form in the
Delivery\BootLoader DLE folder.
There is also a special version of the CrossFire IX Tool supporting upgrade of the Wi-Fi processor.
The tool is available in the Tools\CrossFire IX Tool DLE folder.
9. Libraries
To make it possible to use the data logger functions, the data logger API files must be included in
the project. It is also important that the define LOGGER_EDITION is set. This will activate
appropriate functions in the drivers layer. This has already been done in the example projects.
There are also some drivers specific for the data logger edition:
usart.c
10. CrossFire IX Data Logger API
The Data logger API contains the following modules
Module
Header File
Wi-Fi
wifi.h
RTC
rtc.h
FLASH
flash.h
For details about the Data Logger API, see the Doxygen documentation in CrossFire IX-CANopen-
FreelyProgrammable\DoxyGen\DataLoggerAPI.
11. Interrupts
For the data logger edition also the following interrupts are used:
Interrupt
Description
Priority (priority/sub priority).
Lower number means higher
priority.
SPI1
External FLASH when not using DMA
mode
1/0

Revision: 1.18
CrossFire IX –Freely Programmable - Data Logger Edition -
Programming Manual
2018-12-21
8
USART3
Serial communication with Wi-Fi
module
0/0
DMA1 CH 2
DMA1 CH 3
When using the External FLASH driver
in DMA mode
2/0
CAN
0/0
12. Hardware resources
The following additional hardware resources are used in the data logger edition compared to the
CANopen version:
Resource
Used for
I2C1
RTC
USART3
Wi-Fi module
SPI1
External FLASH
DMA1 CH 2
DMA1 CH 3
DMA for External FLASH
13. Testing
There are a number of additional test functions included in the freely programmable SDK for the
Data Logger Edition. By setting the define UNITTEST the function PerformUnitTest will be
executed after system init. In this function a number of test functions are called. The test functions
will use printf to give user feedback so it is important that printf calls are redirected to a console
window to see the output. It is possible to comment out the test functions that you do not want to
run.
The available test functions are:
Name
Description
EXTFLASH_ReadWriteTest
Test read/write to the complete SPI FLASH
EXTFLASH_SpeedTest
Test read/write performance of the SPI FLASH
EXTRTC_Test
Test the RTC
14. Tools
14.1. Upgrading the firmware of the CrossFire IX over Wi-Fi
Note that this is only possible if the firmware on the CrossFire IX supports FOTA updates!
First it is necessary to build a firmware package (an .fwp file). This is done with the CrossFire IX
Tool.
Go to the FOTA tab.

Revision: 1.18
CrossFire IX –Freely Programmable - Data Logger Edition -
Programming Manual
2018-12-21
9
Browse for the binary files to include in the package with the respective … button. The
firmware package can contain any combination of firmware for the main processor
(Application), boot loader for the main processor (Bootloader) and firmware for the
ESP8266 Wi-Fi processor (NodeMCU). For the Wi-Fi processor file you need to supply
your own version number. For the other binaries, the version number is read from the
binary file itself.
When all files are selected, press the generate button. Decide where to store the .fwp file
using the file dialog.
The LUA files are not needed if you are not using the NodeMCU/LUA firmware on the
ESP8266 which is not recommended!
The actual upgrade is done with the CrossFire IX Wi-fi Tool. The CrossFire IX Wi-fi Tool has no
support for CAN as the CrossFire IX Tool but only for Wi-Fi.

Revision: 1.18
CrossFire IX –Freely Programmable - Data Logger Edition -
Programming Manual
2018-12-21
10
Make sure your PC is connected to the access point that the CrossFire IX sets up.
Enter the IP address and port of the CrossFire IX in the tool.
Click “Connect”. If this fails, make sure you are really connected to the CrossFire IX Wi-Fi
access point, check that the CrossFire IX is in upgrade mode (you might need to set digital
input 1 to VBAT) and check that the firmware currently running on the IX supports Wi-Fi
upgrade.
Click “Get Info” to get some information from the CrossFire IX about the current firmware
version and MAC address. This step is optional.
Erase the SPI FLASH used by FOTA (the first 1.5MB) by clicking “Erase FLASH”. This will
erase any information that is stored there already.
Browse for the .fwp file by pressing the “…” button.
Click “Download File” and wait for the file to be downloaded to the CrossFire IX.
Click “Reboot and Program”. Until now, no upgrade has actually been performed. The
upgrade file has only been written to SPI FLASH.
The CrossFire IX will indicate that upgrade is in progress by a fast blink of the LED.
15. Functionality of the Data Logger Edition
The Data Logger Edition contains the following additional functionality compared to the CANopen
version:
15.1. Real Time Clock
The Real Time Clock is used to keep track of the “real time”. As the RTC contains a backup battery,
the time will continue also when the CrossFire IX has no power. The time can be used for instance
Otros manuales para CrossFire IX
1
Tabla de contenidos

















