Lab. 1 – Required Tasks. For more details – see the Lab. 1 web-site.

Slides:



Advertisements
Similar presentations
Getting the O in I/O to work on a typical microcontroller Activating a FLASH memory “output line” Part 1 Main part of Laboratory 1 Also needed for “voice.
Advertisements

Tutorial Essentially all the Blackfin instruction you need for all of ENCM511. The instructions are easy. Its knowing when to use them that is the difficult.
Over-view of Lab. 1 For more details – see the Lab. 1 web-site There will be a 20 min prelab quiz (based on Assignment 1 and 2) at the start of the lab.
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 2.
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 3 – New instruction recap Tutorial.
Assignment Overview Thermal oscillator One of the ENCM415 Laboratory 2 items Oscillator out GND +5V.
Boot Issues Processor comparison TigerSHARC multi-processor system Blackfin single-core.
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 2.
Lab. 1 – Earlier Tasks. Needed by both application and demonstration lab. streams For more details – see the Lab. 1 web-site There will be a 20 min prelab-quiz.
6/2/2015 Labs in ENCM415. Laboratory 2 PF control, Copyright M. Smith, ECE, University of Calgary, Canada 1 Temperature Sensor Laboratory 2 Part 2 – Developing.
Thermal arm-wrestling Design of a video game using two programmable flags (PF) interrupts Tutorial on handling 2 Hardware interrupts from an external device.
Over-view of Lab. 1 For more details – see the Lab. 1 web-site There will be a 20 min prelab quiz (based on Assignment 1 and 2) at the start of the lab.
Lab. 1 – Task 1 to 4 details For more details – see the Lab. 1 web-site There will be a 20 min prelab-quiz (based on Assignment 1 and 2) at the start of.
Lab. 2 – More details – Tasks 4 to 6 1. What concepts are you expected to understand after the Lab. 2 is finished? 2. How do you demonstrate that you have.
TigerSHARC Laboratory Setting up the HPP-ICE environment ICT 318 / 320 Running versions of the Audio-talk-through program.
Over-view of Lab. 1 For more details – see the Lab. 1 web-site There will be a 20 min prelab quiz (based on Assignment 1 and 2) at the start of the lab.
Getting the O in I/O to work on a typical microcontroller Ideas of how to send output signals to the radio controlled car. The theory behind the LED controller.
AVR Programming CS-212 Dick Steflik. ATmega328P I/O for our labs To get data into and out of our Arduino its a little trickier than using printf and.
Laboratory 1 – ENCM415 Familiarization with the Analog Devices’ VisualDSP++ Integrated Development Environment.
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 2.
Getting the O in I/O to work on a typical microcontroller Activating a FLASH memory “output line” Part 1 Main part of Laboratory 1 Also needed for “voice.
Just enough information to program a Blackfin Familiarization assignment for the Analog Devices’ VisualDSP++ Integrated Development Environment.
Blackfin BF533 EZ-KIT Control The O in I/O
Later tasks of Lab. 1 For more details – see the Lab. 1 web-site There will be a 20 min prelab quiz (based on Assignment 1 and 2) at the start of the lab.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Tutorial Essentially all the Blackfin instruction you need for all of ENCM511. The instructions are easy. Its knowing when to use them that is the difficult.
HD44780 LCD programming From the Hardware Side
Developing a bicycle speed-o-meter Midterm Review.
Input Laboratory: GPIO Pin control needed to have the Blackfin accept your commands Re-uses information from ENEL353 and ENCM369 courses and text books.
Assembly Language Review Being able to repeat on the Blackfin the things we were able to do on the MIPS 9/19/2015 Review of 50% OF ENCM369 in 50 minutes1.
Over-view of Lab. 1 See the Lab. 1 web-site and later lecture notes for more details.
ECS642U Embedded Systems Digital I/O William Marsh.
TigerSHARC Laboratory Setting up the HPP-ICE environment ICT 318 / 320 Running versions of the Audio-talk-through program.
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Digitalized Surround Sound Effects Using ADSP BF 533 Kunal Gupta ECE 3551, 03 Fall, 2006.
Blackfin Array Handling Part 1 Making an array of Zeros void MakeZeroASM(int foo[ ], int N);
Over-view of Lab. 1 See the Lab. 1 web-site and the lecture notes for more details.
Handling multiple input signals Version #2 – co-operative scheduler Version #3 – pre-emptive scheduler.
7. IRQ and PIC ENGI 3655 Lab Sessions. Richard Khoury2 Textbook Readings  Interrupts ◦ Section
بسم الله الرحمن الرحيم MEMORY AND I/O.
Lecture 3 CSE 341 – Microprocessors Lecture 3 Md. Omar Faruqe UB 1228
Lab. 1 – GPIO Pin control Using information ENEL353 and ENCM369 text books combined with Blackfin DATA manual.
Assembly Language Review Being able to repeat on the Blackfin the things we were able to do on the MIPS 2/26/2016 Review of 50% OF ENCM369 in 50 minutes1.
Assembly Language Review Being able to repeat on the Blackfin the things we were able to do on the MIPS 3/3/2016 Review of 50% OF ENCM369 in 50 minutes1.
Over-view of Lab. 1 See the Lab. 1 web-site and latter lecture notes for more details.
Aaron Worob.  Create a program using the Blackfin BF533 that allows the user to “move” the source of input sound.
Tutorial Essentially all the Blackfin instruction you need for all of ENCM511. The instructions are easy. Its knowing when to use them that is the difficult.
Help for Lab. 1 Subroutines calling Subroutines
See the Lab. 1 web-site and later lecture notes for more details
Developing a bicycle speed-o-meter
Thermal arm-wrestling
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
TigerSHARC processor and evaluation board
Lab. 2 – More details – Later tasks
Assembly Language Review
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
Lab. 4 – Part 1 Demonstrating and understanding multi-processor boot
Assembly Language Review
See the Lab. 1 web-site and later lecture notes for more details
HD44780 LCD programming From the Hardware Side
Tutorial Essentially all the Blackfin instruction you need for all of ENCM511. The instructions are easy. Its knowing when to use them that is the difficult.
Thermal arm-wrestling
Lab. 4 – Part 2 Demonstrating and understanding multi-processor boot
Lab. 1 – GPIO Pin control Using information ENEL353 and ENCM369 text books combined with Blackfin DATA manual.
Input Laboratory: GPIO Pin control needed to have the Blackfin accept your commands Re-uses information from ENEL353 and ENCM369 courses and text books.
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Developing a bicycle speed-o-meter
Blackfin BF533 EZ-KIT Control The O in I/O
Developing a bicycle speed-o-meter
Developing a bicycle speed-o-meter Part 2
Presentation transcript:

