Texas Instruments | LIN Demonstration using PGA450Q1EVM Firmware Rev 2.1 (Rev. A) | Application notes | Texas Instruments LIN Demonstration using PGA450Q1EVM Firmware Rev 2.1 (Rev. A) Application notes

Texas Instruments LIN Demonstration using PGA450Q1EVM Firmware Rev 2.1 (Rev. A) Application notes
Application Report
SLDA035A – June 2015 – Revised July 2015
LIN Demonstration Using PGA450Q1EVM
Firmware Rev 2.1
Clancy Soehren and Akeem Whitehead .................................................................................. MSA-ASC
ABSTRACT
This demonstration is intended to illustrate the method of using the internal 8051 MCU firmware of the
PGA450-Q1 device to calculate the time of flight (tof) using LIN communication to trigger a distance
computation. The settings for short distance measurements have been updated from Rev. 2.0 to Rev 2.1
of the firmware. Differences include an optimized threshold algorithm (optimized for the TI setup) and a
decreased blanking time for short distance measurements.
1
2
3
Contents
Introduction ................................................................................................................... 2
Setup .......................................................................................................................... 2
Procedure ..................................................................................................................... 5
List of Figures
1
2
3
4
5
6
7
8
9
10
11
12
.................................................................
Empty Setup for Long Distance ............................................................................................
Empty Setup for Short Distance ...........................................................................................
Settings When First Opening GUI .........................................................................................
Placing Microcontroller in Reset State Under ESFR Tab ..............................................................
Checking OTP Status Under OTP Tab ...................................................................................
Loading .HEX File if OTP is Programmed to Jump to DEVRAM ......................................................
Placing the Microcontroller to the Active State After Loading .HEX File .............................................
LIN Receive Command Verifying Communication ......................................................................
LIN Transmission Example of a Long Distance Measurement ........................................................
LIN Transmit to Program EEPROM-Based Thresholds ................................................................
Example Snippet of FIFO Data Exported to Excel Spreadsheet ......................................................
Example of a valid echo logged beyond the threshold
3
4
4
5
5
6
6
7
7
8
8
9
List of Tables
1
LIN Transmit Commands ................................................................................................... 2
2
LIN Receive Commands .................................................................................................... 2
3
FIFO DATA Location of Threshold Ranges .............................................................................. 4
Excel, Microsoft are registered trademarks of Microsoft Corporation.
All other trademarks are the property of their respective owners.
SLDA035A – June 2015 – Revised July 2015
Submit Documentation Feedback
LIN Demonstration Using PGA450Q1EVM Firmware Rev 2.1
Copyright © 2015, Texas Instruments Incorporated
1
Introduction
1
www.ti.com
Introduction
Time of flight (tof) is a time estimation of how long the ultrasonic wave transmitted from the transducer
takes to travel to the object, and then from the object back to the transducer. Use Equation 1 to calculate
the distance between the transducer and object using tof.
§t ·
Dist ance (meters) ¨ of ¸ u CAir
© 2 ¹
where
•
•
tof = time of flight in s
CAir = 343.1 m/s = speed of sound in air at 20°C and absolute pressure 1 bar
(1)
To calculate the time of flight, use Equation 2.
tof (s)
§
1·
tBLANKING ¨ LocationFIFO u DOWNSAMPLE u ¸
f
S¹
©
where
•
•
•
•
2
tBLANKING = 16 µs × (BLANKING_TIME decimal register value)
LocationFIFO = single byte location of interest from the 768 bytes available
DOWNSAMPLE = downsample rate decimal register value
fS = ADC sampling frequency, 1 MHz
(2)
Setup
The firmware configures the 8051 with the appropriate settings for long and short distance estimation.
These operations are initiated by a LIN transmission from the GUI and LIN master on the PGA450Q1EVM
to the on-board PGA450-Q1 slave device.
Step 1. Hold the micro in reset and load the firmware into the DEVRAM (OTP programmed to JUMP
to DEVRAM so that micro executes instructions from the DEVRAM).
Step 2. Release the micro and send specific LIN transmissions to trigger operations listed in Table 1.
Table 1. LIN Transmit Commands
LIN TX PID
TX DATA
PURPOSE
11
0x(01)
Long distance from 1 m to 5 m
11
0x(00)
Short distance from 15 cm to 1 m
31
7 bytes [D0:D6]
Program 7 bytes of EEPROM data from addresses 0x0400 to 0x0406. These 7 bytes are
used to determine the threshold levels during echo detection. The upper nibble of each byte is
used for long distance measurement, while the lower nibble is used for short distance
measurement.
Step 3.
Data can also be retrieved back from the device using specific LIN transmissions as listed in
Table 2.
Table 2. LIN Receive Commands
LIN RX PID
BYTES TO BE
RECEIVED
PURPOSE
21
2
LIN communication check: data 0x1234 will be received
Time of Flight data: Data 0xYYYY will be received
Data = FFFF implies no object, Data = 0000 implies no burst
Time of flight can be determined by converting data into decimal and then multiplying by
1e-6 (timer resolution):
22
2
tof = hex2dec(YYYY) × 1e-6 s
where
•
2
YYYY = 0xMSBLSB (MSB at AddrD3 [TX_DATA0] and LSB at
AddrD4 [TX_DATA1])
LIN Demonstration Using PGA450Q1EVM Firmware Rev 2.1
Copyright © 2015, Texas Instruments Incorporated
(3)
SLDA035A – June 2015 – Revised July 2015
Submit Documentation Feedback
Setup
www.ti.com
Step 4.
Echo data is stored in an external RAM of 768 bytes (FIFO_DATA from 0 to 767). A valid
echo is determined by comparing the FIFO_DATA with the threshold level corresponding to
the FIFO_DATA location. The threshold levels typically decrease as the FIFO_DATA location
increases as nearer objects produce a stronger echo as compared to objects further away.
Figure 1 shows a valid echo compared to the decreasing threshold levels.
300
FIFO Data
Threshold
Valid Echo
250
FIFO Data
200
150
100
50
0
-30
170
370
FIFO Data Location
570
770
D001
Figure 1. Example of a valid echo logged beyond the threshold
Step 5.
For this demonstration to work, ensure that the first 7 bytes of the EEPROM data are
programmed with appropriate values to correctly differentiate between valid echoes and
noise. Thresholds levels for long distance range can be set up independent to the threshold
levels for the short distance range. The upper nibble of EE_DATA[0:6] controls the threshold
levels for the long distance instruction, while the lower nibble of EE_DATA[0:6] controls the
threshold levels for the short distance instruction.
SLDA035A – June 2015 – Revised July 2015
Submit Documentation Feedback
LIN Demonstration Using PGA450Q1EVM Firmware Rev 2.1
Copyright © 2015, Texas Instruments Incorporated
3
Setup
www.ti.com
For short distance instruction, FIFO_CTRL (= 0x07) is set up for Mid-8bit mode with NO ROLLOVER in
the firmware. For long distance instruction, FIFO_CTRL (= 0x06) is configured for LSB mode with NO
ROLLOVER in the firmware. The relation between FIFO DATA location and threshold value is as
stated listed in Table 3.
The EE_DATA[0:6] was programmed with 0x(DC), 0x(6B), 0x(59), 0x(44), 0x(33), 0x(22) and 0x(11) for
measurements on the TI set up.
Table 3. FIFO DATA Location of Threshold Ranges
FIFO DATA LOCATION
START
THRESHOLD LEVEL
END
LONG DISTANCE
0
31
Ignore echo
32
63
EE_DATA_0[7:4] × 8 + 12
64
95
EE_DATA_1[7:4] × 8 + 12
96
127
EE_DATA_2[7:4] × 8 + 12
128
159
EE_DATA_3[7:4] × 8 + 12
160
191
EE_DATA_4[7:4] × 8 + 12
192
223
EE_DATA_5[7:4] × 8 + 12
224
255
EE_DATA_6[7:4] × 8 + 12
256
767
10
0
3
EE_DATA_0[3:0] × 16 + 4
4
7
EE_DATA_1[3:0] × 16 + 4
SHORT DISTANCE
8
11
EE_DATA_2[3:0] × 16 + 4
12
15
EE_DATA_3[3:0] × 16 + 4
16
19
EE_DATA_4[3:0] × 16 + 4
20
23
EE_DATA_5[3:0] × 16 + 4
24
63
EE_DATA_6[3:0] × 16 + 4
64
767
4
Step 6.
The preferred method of determining the threshold levels is to observe the FIFO DATA for a
test set-up with no object (empty set up), and then define the appropriate levels. The raw
FIFO DATA can be viewed by placing the micro in reset and clicking on the Read and save
FIFO data to file button (this feature requires MICROSOFT OFFICE 2007 or a later version to
be installed). This procedure will need to complete for both long and short distance. Plots for
the empty set up on the TI bench are shown in Figure 2 and Figure 3 for reference:
300
300
FIFO Data
Threshold
250
250
200
FIFO Data
FIFO Data
200
150
150
100
100
50
50
0
0
0
200
400
600
FIFO Data Location
800
1000
0
50
D002
Figure 2. Empty Setup for Long Distance
4
FIFO Data
Threshold
100
FIFO Data Location
150
200
D003
Figure 3. Empty Setup for Short Distance
LIN Demonstration Using PGA450Q1EVM Firmware Rev 2.1
Copyright © 2015, Texas Instruments Incorporated
SLDA035A – June 2015 – Revised July 2015
Submit Documentation Feedback
Procedure
www.ti.com
3
Procedure
Step 1.
Supply power to the EVM and open the GUI.
Figure 4. Settings When First Opening GUI
Step 2.
Place the micro in reset by clicking OFF (MicroReset) from the ESFR tab.
Figure 5. Placing Microcontroller in Reset State Under ESFR Tab
SLDA035A – June 2015 – Revised July 2015
Submit Documentation Feedback
LIN Demonstration Using PGA450Q1EVM Firmware Rev 2.1
Copyright © 2015, Texas Instruments Incorporated
5
Procedure
www.ti.com
Step 3.
Check status of OTP by clicking Check OTP Status from the OTP tab. Verify the response
reads PROGRAMMED to jump to DEVRAM or EMPTY). If the response reads
PROGRAMMED, replace the PGA450-Q1 device on the EVM with a new unit.
Figure 6. Checking OTP Status Under OTP Tab
Step 4.
Load the program into the DEVRAM by clicking Load .HEX File into GUI from the DEVRAM
tab. If the OTP status was PROGRAMMED to JUMP to DEVRAM in the previous step, then
checking the PROGRAM OTP Memory Also box is not required (as shown in Figure 7). If the
OTP status was EMPTY, then this box must be checked and 8 V must be supplied on the
VPROG OTP pin. A provision on the EVM provides 8 V to the VPROG_OTP pin through
jumper settings.
Figure 7. Loading .HEX File if OTP is Programmed to Jump to DEVRAM
6
LIN Demonstration Using PGA450Q1EVM Firmware Rev 2.1
Copyright © 2015, Texas Instruments Incorporated
SLDA035A – June 2015 – Revised July 2015
Submit Documentation Feedback
Procedure
www.ti.com
Step 5.
Release the micro out of reset by clicking ON (MicroActive) from the ESFR tab.
Figure 8. Placing the Microcontroller to the Active State After Loading .HEX File
Step 6.
Send a LIN transmission by clicking the RECEIVE button with a PID = 21 and the number of
bytes to be received = 2. As shown in Figure 9, 0x1234 should be received, verifying that the
LIN communication is working.
Figure 9. LIN Receive Command Verifying Communication
SLDA035A – June 2015 – Revised July 2015
Submit Documentation Feedback
LIN Demonstration Using PGA450Q1EVM Firmware Rev 2.1
Copyright © 2015, Texas Instruments Incorporated
7
Procedure
www.ti.com
Step 7.
Step 8.
Send a LIN transmission by clicking the TRANSMIT button with a PID = 11 and the Data to
be Txed = 0x01 which triggers a long distance measurement.
Next, send a LIN transmission by clicking the RECEIVE button with PID = 22 and bytes to be
received = 2. The time of flight in micro seconds in the format of 0xYYYY and distance in
meters is provided.
Figure 10. LIN Transmission Example of a Long Distance Measurement
Step 9.
If the EEPROM must be programed for echo threshold comparison, send a LIN transmission
by clicking the TRANSMIT button with a PID = 31 and the Data to be Txed with the seven
data bytes. This command programs EEPROM locations 0x0400 to 0x0406 with the
transmitted data.
Figure 11. LIN Transmit to Program EEPROM-Based Thresholds
8
LIN Demonstration Using PGA450Q1EVM Firmware Rev 2.1
Copyright © 2015, Texas Instruments Incorporated
SLDA035A – June 2015 – Revised July 2015
Submit Documentation Feedback
Procedure
www.ti.com
Step 10. To retrieve the echo data, put the micro in reset and click on the Read and Save FIFO data
to File button from the FIFO/ECHO tab which opens an Excel® file with the data.
NOTE: Microsoft® Office 2007 or newer version is needed.
This is example snippet showcases results from a different experiment, but was exported using the same GUI.
Figure 12. Example Snippet of FIFO Data Exported to Excel Spreadsheet
SLDA035A – June 2015 – Revised July 2015
Submit Documentation Feedback
LIN Demonstration Using PGA450Q1EVM Firmware Rev 2.1
Copyright © 2015, Texas Instruments Incorporated
9
Revision History
www.ti.com
Revision History
Changes from Original (#IMPLIED) to A Revision .......................................................................................................... Page
•
Changed the units for time of flight (tof) ................................................................................................. 2
NOTE: Page numbers for previous revisions may differ from page numbers in the current version.
10
Revision History
SLDA035A – June 2015 – Revised July 2015
Submit Documentation Feedback
Copyright © 2015, Texas Instruments Incorporated
IMPORTANT NOTICE
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, enhancements, improvements and other
changes to its semiconductor products and services per JESD46, latest issue, and to discontinue any product or service per JESD48, latest
issue. Buyers should obtain the latest relevant information before placing orders and should verify that such information is current and
complete. All semiconductor products (also referred to herein as “components”) are sold subject to TI’s terms and conditions of sale
supplied at the time of order acknowledgment.
TI warrants performance of its components to the specifications applicable at the time of sale, in accordance with the warranty in TI’s terms
and conditions of sale of semiconductor products. Testing and other quality control techniques are used to the extent TI deems necessary
to support this warranty. Except where mandated by applicable law, testing of all parameters of each component is not necessarily
performed.
TI assumes no liability for applications assistance or the design of Buyers’ products. Buyers are responsible for their products and
applications using TI components. To minimize the risks associated with Buyers’ products and applications, Buyers should provide
adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or
other intellectual property right relating to any combination, machine, or process in which TI components or services are used. Information
published by TI regarding third-party products or services does not constitute a license to use such products or services or a warranty or
endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the
third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of significant portions of TI information in TI data books or data sheets is permissible only if reproduction is without alteration
and is accompanied by all associated warranties, conditions, limitations, and notices. TI is not responsible or liable for such altered
documentation. Information of third parties may be subject to additional restrictions.
Resale of TI components or services with statements different from or beyond the parameters stated by TI for that component or service
voids all express and any implied warranties for the associated TI component or service and is an unfair and deceptive business practice.
TI is not responsible or liable for any such statements.
Buyer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements
concerning its products, and any use of TI components in its applications, notwithstanding any applications-related information or support
that may be provided by TI. Buyer represents and agrees that it has all the necessary expertise to create and implement safeguards which
anticipate dangerous consequences of failures, monitor failures and their consequences, lessen the likelihood of failures that might cause
harm and take appropriate remedial actions. Buyer will fully indemnify TI and its representatives against any damages arising out of the use
of any TI components in safety-critical applications.
In some cases, TI components may be promoted specifically to facilitate safety-related applications. With such components, TI’s goal is to
help enable customers to design and create their own end-product solutions that meet applicable functional safety standards and
requirements. Nonetheless, such components are subject to these terms.
No TI components are authorized for use in FDA Class III (or similar life-critical medical equipment) unless authorized officers of the parties
have executed a special agreement specifically governing such use.
Only those TI components which TI has specifically designated as military grade or “enhanced plastic” are designed and intended for use in
military/aerospace applications or environments. Buyer acknowledges and agrees that any military or aerospace use of TI components
which have not been so designated is solely at the Buyer's risk, and that Buyer is solely responsible for compliance with all legal and
regulatory requirements in connection with such use.
TI has specifically designated certain components as meeting ISO/TS16949 requirements, mainly for automotive use. In any case of use of
non-designated products, TI will not be responsible for any failure to meet ISO/TS16949.
Products
Applications
Audio
www.ti.com/audio
Automotive and Transportation
www.ti.com/automotive
Amplifiers
amplifier.ti.com
Communications and Telecom
www.ti.com/communications
Data Converters
dataconverter.ti.com
Computers and Peripherals
www.ti.com/computers
DLP® Products
www.dlp.com
Consumer Electronics
www.ti.com/consumer-apps
DSP
dsp.ti.com
Energy and Lighting
www.ti.com/energy
Clocks and Timers
www.ti.com/clocks
Industrial
www.ti.com/industrial
Interface
interface.ti.com
Medical
www.ti.com/medical
Logic
logic.ti.com
Security
www.ti.com/security
Power Mgmt
power.ti.com
Space, Avionics and Defense
www.ti.com/space-avionics-defense
Microcontrollers
microcontroller.ti.com
Video and Imaging
www.ti.com/video
RFID
www.ti-rfid.com
OMAP Applications Processors
www.ti.com/omap
TI E2E Community
e2e.ti.com
Wireless Connectivity
www.ti.com/wirelessconnectivity
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2015, Texas Instruments Incorporated
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Related manuals

Download PDF

advertising