Multi-threaded projects Services and Drivers Alternate ways of doing Labs 1, 2, 3 and 4.
-
Upload
walter-carpenter -
Category
Documents
-
view
217 -
download
2
Transcript of Multi-threaded projects Services and Drivers Alternate ways of doing Labs 1, 2, 3 and 4.
Multi-threaded projects
Services and Drivers
Alternate ways of doing Labs 1, 2, 3 and 4.
ENCM415 – “Ideal” final project
Plans for a “complete” Lab. 4 Run the audio input and output (Lab. 0) Reading the light sensor (Lab. 2) Reading the thermal sensor (Lab. 3) Displaying values in the Flash LED (Lab. 1) Displaying values on the external LCD screen over
the SPI interface (Lab. 4) Using interrupts (Labs. 2, 3 and 4) Control that robot car (Lab. 17) and plane (Lab.
22000) Do-able with knowledge we already have Spend 40 hours to complete – is there a simpler way
04/21/23 2 / 28
A simpler way
Some teams prefer to use development approaches essentially equivalent to what we have done in Labs 1, 2 and 3
Becomes easier with practice, but does not come easy.
Other teams are using “prepared” code from the manufacturer. Threads Services and Drivers Reliability issues “forcing” manufacturers to
ensure “prepared code” works well
04/21/23 3 / 28
Doing Lab. 4 project in industry
We might not develop a final “.dxe” executableWe might get each task to run by its selfThen add each task as a “thread” inside a
multi-threaded operating system.The processor (using core timer interrupts)
would automatically switch between tasks as each data became available
Easier to integrate new Lab. with the previous labs
Straight forward to do with Analog Devices VDK – Visual DSP Kernel, uCLinux, uC-OS etc etc
04/21/23 4 / 28
04/21/23
Initialization Thread
04/21/23 6 / 45
Main Thread – example
Each Lab. 4 task has its own threadfunction which replaces the sleep
While task “pends” (wait till ready), it automatically gets switched out of the processor
04/21/23 7 / 45
VDK History shows tasks switched out when they have to wait
Concept of task priority
Would VDK make 415 easier
NO, using VDK would make 415 harder as you have another interface to learn How do you debug a function (LED display)
when the function works with one thread and not with another?
Answer – with great difficulty
But learning VDK would make the ENCM491 (real time) and ENCM515 (DSP architectures) easier to learn as you could cut 6 weeks out of each class because of the extra 6 weeks needed in ENCM415 (a saving of 6 weeks).
04/21/23 8 / 28
Would threads make industry easier?
PROBABLY NOT, using threads the first time makes the project harder, you have another interface to learn
However “PROVIDED” the real-time operating system is “inexpensive” and “reliable” you have a common interface that many developers on your team can all use. Product is shorter time and lower cost
However, many developers don’t want to use “commercial” OS as “too slow”, “too difficult to customize” for the product. They would rather use the techniques you have used in ENCM415.
Also, using threads only changes about 20% of the code you have to develop. Basically all you have is better “while loops” and “easier semaphores” and”messaging”
04/21/23 9 / 28
System Services
Much of this presentation is based on Analog Devices on-line Blackfin training by David Lannigan at
my.analog.com/onlinetraining/Static/BOLDList.html
There are audio and video presentations onBlackfin® Device Drivers (May 2006)Blackfin System Services (Jan. 2006)Introduction to VDK (Sept. 2006)
It is recommended that users have some understanding of the Blackfin architecture, basic knowledge of software terminology and experience in embedded systems. Meaning have taken ENCM415
04/21/23 10 / 28
04/21/23 11 / 28
Would system services help in ENCM415?
For Labs. 1, 2 and 3 – No You have to know the sort of thing that
is supposed to happen with the hardware in some very simple cases (Flash memory, GPIO, LEDs)
How do you start an interrupt? How do you build an interrupt service
routine? How can you build a fast ISR in
assembly code?
04/21/23 12 / 28
Would system services help in Lab. 4?
System services provide you all the functions that you developed in Labs. 1, 2 and 3 for GPIO etc
If the services are simple to learn how to use for GPIO control, then perhaps we can quickly get it to work for the SPI interface.
Analog Devices has just recently updated their “services” software, so using services has potential
04/21/23 13 / 28
Proposed Lab. 4 – Demo-based
Demonstrate in class using services to do Labs. 1 and 2
50% -- Connect LCD screen to logic lab and switches. Place commands in an array. Manually (using switches) send commands to LCD screen to show “Happy 415 Christmas”
30% -- Demonstrate Lab. 4 Temperature and Light sensor using – You will need to add a modified “CalculateTemperature( )” from Lab. 3 and the PF9 service
20% -- Add a “SPI SERVICE” to transfer the commands from the Blackfin to the LCD
04/21/23 14 / 28
04/21/23 15 / 28
All true, the third timeyou try using it
However, that’s what you do inan industrial environment
04/21/23 16 / 28
All the non-hardwarestuff from Lab. 1, 2 and3 stays the same
VDK
All the hardwarestuff from Lab. 1, 2 and3 – “better?”
04/21/23 17 / 28
04/21/23 18 / 28
Powerful – once we know how to use it
Lots of new syntax to learn
04/21/23 19 / 28
Something related to Lab. 2
04/21/23 20 / 28
Some of these functions are recognizable
04/21/23 21 / 28
04/21/23 22 / 28
Interrupt handler hidden
04/21/23 23 / 28
But there is much to learn
04/21/23 24 / 28
Service for fast memory transfer
04/21/23 25 / 28
04/21/23 26 / 28
Sounds like Lab. 2
04/21/23 27 / 28
04/21/23 28 / 28
Many functions recognizable
04/21/23 29 / 28
04/21/23 30 / 28
Perhaps try for Lab. 4
04/21/23 31 / 28