AN3209
Application note
Developing your M24LR64-R datalogger application
for temperature acquisition
Introduction
The M24LR64-R is a Dual interface EEPROM. Since it has both an 13.56 MHz ISO 15693
RFID and a 400-kHz I
2
C interface, the device is a good solution for RF-enabled sensors for
which ST has developed a reference design. One of the main benefits brought by the
M24LR64-R is that the sensor data can be accessed in read and write mode without
consuming any on-board power.
This application note presents a practical useful application for the M24LR64-R datalogger.
It describes an autonomous battery-powered datalogger able to record and store 64 Kbits of
temperature data using the M24LR64-R Dual interface EEPROM (I
2
C and RF). The
datalogger microcontroller is an STM8L101K3. It communicates with the M24LR64-R using
its serial interface and controls an STTS75 digital temperature sensor.
An on-board demonstration firmware, the
M24LR64-R_Datalogger_application_firmware,
stored in the STM8L101K3 memory selects and controls the temperature acquisition
through a RFID reader connected by a USB cable to a PC.
The application is delivered with a PC software, the
M24LR64-
R_Datalogger_application_software,
to configure and control the datalogger, as well as
download and display the temperature values.
ST provides all the resources required to develop your own datalogger application and PC
software:
●
Source files of the data logger firmware (M24LR64-
R_Datalogger_application_firmware): they allow implementing I
2
C communications
between the M24LR64-R, the STTS75, and the STM8L101K3.
Source files of the PC software (M24LR64-R_Datalogger_application_software): they
control RF communications between the M24LR64-R and an RFID reader.
●
Basic information about the M24LR64-R, STTS75, and STM8L101K3 component
characteristics, as well as a description of the algorithms for the datalogger firmware and PC
software are provided in this document.
Reference documents
●
●
●
●
●
●
●
M24LR64-R datasheet
“M24LR64-R tool driver install guide” user manual (UM0863)
“Using the M24LR64-R datalogger reference design” user manual (UM0925)
“How to manage M24LR64-R data transfers from the I²C bus or an RF channel”
application note (AN3057)
STM8L101K3 datasheet
STM8L101 reference manual (RM0013).
STTS75 datasheet.
The documents are available from http://www.st.com/dualeeprom.
April 2011
Doc ID 17419 Rev 2
1/42
www.st.com
Contents
AN3209
Contents
1
Overview of M24LR64-R datalogger application . . . . . . . . . . . . . . . . . . 6
1.1
1.2
1.3
Board architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Communication interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Power management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2
Component overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1
M24LR64-R Dual interface EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.1
2.1.2
2.1.3
2.1.4
M24LR64-R main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
M24LR64-R I
2
C interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
M24LR64-R RF Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Datalogger memory mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2
STM8L101K3 8-bit low power microcontroller . . . . . . . . . . . . . . . . . . . . . 15
2.2.1
2.2.2
2.2.3
STM8L101K3 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
STM8L101K3 I
2
C interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
STM8L101K3 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3
Digital temperature sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.3.1
2.3.2
2.3.3
2.3.4
STTS75 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
STTS75 I
2
C interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
STTS75 I
2
C commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Temperature format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3
4
Installing the datalogger package on your computer . . . . . . . . . . . . . 22
Developing, compiling and debugging your datalogger firmware . . . 24
4.1
4.2
Installing the datalogger application firmware . . . . . . . . . . . . . . . . . . . . . 24
Software tool-chain overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.2.1
4.2.2
ST Visual Develop (STDV) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
C compilers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.3
Description of the datalogger firmware . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.3.1
4.3.2
Main routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Acquisition algorithm functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5
PC software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.1
Description of the PC software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Doc ID 17419 Rev 2
2/42
AN3209
5.1.1
5.1.2
5.1.3
5.1.4
Contents
START button algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
STOP button algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
TRACE GRAPH button algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Timer management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Appendix A Temperature acquisition datalogger schematics . . . . . . . . . . . . . . 33
Appendix B M24LR64-R RF commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
B.1
B.2
B.3
B.4
B.5
B.6
Inventory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Reset to Ready . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Read single block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Read Multiple Block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Write single block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
estar commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Appendix C STTS75 I
2
C commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
C.1
C.2
Acquire temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Read acquired Temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Doc ID 17419 Rev 2
3/42
List of tables
AN3209
List of tables
Table 1.
Table 2.
Table 3.
Table 4.
Table 5.
Table 6.
Table 7.
Table 8.
Table 9.
Table 10.
Table 11.
Table 12.
Table 13.
Table 14.
Table 15.
Table 16.
Table 17.
M24LR64-R signal names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
I
2
C page write function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
I
2
C buffer read function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
M24LR64-R-R memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Status byte values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Overwrite byte values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Delay byte values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Relationship between temperature and digital output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Component values for schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Inventory_DataLogger() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
ResetToReadyRF_DataLogger() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
ReadRF_single_DataLogger() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
ReadRF_multiple_DataLogger() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
WriteSingleBlockRF_DataLogger(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
I2C_SS_Config(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
I2C_SS_Config(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4/42
Doc ID 17419 Rev 2
AN3209
List of figures
List of figures
Figure 1.
Figure 2.
Figure 3.
Figure 4.
Figure 5.
Figure 6.
Figure 7.
Figure 8.
Figure 9.
Figure 10.
Figure 11.
Figure 12.
Figure 13.
Figure 14.
Figure 15.
Figure 16.
Figure 17.
Figure 18.
Figure 19.
Figure 20.
Figure 21.
Figure 22.
Figure 23.
Figure 24.
Figure 25.
Figure 26.
Figure 27.
Datalogger front side view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Datalogger back side view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
STM8L101K3/M24LR64-R/STTS75 communication block diagram. . . . . . . . . . . . . . . . . . . 7
Datalogger power management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
M24LR64-R pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
M24LR64-R functional block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Write I
2
C frame format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Read I
2
C frame format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
FEIG software support for windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
STM8L101K3 32-pin package pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
STM8L101K3 functional block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
STTS75 temperature sensor pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
STTS75 temperature sensor block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Typical Pointer Set Configuration Register Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Typical pointer set followed by a READ for 2-byte register. . . . . . . . . . . . . . . . . . . . . . . . . 20
M24LR64-R_Datalogger_Application_Software folder structure . . . . . . . . . . . . . . . . . . . . 22
M24LR64-R_Datalogger_Application_Software start menu . . . . . . . . . . . . . . . . . . . . . . . . 23
Needed material to compile and run an application on STM8L101K3 . . . . . . . . . . . . . . . . 24
Main routine algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Acquisition_running algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Start_acquisition/stop_acquisition/acquisition update algorithms . . . . . . . . . . . . . . . . . . . . 27
M24LR64-R_Datalogger_application_software home page . . . . . . . . . . . . . . . . . . . . . . . . 28
START button algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
STOP button algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
TRACE GRAPH algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Dynamic view - timer algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Temperature acquisition datalogger schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Doc ID 17419 Rev 2
5/42