Infineon SP4X_PROG_ADAPTER Evaluation Board Quick Start Guide
Infineon SP4x_DEV_KIT is a development kit for the SP4x sensor product family. It includes a development board, a programming adapter, SP4x samples, and documentation. The development board features an on-board SP4x Prog-Adapter, making it easy to program and debug SP4x samples. The kit also includes a programming adapter for programming additional SP4x samples.
Oglas
Oglas
SP4x Development Kit
Quickstart Guide
About this document
Scope and purpose
This document shall explain all necessary steps to start a development for SP4x products using the SP4x development kit.
Intended audience
Intended audience are all firmware and hardware engineers working in a development involving the SP4x sensor.
Application Note www.infineon.com
Please read the Important Notice and Warnings at the end of this document
page 1 of 30
V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Content of the Kit
Table of contents
Application Note 2 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Content of the Kit
1 Content of the Kit
The kit contains the following items:
SP4x Development Board v5
SP4x Prog-Adapter (soldered on the SP4x Development Board)
Programming-adapter for programming of additional samples
SP4x samples
Documents containing important information
This document shall briefly explain the functionality and usage of the development Kit.
Application Note 3 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Setting up the software
2 Setting up the software
There is several software involved in the SP4x debugger toolchain. The installation procedure must follow the order shown below:
1.
2.
µVsion Keil IDE
SP4xTargetGen2 Keil Plugin minimum Version: 4 minimum Version: 1.0.0
2.1
Installation of Keil IDE
Keil µVision is an integrated development environment, which includes an editor, linker, compiler and a flash tool. A Keil µVision evaluation version may be downloaded from the internet ( www.keil.com
). There select ‘ C51
Compiler (Eval Tools) ’ to install Keil µVision and follow the instructions in the installation routine.
2.2
Installation of the SP4x Keil Plugin
In order to make Keil able to communicate with the development board, a Keil plugin in needed. An installer is provided which takes care of installing the Keil plugin and adding it to the plugin-list of Keil. In order install the plugin, please execute the provided “SP4xTargetGen2_Installer.exe”. The installer will search for the Keil installation path, check if the C51 toolchain is installed and finally copy the plugin-dll to the right place and modify Keil’s TOOLS.INI file to make Keil recognize the new plugin. When the installer finished execution, make sure that everything worked as expected. The output of the window should like as shown in the next figure.
Figure 1 Output of the plugin installer
Should the output show any error, then the installation was not succesfull and the plugin will not be usable. In this case please contact us!
Application Note 4 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Setting up the software
2.3
First Time Keil Configuration
When the complete toolchain itself is properly setup, Keil IDE must be configured as well. Therefore some settings and prerequisites in the Keil project must be done.
Each Keil project must be configured to use the correct target driver. Therefore open the project’s settings right-clicking on “Options for Target” as shown in the next figure.
Figure 2 Opening settings of a Keil project
In the window that will open afterwards go to the Tab “Debug” and apply the settings as visible in the next figure.
Check the radiobox and choose „SP4x Target Gen2“ as debugger
Click here to open the advanced debugger settings
When this checkbox is active, Keil will always load the newest version of the software whenever the version in the chip is older
Figure 3 Basic debug settings in a Keil project
When this checkbox is active, the debugger will automatically run to the beginning of the main() function. Note that this will create a temporary ‘ghost’ breakpoint
Afterwards click on “Settings” in order to open the advanced settings of the selected debugger. Here several settings have to be made, as shown in the next figure.
Click here to detect all currently connected and supported boards
If multiple boards were connected to the PC, the desired one could be selected here
Figure 4 Advanced debug settings in a Keil project
Show either simulated (out of the compiled hex-file) content of the flash, or do a real readout (e.g. when user config. sector shall be readout)
Here the I2C baudrate can be changed, if faster communcation is required, or slower (in case of long wires between board and target, for example)
Application Note 5 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Setting up the software
In order that Debugging among the written C-code is possible, also options under “Output” in the project’s target options must be selected, as shown in the next figure.
Checking this option makes debugging among c-code possible
Creating a HEX file is always mandatory to load the software to the SP4x after compilation
Figure 5 Output settings for debugging a Keil project among c-code
Since the generated hex-file must be loaded to the device prior to debugging it, this hex-file must be generated and furthermore the correct tool for flashing the file must be selected under “Utilities” in the project’s target option as illustrated in the next figure.
Select „Use
Target Driver for
Flash
Programming“ here
Open advanced flash options
Figure 6 Settings in the "Utilities" section of a Keil project
Check these two boxes so SP4x is always updated with the newest software version prior to debugging. Use the driver as selected in
“Debug”
After a click on “Settings” another window appears where the following settings must be applied.
At least the code sector in the flash must be erased
(else an error will come up), additionally the user config. Sector may be erased
Flash must be programmed
Lockbytes may be optionally set
This ensures that the hexfile was loaded to SP4x without errors
Sets SP4x to normal mode after programming so that the software will be exectuted
Figure 7
Application Note
Settings of the SP4x target driver flash utility
6 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Setting up the software
In the last dialog, for option “After Download”, there are several option possible:
1.
2.
3.
“Run without isolation”: This resets the SP4x to normal mode after flash downloading, with the PPx-pins
NOT isolated from the programmer. This means that the PPx-pins are routed through a level-shifter towards the programming adapter and therefore UART for example still works. Current consumption of the device may be a bit higher due to some potential leakage current through that path.
“Run with isolation”: In contrast to point 1, the PPx-pins are isolated from the programming adapter. This means that UART cannot work anymore, but there is no additional leakage current. This setting is recommended for precise current-measurements.
“Do not run”: The device will remain in programming mode after programming was finished. The flashed application will not start to be executed.
Application Note 7 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Hardware description
3 Hardware description
The SP4x development board consists of several blocks that shall help to develop applications for the SP4x
TPMS device. An overview over these blocks shall be given in Error! Reference source not found..
Switch to select between 3V3 or external supply
External supply
LEDs for power and PPx-pins
(buffered)
External programming
434MHz RF matching
PPx-Buffer
315MHz
Shunt resistors for currentmeas.
SP4x IC
Programming adapter
LFinput circuit
Figure 8
Level-shifter Isolation IC
SP4x development board blocks
26MHz Xtal
Space for opt. soldering of LFcoil
Switch to select between
LF-input (SMA or coil)
Additionally to the default setup of the board, determined by several 0Ω resistors, some changes may be applied.
3.1
Selecting an appropriate matching
For only RF testing (like for instance checking if appropriate RF telegram being transmitted), both matching can be let soldered on the board. If instead RF performance is planned to be tested, only one matching shall be present. In order to disconnect the unused matching, the resistors R19 and R20 of the unused matching shall be unsoldered as shown in the next figure.
Application Note 8 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Hardware description
R19 and R20 of
434MHz RF
Matching: unsolder these to enable
315MHz matching only
R21
R19* and R20* of
315MHz RF
Matching: unsolder these to enable
434MHz matching only
Figure 9 Two different matchings on the board
3.2
Soldering the SP4x directly on the board
unsoldered. Note that due to this change the impedance of the matching changes at the PA pin, thus an adoption of the matching must be done afterwards. If not done so, a negative effect on the output power is most likely.
SP4x is directly soldered on the board
Figure 10
Application Note
SP4x soldered directly on the development board
9 of 30
R21 unsoldered
V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Setting up the hardware
4 Setting up the hardware
In order to be able to use the SP4x Development board, some arrangements have to be made. First of all the
SP4x IC must be placed properly in the socket. Here it is important that each PIN of the IC is placed on the respecting connector pin inside the socket, else debugging and programming may result in an error (like “Flash erase failed”). The correct orientation of the IC is shown in the next figure.
Figure 11 Correct orientation of the SP4x IC inside the holder
Afterwards a jumper must be set, as illustrated in red in the next figure.
Pin1 of the SP4x
Lower jumper must be set to power the SP4x via a 0 Ohm shunt resistor
USB connector to PC
Figure 12 Setting of the required jumper on the SP4x development board
Application Note 10 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
5 Example programs
The programs described in the following are to be downloaded from the MyICP library. They allow an easy start with the SP4x.
5.1
Preparation
Copy the source code of the examples from the folder ‘ Software Examples’ in the MyICP library to your local drive.
Note:
If set, remove the write protection of the files. Otherwise Keil µVision has no write access to the files in the projects and causes an error message.
The example programs are organised in separate Keil Projects, where each program resides in a separate folder. To open an example program, open the according folder and double click on the file with the extension
“.uvproj
”. The Keil IDE opens and shows the project. Afterwards check the settings of the project, according to chapter Error! Reference source not found..
5.2
Example 0: EmptyProject
The purpose of this project is to have an empty project with all basic Keil settings and all needed header and library files already included. This is the starting point for every software development.
5.3
Example 1: Blinky
After opening the project with Keil, rebuild the project as shown in Error! Reference source not found..
Click on „Rebuild all Target
Files“ to generate the hex file
The hex file is successfully created
Figure 13 Rebuild the project in Keil
After successful compilation, the program must be loaded inside the SP4x Flash. To achieve this, download the program inside the SP4x Flash by clicking on the button “ Download to Flash Memory ”, as shown in Error!
Reference source not found..
Application Note 11 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
Click on „ Download to Flash
Memory “
The hex file is successfully downloaded
Figure 14 Download the program to the SP4x
The purpose of this program is to use the GPIOs of SP4x by changing the output state. As the GPIOs are connected to the LEDs, it is possible to observe easily the level of the GPIOs. For this example, it is the output state of PP2 that is modified in different interval by usage of the auxiliary-library function Aux_Blink_LED().
Figure 15 Observe the LED blinking at PP2
Application Note 12 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
5.4
Example 2: LowPowerStates
Purpose of this program is to set the SP4x into all different low power states. The state can be defined via a precompiler option (Powerdown, Deep Idle, Tx Low Power, Idle). The device shall stay in each power state for the longest possible amount of time in order to enable current measurements.
Open the associate project “ SP4x_Powerdown.uvproj
” and follow the instructions as presented in the example
1.
Start
Reset?
Y
Start XTAL
N
Diag RC Osc
WU from PD
Y
Calib IT to long interval
N
Go to Powerdown
Resume from
Deep-Idle
Y
Calib IT to long interval
N
Calib IT to long interval
Go to Deep-Idle Go to Tx-LP
Stop XTAL End End End
Y Desired low-power state == IDLE
Calib IT to 700ms
Calib IT to long interval
After WU by IT
Go to IDLE
Go to desired lowpower state
End
Flowchart of Example 2 (LowPowerStates) Figure 16
For measuring the current consumed by the SP4x a shunt resistor may be selected between VDD and VBat via
JP2. This will result in a voltage across this resistor while current is flowing through this resistor into the SP4x.
out/into those pins from external. An exemplarily setup of the jumpers is given in the next figure.
Jumper must be set to use the
10Ω resistor as shunt between
VDD and SP4x’s
VBat
Figure 17
Application Note
Jumper-setup for measurement of SP4x supply-current
13 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
For finally measuring this voltage, it is recommended to use an amplifier in combination with an oscilloscope in order to observe the current flowing into the SP4x’s VBat pin. An example for such a setup is given in the next figure.
GND
V ip
+
V in
-
Amp
+
V iamp
Oscilloscope
Figure 18 General measurement setup for current measurements
Alternatively to the UWLink’s supply voltage, any other external voltage may be used to power to SP4x. Note that in this case, the switch “SW_VDUT” must be set to position “EXT”. The setup using an external voltage for current measurements is given in the next figure.
Ext. Supply
V
DD
GND
V ip
+
V in
-
Amp
+
V iamp
Oscilloscope
Figure 19 General measurement setup for current measurements with ext. supply
Application Note 14 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
5.5
Example 3a: SensorMeasurements
The purpose of this program is to measure the sensor functionalities (pressure, acceleration, temperature and battery voltage) of the SP4x. The next figure shows how the sensor measurements example is implemented.
Open the associate project “SP4x_Sensor_Meas.uvproj” and follow the instructions as presented in the example 1.
Start
Set PP1 to output low
Enable Uart at
19200 baud
N
Reset?
Read ID & initialize counter
Start XTAL
Diag RC Osc
Stop XTAL
Calibrate IT to 1 second
Set PP1 to output high
1: Comma seperated value format
Display format
2: human readable format
Print measurement number and ID
Print measurement number and ID
Measure and print supply voltage
Measure and print supply voltage
Measure and print temperature
Measure and print pressure
Measure and print acceleration
Unmask IT wakeup
& read-clear WUF
Measure and print temperature
Measure and print pressure
Measure and print acceleration
Go to Powerdown
Figure 20
End
Flowchart of Example 3a (SensorMeasurements)
Application Note 15 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
5.5.1
Usage of the serial connectors
The SP4x development board will generate a virtual COM-port on the target PC. Pre-requisite is that the FTDIdrivers are installed. The Uart-to-USB chip is an FTDI FT2232RL and the drivers are normally installed automatically after connecting to a PC. If not, they can be obtained from the FTDI homepage
( http://www.ftdichip.com/Drivers/D2XX.htm
). After drivers are installed properly, the generated COM-port may
COM47 is the COM-port of the serial interface on the
SP4x development board
Figure 21 Installation window of the FTDI drivers
COM47 is the COM-port of the serial interface on the
SP4x development board
Figure 22 Locating the virtual COM-port number in windows’ device manager
After the correct COM-port was evaluated, any terminal window (such as HyperTerminal or similar) may be used in order to connect to the port and send/receive data. In this example a freeware tool called “HTerm” was used to receive data when using the example 3 (SensorMasurements). First thing to be done is applying the correct settings, meaning specifying the correct COM-port, Baudrate, databit-, stopbit- and parity-settings, as shown in the next figure.
Figure 23
COM47 is the COM-port of the serial interface on the
SP4x development board
19200 Baud is the default settings for the sample programs
Configuration of the terminal window
8 Databits, 1Stopbit, no Parity
Set Newline to ‚CR‘ for auto-newline when ‚CR‘ occurs
After clicking “Connect” and loading the sample program to the SP4x, the output may be observed inside the window as shown in the next figure.
Application Note 16 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
Output of example 3 (SensorMeasurements) in human readable format Figure 24
If the output is configured as ‘comma separated format’ (via a pre-compiler option in the main.c file), the output will look as shown in the next figure.
Figure 25 Output of example 3 (SensorMeasurements) in comma separated format
Application Note 17 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
5.6
Example 3b: AccOffsetCompensation
This program shall demonstrate the usage of the Lib_Comp_Auto_Acc_Offset() function. The sample program does 160 cycles of measurement, where the first 50 measurements’ RAW-values are manipulated in order to simulate an offset drift. The last 110 measurements are not manipulated. Due to the Auto-Acceleration-Offset-
Removal it can be observed via Uart, whenever the library function updated the offset information.
Furthermore the result of the compensation will show that the offset disappeared after the update of the offset information. The software flow is given in the next figure.
Start
Y
Reset?
N
Start XTAL
Diag RC Osc
Stop XTAL
LF_OnOff_Timer
_Calib
Use OnOff timer?
LF_Baudrate_Ca lib
LF_Sensitivity
LF_Pulse_Width
LFDCDCOUNT
LFDRXCFG
LFDCDPULSE1
LFRXC
Calibrate IT to 2 seconds
Unmask IT&CD wakeup, read-clear
WUF
Init LF-Receiver
Go to Powerdown
CD wakeup?
Y
Blink PP3 slow
N
Blink PP3 fast
Figure 26
End
Flowchart of Example 3b (AccOffsetCompensation)
After setting up the project, loading it to the device and connecting to the serial port the output may be observed as shown in the following figures.
Application Note 18 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
Actual and manipulated acceleration
Measuring acceleration, manipulating it and calling
Auto_Acc_Offset function
Offset information updated by Auto_Acc_Offset function
Measuring acceleration, manipulating it and calling
Auto_Acc_Offset function
Measuring acceleration
WITHOUT manipulation, calling Auto_Acc_Offset
Offset information NOT updated due to variance
Measuring acceleration
WITHOUT manipulation, calling Auto_Acc_Offset
Offset information updated again
Observation of the output of example 3b while using Auto_Acc_Offset Figure 27
5.7
Example 4a: LFCWwithPulseFilter
The device will enter POWERDOWN state after LF receiver configuration is complete. An LF CW meeting the necessary pulse width shall cause an LF CW wakeup. An LF CW wakeup shall cause the LED on PP3 to flash once slow. An Interval Timer wakeup shall cause the LED on PP3 to flash once fast. After the wakeup is processed, the device shall re-enter POWERDOWN state.
To wakeup the SP4x via LF-carrier either the SMA-connector or a LF-coil can be used (the switch “”SW_LF” must be on the respective position). A simple setup could like as shown in the next figure.
LF Generator
Figure 28 Basic setup for appliying LF-CW to the SP4x
Application Note 19 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
The application flow is given in Error! Reference source not found..
Start
Y
Reset?
N
Start XTAL
Diag RC Osc
Stop XTAL
LF_OnOff_Timer
_Calib
Use OnOff timer?
LF_Baudrate_Ca lib
LF_Sensitivity
LF_Pulse_Width
LFDCDCOUNT
LFDRXCFG
LFDCDPULSE1
LFRXC
Calibrate IT to 2 seconds
Unmask IT wakeup
& read-clear WUF
Init LF-Receiver
CD wakeup?
Y
Blink PP3 slow
N
Blink PP3 fast
Go to Powerdown
Figure 29
End
Flowchart of Example 4a (LFCWwithPulseFilter)
5.8
Example 4b: LFTelegramReception
As seen in the previous example, it is possible to wake up the device by LF Carrier Detection. Another common possibility to wakeup SP4x is via LF Telegram. This example is explaining how this is performed.
The purpose of this example is to enter in powerdown and to “listen” for LF Datagram (WU-pattern = 0x1234).
When LF Datagram is detected, the datagram content is received and, depending on the payload, the LEDs connected to PP2 and PP3 will blink:
After complete reception of one telegram: PP2 blinks according to the number of received bytes
PP2 blinks fast if payload was ‘0xFF’
PP2 links slow if payload was ‘0x1C’
Application Note 20 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
PP3 blinks fast otherwise
The Error! Reference source not found. shows how the telegram reception example is implemented.
Start
Y
Reset?
Start XTAL
Diag RC Osc
Stop XTAL
LF_OnOff_Timer
_Calib
LF_Baudrate_Ca lib
LF_Sensitivity
LFDRXCFG
LFDPCFG
LFDP0L/H, LFDP1L/H
LFDBUFCFG = 0
WUM.BF_MASK = 0
WUM.EOM_MSK=0 read-clear WUF
Enable & Init LF-
Receiver
Go to Powerdown
N EOM or BF wakeup?
Y
Bufferpointer=0
LFDBUFCFG=5
WUF.EOM = 1?
IDLE = 1
Read last byte from LF-buffer
Bufferpointer++
Figure 30
CD wakeup?
Y
Blink PP3 slow
LF-buffer empty?
Read last byte from LF-buffer
Bufferpointer++
Blink PP3 fast
Indicate number of received bytes via blinking at PP2
Blink PP2/PP3 depending on
Payload
End
Flowchart of Example 4b (LFTelegramReception)
Read last byte from LF-buffer
LFDSTATUS&0x01?
LFDSTATUS&0x02?
Y
Buffer[Bufferptr]=
LFDRXBYTE0
Y
LFDSTATUS&0x04?
Buffer[Bufferptr]=
LFDRXBYTE1
Y
Buffer[Bufferptr]=
LFDRXBYTE2
LFDSTATUS&0x08?
LFDSTATUS&0x10?
Y
Buffer[Bufferptr]=
LFDRXBYTE3
Y
Buffer[Bufferptr]=
LFDRXBYTE4
LFDSTATUS&0x20?
Y
Buffer[Bufferptr]=
LFDRXBYTE5
LFDSTATUS&0x40?
Y
Buffer[Bufferptr]=
LFDRXBYTE6
End
5.9
Example 5a: RfCW
Purpose of this project is to generate a RF-carrier-wave in order to enable output power measurements. The project may be configured to output either a 315MHz or a 434MHz carrier wave depending on a pre-compiler
option shown in the next figure. The flow of the software is given in Figure 32.
Figure 31 Pre-compiler option in example 5a to switch frequency
Application Note 21 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
Start
N
434MHz?
RFSDCFINT
RFSDCFFRAC0/1/2
VREFRFCTRL
RFSDCTRL
Lib_Serv_Start_Xtal_Osc(2,10)
Lib_Serv_VCO_Tuning(1)
Lib_Serv_Carrier_Wave(0x80)
RFSDCFINT
RFSDCFFRAC0/1/2
VREFRFCTRL
RFSDCTRL
Lib_Serv_Start_Xtal_Osc(2,10)
Lib_Serv_VCO_Tuning(0)
WDRES = 1
Figure 32 Flowchart of Example 5a (RfCW)
After loading the project to the SP4x and connecting a spectrum analyzer to the appropriate RF-output-SMAconnector, a peak can be observed at the target frequency, as for example in the following figure for 315MHz.
Figure 33 Measuring RfCW at 315MHz with a spectrum analyzer
Note:
Furthermore the development board is not designed for perfect RF-performance (due to socket and layout), thus the output power will most likely not fully achieve the specification. For reliable RF-performance measurements another board (such as the datasheet reference board) should be used.
5.10
Example 5b: RFTelegramFSM
This project show how an RF-telegram is generated by using the TX state machine (FSM). In detail, the involved registers are shown and the complete configuration-flow according to the user manual is implemented for either FSK or ASK modulation (two subversions with *.1 or *.2 extension). The basic software flow is given in the next figure.
Application Note 22 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
Code Start
Aux_RF_Init(mode)
Reset?
yes
Define Telegram in upper RAM block
RFENC
RFSDFDCFG
RFSDCFINT
RFSDCFFRAC0 /1 /2
RFSDGFDIV0 /1
RFTXBRDIV0 /1
RFTXCFG0 .NEOM
RFTXCFG1 .NSOM
RFTXCFG2 .NFRAME
RFTXEOM
RFTXIFD1
RFTXIFD0
RFTXNBITS1
RFTXNBITS0
RFTXOBW_CFG0 .RATE_DIV
RFTXOBW_CFG1 .SLOPE
RFTXOBW_MLV .HLEVEL
RFTXOBW_SLV .LLEVEL
RFTXSOM /2 /3
VREFRFCTRL
RFC.XOSCPLLMON, .ENPLLMON
RFSDCTRL .ASKFSKSEL, .GFEN
RFTXCFG0 .EOMEN
RFTXCFG1 .SOMEN
RFTXOBW_CFG0 .OBWCEN,
.WUC_OVR, .PA_ON
CFG1.TXPDEOTR
Lib_Serv_Start_Xtal_Osc no
RFRGCFG0.RAMPEN=1
RFRGCFG0.BYPASS=1
PLLCFG0.TOPA_EN =1
PLLCFG0.EN=1
RFC.ENPA =0
RFTXCFG1 .TXDEN =1
Xtal Status =0?
yes
Lib_Serv_VCO_Tuning no
CFG1.TXAEN=1
RFTXCFG0 .TXMASTER =0
CFG1.VREGRFEN=1
CPU mode?
FSM
CFG1.TXAEN=0
RFTXCFG0 .TXMASTER =1
Figure 34
Lib_Serv_Stop_Xtal_Osc return
VCO Status =0?
yes
Lib_Serv_Config_RF_
Transmission()
Aux_RF_Init (mode=FSM) no
Aux_RF_Stop
RFTXCFG0.FSMSTOP=1
RFTXCFG1.TXDEN=0
PLLCFG0.EN=0
PLLCFG0.TOPA_EN=0
RFTXCFG0.TXMASTER=0
CFG1.VREGRFEN=0
RFRGCFG0.RAMPEN=0
RFRGCFG0.BYPASS=0
RFTXOBW_CFG0.WUC_OVR=0
RFTXOBW_CFG0.OBWCEN=0
RFTXCFG0 .FSMSTART=1
REFM.RETXERRM=0
REFM.RETXEOFM=0
Read clear REF and WUF return
Lib_Serv_Low_Power(2)
Flowchart of Example 5b (RFTelegramFSM) yes yes
Resume from
TX_low_Power?
yes
WUF.ITIM_FLAG=1?
no
OOL OR XFAIL ==1?
no
Last frame sent?
no
Optional Change of modulation ( ASK/FSK )
Optional modification of
Telegram
Optional change of IFdelay
Read clear REF and WUF
Lib_Serv_TX_low_p ower
Transmission Error
Handling routine no yes
Resume/wake-up handler
Option: Lib_Acq_Meas_
Supply_Voltage()
Aux_RF_Stop
END
As an addition, the LED connected to PP2 will blink once fast whenever the devices resumes from TX-Lowpower state, indicating the transmission of one frame, where such a frame will be repeated ten times. After having transmitted all frames, the device will blink 4 times and wait for a watchdog reset afterwards.
The transmitted frames may either be observed at the correct RF-output-connector or by a feature called Datato-Pin. For the seconds feature, the sample program must be modified a little bit by inserting two lines at a special position, as shown in the next figure.
Application Note 23 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
Add these two lines to enable RF-encoder data visualization at PP2
Figure 35 Modification of example 5b for observing RF-telegram at PP2
After these two lines where added and the sample program was loaded to the SP4x, RF-encoder data may be observed with an oscilloscope at PP2, as shown below.
10 repetitions of one frame with different interframe durations may be observerd
Zoom in
Chips from the
Encoder output may be observed
Figure 36
0xFF
RF-Encoder output at PP2
0xFF 0xFE count 0x55
5.11
Example 5c: RFTelegramCPU
This project show how an RF-telegram is generated in CPU mode, meaning without the usage of the TX state machine (FSM). In detail, the involved registers are shown and the complete configuration-flow according to the user manual is implemented for either FSK or ASK modulation (two subversions with *.1 or *.2 extension).
The basic software flow is given in the next figure.
Application Note 24 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
Aux_RF_Init(mode)
START
SET all flags in WUM and REFM
Define telegram in RAM buffer: SOM, Payload,EOM
RFENC .TXDD, .ITXD
RFSDFDCFG
RFSDCFINT
RFSDCFFRAC 0 /1 /2
RFSDGFDIV0 /1
RFTXBRDIV0 /1
RFTXOBW_CFG0.RATE_DIV
RFTXOBW_CFG1.SLOPE
RFTXOBW_MLV.HLEVEL
RFTXOBW_SLV.LLEVEL
VREFRFCTRL
RFC.XOSCPLLMON, .ENPLLMON
RFSDCTRL.ASKFSKSEL, .GFEN
RFTXOBW_CFG0.OBWCEN,
.WUC_OVR, .PA_ON
Lib_Serv_Start_Xtal_Osc
Xtal Status ==0?
yes
Lib_Serv_VCO_Tuning no
Send_bits(N,*ptrD, Type)
RFENC.RFMODE=5
( NRZ encoding)
RFRGCFG0.RAMPEN=1
RFRGCFG0.BYPASS=1
PLLCFG0.TOPA_EN =1
PLLCFG0.EN=1
RFC.ENPA =0
RFTXCFG1 .TXDEN =1
VCO Status ==0?
yes
Lib_Serv_Config_RF_
Transmission() no no
CFG1.TXAEN=1
RFTXCFG0 .TXMASTER =0
CFG1.VREGRFEN=1
CPU mode?
FSM
CFG1.TXAEN=0
RFTXCFG0 .TXMASTER =1
Figure 37 return
Aux_RF_Stop
Aux_RF_Init (mode=CPU)
ENPA=1
Read-Clear REF
Clear bit REFM.RERFUM
( resume on RFD empty )
Send_bits(N1,*ptrS, SOM)
Send_bits(N2,*ptrP, PAY)
Send_bits(N3,*ptrE, EOM)
Wait one data-bit time
RFTXCFG0.FSMSTOP=1
RFTXCFG1.TXDEN=0
PLLCFG0.EN=0
PLLCFG0.TOPA_EN=0
RFTXCFG0.TXMASTER=0
CFG1.VREGRFEN=0
RFRGCFG0.RAMPEN=0
RFRGCFG0.BYPASS=0
RFTXOBW_CFG0.WUC_OVR=0
RFTXOBW_CFG0.OBWCEN=0
ENPA=0
Lib_Serv_Stop_Xtal_Osc
Aux_RF_Stop return END
Transmission error handling routine
Flowchart of Example 5c (RFTelegramCPU)
Type==PAY?
yes
RFENC.RFMODE=0
( Manchester ) no
N >= 8?
yes
RFENC.RFDLEN=7
N=N-8
Load RFD using *ptrD
IDLE=1
Read-Clear REF
(OOL OR XFAIL OR
ITIM_FLAG)==1?
RERFF==1?
yes
Return no N >0?
yes
RFENC.RFDLEN=N-1
N=0 no Type ==EOM?
yes
Clear REFM.RERFFM
(resume on shift register empty) no
Transmission error handling routine
Similar to the previous sample program, this program will send an RF-frame, but without repetitions this time.
One frame will be sent out, afterwards the device will go to Powerdown. After wakeup, which occurs each second, the same frame is sent again and so on.
For observing RF-encoder output at PP2, a small modification is again necessary, as shown in below.
Add these two lines to enable RF-encoder data visualization at PP2
Figure 38 Modifying example 5c for observation of RF-encoder output at PP2
The output that can be observed is display in the next figure.
Application Note 25 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
Figure 39
SOM = 10000001 0xFF 0xFF 0xFE count 0x55
RF-encoder output of example 5c
EOM = 10000001
5.12
Example 6: IFXApsDemo
This program shall demonstrate a basic APS application using all available IFX APS functions. The device is in powerdown and waits until an acceleration threshold is reached. Afterwards sampling is started using
Lib_APS_Sample(), followed by the processing also done by library functions. The most important parameters may be defined in the application in order to adapt the application to different scenarios. During processing, robustness criteria 1-3 can optionally be enabled and then restart the application in case of poor data. After processing, either extrapolation- or time&phase-method may be used in order to transmit APS information to a receiver.
This example can be configured in many ways in order to adopt it flexibly to many different scenarios. All necessary parameters may be changed inside the file “Application.h” and they are grouped in two categories:
Mode Selection: o Information mode: Either Extrapolation or Time-and-Phase o RC mode: Activate/Deactivate checking of robustness criteria o K1 adapt mode: The software is also capable of correction of the K1 parameter (according to wheel size) in order to support many different wheel sizes without the need of re-programming the APS application. o Mounting direction: positive or negative, must be according to the mounting of the module o DFT mode: use either software cordic (fast) or hardware cordic (flexible) o APS mode: activate fine frequency calculation of Lib_APS_Sin_Parameter_Estimate (needed for extrapolation)
Adaptable Constants: o N0: Number of samples to be taken per period o DFT_Min/DFT_Max: limits for the hardware cordic o K1: Parameter which is proportional to the wheel size o LOG2_OSF: Defines oversampling factor for acceleration sampling o ABSDIF_TH: limit for robustness criteria 1 (AbsDif)
Application Note 26 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs o MAXMIN_TH: limit for robustness criteria 2 (MaxMin) o DFTPTA_TH: limit for robustness criteria 3 (DftPta) o ACC_TH: threshold of acceleration in g for starting APS o PHASE_TX: applies only in extrapolation mode and defines the desired angle where to transmit
Furthermore there is the possibility to blink the LED connected to PP2 or PP3 whenever the APS if finished. In extrapolation method this would mean after reaching the desired angle, thus the LED should ideally blink always at the same angle. The option to turn on/off the blinking of the LED is inside the file “Application.h” and is shown in the next figure.
Figure 40 Configuration for turning LED blinking on/off in example 6
Application Note 27 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Example programs
The flow of the application is given in the next figure.
Start
N
Power On Reset
Y
Lib_Serv_Start_Xtal_Osc(2,10)
N
Lib_Serv_VCO_Tuning(1)
IT Wakeup
State == ‚Init‘
Y
Measure absolute acceleration
N
Lib_Serv_Carrier_Wave(0x80)
Calibration of the IT
IT Wakeup Mask Enable
Set State to ‚Init‘
Powerdown
Acceleration
>Threshold
Y
Reconfiguration of timers
N
Calibrate IT to long Interval
Calibrate ST to 25ms
Save f_RC (from ST Value)
APS_Initialize
Enable Resume by ST
Prepare Sample_Array
Set State to ‚Sampling‘
Deep Idle
Calibration of the IT
IT Wakeup Mask Enable
Set State to ‚Init‘
Powerdown
Y
N
Resum from
Deep Idle
State ==
‚Sampling‘
APS_Sample
Sample Error or
RC1/2 failed
N
All Samples acquired
N
Stop Sampletimer
Configure&Start Timer0
Prepare APS_Results
APS_DFT
Y
RC3 failed
APS_Sin_Parameter_Est.
Prepare Data for RF Tx
Config RF Transmitter
Extrapolate to desired angle
Y
Extrapolation
Method
Resume from
TX LP
Stop FSM
Stop_Xtal_Osc
Calibration of the IT
IT Wakeup Mask Enable
Set State to ‚Init‘
Powerdown
Deep Idle
Start_Xtal_Osc
VCO_Tuning
Blink LED (opt.)
Start FSM
TX Low Power
Figure 41
Application Note
Flowchart of Example 6 (IFXApsDemo)
28 of 30 V 2.0
2021-01-20
SP4x Development Kit
Quickstart Guide
Table of contents
Revision history
Document version
V 2.0
Date of release Description of changes
2021-01-20 Update for new development-board V5
Application Note 29 of 30 V 2.0
2021-01-20
Trademarks
All referenced product or service names and trademarks are the property of their respective owners.
Edition 2021-01-20
Published by
Infineon Technologies AG
81726 Munich, Germany
© 2021 Infineon Technologies AG.
All Rights Reserved.
Do you have a question about this document?
Email: [email protected]
Document reference
IMPORTANT NOTICE
The information contained in this application note is given as a hint for the implementation of the product only and shall in no event be regarded as a description or warranty of a certain functionality, condition or quality of the product. Before implementation of the product, the recipient of this application note must verify any function and other technical information given herein in the real application. Infineon Technologies hereby disclaims any and all warranties and liabilities of any kind
(including without limitation warranties of noninfringement of intellectual property rights of any third party) with respect to any and all information given in this application note.
The data contained in this document is exclusively intended for technically trained staff. It is the responsibility of customer’s technical departments to evaluate the suitability of the product for the intended application and the completeness of the product information given in this document with respect to such application.
For further information on the product, technology, delivery terms and conditions and prices please contact your nearest Infineon Technologies office
( www.infineon.com
).
WARNINGS
Due to technical requirements products may contain dangerous substances. For information on the types in question please contact your nearest Infineon
Technologies office.
Except as otherwise explicitly approved by Infineon
Technologies in a written document signed by authorized representatives of Infineon
Technologies, Infineon Technologies’ products may not be used in any applications where a failure of the product or any consequences of the use thereof can reasonably be expected to result in personal injury.
Prenesi
Oglas