Download presentation
Presentation is loading. Please wait.
1
Developing a multi-thread product -- Introduction
M. Smith Electrical Engineering, University of Calgary ucalgary.ca 12/4/2018
2
Tackled today GPS example of a multi-tasking DSP problem
What is GPS and how does it fit into Lab. 4? Lab. 4 concepts VisualDSP VDK environment – 1 hour prelab. Adding a boot thread Adding (and then creating) free-running threads Adding Semaphore so threads communicate 12/4/2018
3
References Understanding GPS Principles and Applications, 1996, Elliott D. Kaplan Digital Signal Processing – A Practical Approach, 1993, Emmanuel C. Ifeachor, Barrie W. Jervis ADSP-TS101 TigerSHARC and Blackfin Processor Programming References, Analog Devices Articles submitted to Circuit Cellar magazine by M. Smith, March 2004 12/4/2018
4
Introduction GPS traditionally done with ASIC/Processor combination
Looking at FPGA/DSP combination for low end GPS receivers Technological interest in software radio Cheaper, quicker development cycle. Customizations for special applications From a talk by Darrell Anklovitch for ENEL619.23 12/4/2018
5
What is GPS? Global Positioning System 24 satellite (SV) constellation
Orbiting 20,000 km from the surface of the Earth in 12 hour cycles Orbits are set-up to give global coverage 24 hours a day Need at least 4 satellites in view to calculate a position (1) 12/4/2018
6
GPS Positioning Concepts
(1) For now make 2 assumptions: We know the distance to each satellite We know where each satellite is Require 3 satellites for a 3-D position in this “ideal” scenario Requires 4 satellites to account for local receiver clock drift. 12/4/2018
7
GPS Signal Structure Each satellite transmits 2 carrier frequencies referred to as L1 (1575 MHz) and L2 (1227 MHz) Each carrier frequency is BPSK modulated with a unique PRN (pseudo random number) code The PRN code on L1 is called CA code (coarse acquisition), The PRN code on L2 is called P code (precise) CA code takes 1 ms for full PRN transmission at 1MHz chip (bit) rate. P code takes 1.5 s for full PRN transmission at ~10MHz chip rate Also modulated on each carrier is 50 Hz data that includes the current position of the satellite 12/4/2018
8
Determining Time Use the PRN code to determine time
(1) Use the PRN code to determine time Use time to determine distance to the satellite distance = speed of light * time 12/4/2018
9
Algorithms to Find PRN Phase
Time-domain Cross correlation: 1/N ∑ x1 (n) * x2(n) Coding equivalent to FIR filter, but need to filter N sets of data, each shifted by one data point Correlation of perfectly matching signals gives a maximum value Correlation of 2 random data sequences tends to 0 PRN code from different satellites are designed to correlate to 0. Frequency domain correlation: 1/N F-1[X1(k)X2(k)] where F-1 is the inverse Discrete Fourier Transform and the X’s are the Discrete Fourier Transforms of two sequences D 12/4/2018
10
Timing Frequency Domain 1/N F-1[X1(k)X2(k)]
1024 point FFT (2 * NLOG2N) 1024 MULTS (N) 1024 point INV FFT (NLOG2N) Time Domain 1/N ∑ x1 (n) * x2(n) n = 0 1024 MACs (N) 1024 Phases (N) 30,000 Complex operations N-1 1,048,576 operations (N2) 12/4/2018
11
TigerSHARC -- TS101 and TS201 TS101 TS201 Low-cost version $45 / chip
Evaluation boards $950 each educational price 12/4/2018
12
Lab. 4 and Take-Home Quiz 4 Demonstrate developing a multi-threaded environment involving the receiving and analysis of 3 satellite signals Lab 4 VDK environment Use of current assembly FIR code for correlation analysis Take-home quiz (Done individually) Use Analog Devices provided FFT code Develop your own assembly language code using CLU functionality -- XCORRS 12/4/2018
13
Lab. 4 – Parts 1, 2 and 3 – done as pre-laboratory tasks – about 1 hour
Part 1 -- Create an Initialization Thread Use VDK::Sleep(200) sleep as a work load Part 2 – Launch (create) Satellite Receiver Tasks as free running tasks Use VDK::Sleep(X) as a work load ClearReceiverThread X = 100 ReceiveSatellite X = 10 ReceiveSatellite X = 20 ReceiveSatellite X = 30 Part 3 – Add semaphores to get satellite tasks running in proper time sequences 12/4/2018
14
Lab. 4 – Continued – details to be added
Part 4 -- Add Satellite Receiver Tasks Payloads Download payload code from the web – code provided Part 5 – Generate E-TTD tests for correlation function designed using your existing FIR filter code Part 6 – Add analysis and reporting threads Part 7 – adjust task priorities to make realistic and working Demo and code hand-in with minor write-up 12/4/2018
15
Adding the initialization Thread
Blackfin code (VisualDSP 3.5) can be found at TigerSHARC VDK Different implementation for each version of processor (0.1 or 1.0) because of number of available timers on the chips Slightly different setup between Visual DSP 3.5 and 4.0 because of the silicon differences mentioned above. 12/4/2018
16
VDK set-up for TigerSHARC (3.5)
12/4/2018
17
VDK Setup – Visual DSP 4.0 12/4/2018
18
Adding the Initialization Thread
12/4/2018
19
Making the InitializationThread a Boot-Thread
Automatically Generated Thread Code 12/4/2018
20
Adding a VDK::Sleep(200) work load to the Initialization Thread
VDK-Thread activity window can be activated through VIEW | VDK window menu option – you can Zoom into find fine details of certain activities WARNINGL If the silicon option are incorrect – only the IDLE thread seen 12/4/2018
21
Thread window legend (Right click in thread window to activate)
Running Sleeping Status change Tick (0.05 ms default) 12/4/2018
22
Now add the following threads with following VDK::Sleep( ) periods
ReceiverControlThread ticks ReceiverBufferClear ticks Receive1Satellite ticks Receive2Satellite ticks Receive3Satellite ticks 12/4/2018
23
Thread code automatically generated Example after running the code
Problem – the threads have not been created – so they exist but don’t run 12/4/2018
24
Still problems All threads are launched
But one thread has taken over all the resources of the system 12/4/2018
25
Reason for Problem Thread is just spinning its wheels
Forgot to add the sleep? 12/4/2018
26
Solution Thread now all in existence – but free running
Need to add “semaphores” to gain control 12/4/2018
27
Receiver Requirements
On receipt of “Capture Signal” semaphore Clear ReceiverBuffer When receiver buffer is cleared Grab satellite signals 1, 2 and 3 12/4/2018
28
Requirements rephrased ReceiverControlThread
VDK::PendSemaphore(kCaptureSignalSTART, 0); On receipt of “Capture Signal” semaphore VDK::PostSemaphore(kReceiverBufferClearSTART) Clear ReceiverBuffer VDK::PendSemaphore(kReceiverBufferClearDONE, 0); When receiver buffer is cleared VDK::PostSemaphore(kReceiver1SatelliteSTART); VDK::PostSemaphore(kReceiver2SatelliteSTART); VDK::PostSemaphore(kReceiver3SatelliteSTART); Grab satellite signals 1, 2 and 3 VDK::Sleep (200) VDK::PostSemaphore(kCaptureSignalDONE); 12/4/2018
29
Requirements rephrased
ReceiverBufferClear VDK::PendSemaphore(ReceiverBufferClearSTART, 0); VDK::Sleep (10); // Will be replaced by process later VDK::PostSemaphore(ReceiverBufferClearDONE); Typical Satellite Thread VDK::PendSemaphore(ReceiverXSatelliteSTART, 0); VDK::Sleep (X); // Will be replaced by process later VDK::PostSemaphore(ReceiverXSatelliteDONE); What are the syntax errors in the code? 12/4/2018
30
Adding a semaphore 12/4/2018
31
Method code added Why does not anything work?
What do you have to do to get this? 1 line change 12/4/2018
32
Some issues remaining Blue bar means what? Why is distance between Init Thread Green bar means what? and start of Receiver Control thread Grey bar means what? changing? Yellow arrow means what? Is it a problem that Satellite 3 task finishes after receiver control thread starts to sleep? 12/4/2018
33
Tackled today GPS example of a multi-tasking DSP problem
What is GPS and how does it fit into Lab. 4? Lab. 4 concepts VisualDSP VDK environment – 1 hour prelab. Adding a boot thread Adding (and then creating) free-running threads Adding Semaphore so threads communicate 12/4/2018
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.