Lab. 1 – Required Tasks. For more details – see the Lab. 1 web-site

2 /25 Laboratory 1 – Tasks 1.Download the C++ Talk-through program. Board check -- Check that you can hear the audio output 2.Develop and test the code for initializing the Flash Memory and writing to the LED’s Use the provided tests to check your code 3.Routine for initializing the PF GPIO lines (programmable flags) Use the provided tests to check your code 4.Develop the ReadProgrammableFlagsASM( ) to read the switches Use the provided tests to check your code 5.Develop the Morse code program in C++ and ASM

3 /25 Set up for Task 1 AUDIO-IN AUDIO-OUT

4 /25 Task 1 Download audio-talk-through program If you have not already done so, download and expand ENCM415Directory2007.zip file so that you have the correct directory. structure and test driven development environment needed for Laboratory 1 and Assignments1. ENCM415Directory2007.zip Download and expand the files in 07CPP_Talkthrough.zip into your AudioDemo directory.07CPP_Talkthrough.zip Build an AudioDemo Blackfin project in your AudioDemo directory and add the (provided) files into the project -- compile and link. Download the executable (.dxe) file onto the BF533 processor. Hook up your CD or IPOD output to the CJ2 stereo input. Hook up your ear-phones to the CJ3 stereo output. Run the AudioDemo.dxe executable and check that the talk through program is working. This task demonstrated your ability to build VDSP Blackfin projects and run the code.

5 /25 Question What is a “talk-through program”? Clear example of applying the first two rules of assembly language programming Rule 1: If you have a choice – don’t use assembly code  It takes as much time (and SOST) to “design, code, review, test and maintain” one line of C++ code as it does assembly code, but one line of C++ often can do more Rule 2: If somebody has a working example, cannibalize it for your own work (if legal)

6 /25 The talk through program (C++) Prepare to run C++ code (before you get to main( )) Set up the EBIU External Bus Unit Use EBIU to initialize A/D and D/A SET UP the A/D and D/A interrupts while (1) { /* Wait for messages */ } ACTIVATE the A/D and D/A interrupts Every 1 / 44,000 s Store A/D register value (DMA) into memory Call ProcessDataCPP( ) or ProcessDataASM( ) Load memory (DMA) into D/A register Set messages and flags to main( ) main( ) ISR -- Interrupt Service Routine

7 /25 main( ) int main(void) { sysreg_write(reg_SYSCFG, 0x32); //Initialize System Configuration Register Init_EBIU(); Init_Flash(); Init1836(); Init_Sport0(); // Serial PORT Init_DMA(); Init_Sport_Interrupts(); Enable_DMA_Sport0(); // Serial PORT while (1) { /* */ } } The system prepares the processor to run C++ code (before you get to main( )) Set up the EBIU External Bus Unit Use EBIU to initialize A/D and D/A SET UP the A/D and D/A interrupts while (1) { /* Wait for messages */ } ACTIVATE the A/D and D/A interrupts

8 /25 ProcessDataCPP( ) #include "Talkthrough.h" extern volatile int iChannel0LeftIn, iChannel0LeftOut; void Process_DataCPP(void) { iChannel0LeftOut = iChannel0LeftIn; iChannel0RightOut = iChannel0RightIn; iChannel1LeftOut = iChannel1LeftIn; iChannel1RightOut = iChannel1RightIn; } TASK 1 – Download the Talkthrough program and check that it works Voice-activated radio-controlled car works by modifying the ProcessData( ) subroutine

9 /25 Building a voice activated radio controlled car -- 4 Threads at least SWITCHES ON FRONT PANEL “INPUT COMMANDS: PROGRAMMABLE FLAGS FIO_FLAG_D Register YOUR PROGRAM RUNNING ON THE BLACKFIN LED LIGHTS ON FRONT PANEL “CONTROLSIGNALS TO RF TRANS: LED-CONTROLREGISTER EBIU INTERFACE ProcessDataASM( ) subroutine A/D D/A Interrupt routine D/A EAR PHONES A/DVOICE int ReadSwitches( )void WriteLED(int )

10 /25 Set-up for “Laboratory 1” interfacing. “Make the switches work” 1.De-activate Visual DSP 2.Power down Blackfin 3.Connect power to “special Blackfin interface” connector 4.Connect 50-pin cable to logic-lab 5.Connect 50-pin cable to Blackfin 6.Power up logic lab. station 7.Power up Blackfin 8.Reactivate Visual DSP 9.Check that station works using “Lab. 1 test-executable”

11 /25 Special “power-connector” for Blackfin interface on logic lab. station

12 /25 Special “power-connector” for Blackfin interface on logic lab. station Picture of the “power connector” taken with a camera with a finger-print on the lens. Check that has not been stolen. Extras in your lab. kit is needed (perhaps)

13 /25 Connect 50-pin cable to Blackfin

14 /25 Connect 50-pin cable to logic lab Make sure that all 50- pin connections are secure and proper. Power up the logic lab. station and check that is working – toggle switches and LEDs CHEK each lab. As fuses can just wear out

15 /25 Task – Initialize the Programmable flag interface – 16 I/O lines on the Blackfin Warning – could burn out the Blackfin processor if done incorrectly You need to set (store a known value to) a number of Blackfin internal registers Most important ones FIO_DIR – Data DIRection – 0 for input **** FIO_INEN – INterface ENable – 1 for enabled FIO_FLAG_D – Programmable FLAG Data register

16 /25 Why do you need to know how to do read (load) and write (store) on internal registers? Flag Direction register (FIO_DIR)  Used to determine if the PF bit is to be used for input or output -- WARNING SMOKE POSSIBLE ISSUE  Need to set pins PF11 to PF8 for input, leave all other pins unchanged

17 /25 Write the Blackfin assembly language instruction(s) to load the address of the internal programmable flag FIO_DIR register into pointer register P1 – then SET the Blackfin PF lines to act as inputs #include P1.L = lo (FIO_DIR); P1.H = hi (FIO_DIR); // Check the requirements – need to have all input // Manual says “setting a line for input means setting FIO_DIR bit values to 0” R0 = 0; W[P1] = R0; // This changes “All pins” ssync; // Force Blackfin to do the write (store) operation NOW not later Making sure that the FIO_DIR is correct for LAB. 1 – NOTE may need to change for later labaoratories Design Error “Changes all pins

18 /25 P1.L = lo (FIO_DIR); // #include “knows” FIO_DIR value P1.H = hi (FIO_DIR); // R0 = 0; // DESIGN ERROR – changes all pins to 0 // W[P1] = R0; // This changes “All pins” // Correct approach – use an AND mask operation // Read the current value // Prepare the 32-bit mask with bits // 8 to 11 set to 1, other bits 0 // Complement operation // bits 8 to 11 are 0, other bits 1 // R3 bits = 0 for bits 8 to 11; // R3 bits = FIO_DIR bits otherwise // Restore FIO DIR with bits 8 to 11 set to 0, ssync; // Force Blackfin to do the write (store) NOW not later Setting FIO_DIR to zero for “ONLY” pins 8, 9, 10 and 11. Other pins unchanged

19 /25 Registers used to control PF pins Flag Input Enable Register  Only activate the pins you want to use (saves power in telecommunications situation)  Need to activate pins PF11 to PF8 for input, leave all other pins unchanged

20 /25 Write the Blackfin assembly language instruction(s) to load the address of the internal programmable flag FIO_INEN register into pointer register P1 – then ENABLE the Blackfin PF lines as inputs #include P1.L = lo (FIO_?????); P1.H = hi (FIO_?????); // Check the requirements – need to have all input // Manual says “setting a line for input means setting bit values to 0” R0 = 0x0F00; W[P1] = R0; // This changes “All pins” 8 to 11 ON (enable), others OFF ssync; // Force Blackfin to do the write (store) NOW not later Making sure that the FIO_INEN is correct for enable of pins 8 to 11 Design Error “Changes all pins

21 /25 P1.L = lo (FIO_???); // #include “knows” FIO_INEN value P1.H = hi (FIO_???); // R0 = 0x0F00; // DESIGN ERROR – changes all pins // W[P1] = R0; // This changes “All pins” // Correct approach – use an AND mask operation // Read the current value // Prepare the 32-bit mask with bits // 8 to 11 set to 1, other bits 0 // R3 bits = 1 for bits 8 to 11; // R3 bits = FIO_DIR bits otherwise // Restore FIO INEN with bits 8 to 11 set to 1, ssync; // Force Blackfin to do the write (store) NOW not later Setting FIO_INEN to one for “ONLY” pins 8, 9, 10 and 11. Other pins unchanged

22 /25 Registers used to control PF pins Flag Data register (FIO_FLAG_D)  Used to read the PF bits as an input -- (1 or 0)  Need to read pins PF11 to PF8, ignore all other pins values

23 /25 Task – Setting up the programmable flag interface Follow the instructions carefully FIO_DIR – direction register – write 0’s to bits 8 to 11 FIO_INEN – input enable register – write 1’s to bits 8, 9, 10, 11 Other registers “bits” leave “unchanged: There are 6 registers in total To provide a screen dump of the test result to show your code works  Use PRT-SCR button and then paste in.doc file.

24 /25 #include.global _ReadBlackfinGPIOFlags__Fv; _ReadBlackfinGPIOFlags__Fv LINK 16; P1.L = lo (FIO_FLAG_D); // could be P0 P1.H = hi (FIO_FLAG_D); R0 = W[P1] (Z); P0 = [FP + 4]; UNLINK; _ReadPBlackfinGPIOFlags__Fv; JUMP (P0); Must use W [ ] since the manual shows that FIO_FLAG_D register is 16-bits Must use W[P1] (Z) zero-extend as this adds 16 zeros to the 16 bits from FIO_FLAG_D register to make 32-bits to place into R0 int ReadBlackfinGPIOFlagsASM( )

25 /25 How to use int ReadBlackFinGPIOFlagsASM( ) int GPIO_setting = ReadBlackfinGPIOFlagsASM( ) ; SWITCHES ON FRONT PANEL PROGRAMMABLE FLAGS FIO_FLAG_D Register int ReadSwitches( ) (FIO_POLAR register = 0) All switches unpressed Binary Pattern in FIO_FLAG_D register B ????0000???????? All switches pressed Binary Pattern in FIO_FLAG_D register B ????1111???????? Binary ? Means – we don’t know what the answer is

26 /25 How to use int Read BlackfinGPIO FlagsASM( ) int GPIO_setting = ReadBlackfinGPIOFlagsASM( ) ; SWITCHES ON FRONT PANEL PROGRAMMABLE FLAGS FIO_FLAG_D Register int ReadSwitches( ) (FIO_POLAR register = 0) All switches unpressed Binary Pattern in FIO_FLAG_D register B XXXX0000XXXXXXXX All switches pressed Binary Pattern in FIO_FLAG_D register B XXXX1111XXXXXXXX Binary X Means – we don’t know what the answer is – and don’t care

27 /25 Echoing the switches to the LED Code in main( ) – written in C++ int main( ) { InitializeGPIOInterface( ); // Check Lab. 1 for “exact name needed” InitializeFlashLEDInterface( ); // Check Lab. 1 for “exact name needed” #define SWITCHBITS 0x0F00 // Look in MIPs notes about // using a mask and the // AND bit-wise operation // to select “desired bits” while (1) { // Forever loop int GPIO_value = ReadBlackfinGPIOFlagsASM ( ); int desired_bits = GPIO_value & SWITCHBITS; int LED_light_values = desired_bits >> 8; // Bits in wrong position WriteFlashLEDLights(LED_light_values); // to display on LEDS }

Avoid this common mistake Many seem to think that the switch routine returns 1 is SW1 is pressed, 2 if SW2 is pressed, 3 if SW3 is pressed. This is NOT correct as the switch routine has to be able to return 16 different values Value meaning SW1 pressed, SW2, SW3, SW4 not pressed (0x0100) Value meaning SW1 and SW4 pressed with SW2 and SW3 not pressed (0x0900) 28 /25

29 /25 Practice example -- Rewrite the code so that loop stops if all the switches are pressed at the same time int main( ) { InitializeSwitchInterface( ); // Check Lab. 1 for “exact name needed” InitializeLEDInterface( ); ???? #define SWITCHBITS 0x0F00 // Looking in MIPs notes about MASKS while (???? ) { // conditional loop int GPIO_value = Read ReadBlackfinGPIOFlagsASM ( ); int desired_bits = GPIO_value & SWITCHBITS; int LED_light_values = desired_bits >> 8; // Bits in wrong position WriteFlashLEDLightsASM(LED_light_values); ???? }

30 /25 Laboratory 1 – Tasks 1.Download the C++ Talk-through program. Board check -- Check that you can hear the audio output 2.Develop and test the code for initializing the Flash Memory and writing to the LED’s Use the provided tests to check your code 3.Routine for initializing the PF GPIO lines (programmable flags) Use the provided tests to check your code 4.Develop the ReadProgrammableFlagsASM( ) to read the switches Use the provided tests to check your code 5.Develop the Morse code program in C++ and ASM