USB communication using FLEX FULL Demo Board and the Scilab/Scicos code generator

From ErikaWiki

(Difference between revisions)
Jump to: navigation, search
Line 104: Line 104:
::::::: Figure 15 – Demo results
::::::: Figure 15 – Demo results
-
Tutorial pdf version: [[USB-UDP on FLEX109 tutorial.pdf]]
+
Tutorial pdf version: [[media:USB-UDP on FLEX109 tutorial.pdf]]

Revision as of 10:18, 11 January 2010

USB Application

DEMO BOARD: An example of USB-UDP communication with the FLEX Demo Daughter Board

Step 1:
  • Open Scilab 4.1.2, the Scicos-FLEX pack is recognized by Scilab (refer Fig. 1).
Change the working directory to “C:\Programmi\scilab-4.1.2\contrib\dspic”.
Type exec builder.sce to build any application of the pack.
Scilab.png
Figure 1 – Scilab
Step 2:
  • Open file “demoboard_example_flexside.cos” (refer Fig. 2) in Scicos.
The .cos file is shown in Fig. 3 and contains the schematic for the generation
(with SCICOS) of the FLEX FULL board program.
  • With this application the FLEX FULL board is able to:
    1. acquire data from the accelerometer and from the light sensor
    2. send the measures to a PC using the USB interface
    3. receive and display the USB data on the LCD screen
    4. perform elaborations for a pretty LEDs blinking
Flexside openfile.png
Figure 2 – Open the demo file
Flexside scheme.png
Figure 3 – Schematic
Step 3:
  • Click menu CodeGen and select FlexCodeGen (refer Fig. 3)
Click on the super-block, the Embedded Code Generator's block property settings
window will appear (refer Fig. 4)
Provide path name and then press OK for code generation (refer Fig. 5)
Generator folder.png
Figure 4 – Embedded Code Generator window
Generator result.png
Figure 5 – Code Generator results
Step 4:
  • Open MPLAB IDE and import “pic30.cof” file created by the code generator
(refer Fig. 6) in Step 3
Cof import.png
Figure 6 – MPLAB IDE: pic30.cof file importing
Step 5:
  • Connect the FLEX003 (FLEX Full Base Board) to ICD for programming the dsPic
(refer Fig. 7)
Click the release reset icon and execute the embedded program
(refer Fig. 8 and Fig. 9)
Cof program.png
Figure 7 - MPLAB IDE: target programming
Cof release.png
Figure 8 - MPLAB IDE: release from reset
Board run1.png
Figure 9 – Device released from reset
Step 6:
  • Open the PC-side file “demoboard_example_pcside.cos” in Scicos (refer Fig. 10)
The .cos file contains the schematic for the PC-side (refer Fig. 11).
The almost-real-time simulation runs in SCICOS environment. The application
shows the received USB data on the multiple scope and sends other data to the
FLEX FULL board.
Pcside open.png
Figure 10 – Open the PC-side demo file
Pc side scheme.png
Figure 11 – PC-side demo file
Step 7:
  • Check the USB device recognition in the peripherals window (refer Fig. 12) and
execute the program app_flex_scicos.exe (refer Fig. 13)
Note1: The program needs CygWin Win32 usb library and is compiled using make
command.
Note2: Download the FLEX USB drivers for Windows and the PIC18 firmware at:
http://www.evidence.eu.com/download/USB_DEMO_wiki.zip
Usb recognition.png
Figure 12 – Check the USB device recognition
App compilation.png
Figure 13 – Compilation and start of the program;
Step 8:
  • The simulation runs in almost-real-time, and the data received (acceleration on
X, acceleration on Y, acceleration on Y, modified light sensor output) can be
graphically seen in the Scicos Scope window (refer Fig. 14)
The demo results are shown in Fig. 15
Usb run.png
Figure 14 – Simulation in running mode
Board run2.png
Figure 15 – Demo results
Tutorial pdf version: media:USB-UDP on FLEX109 tutorial.pdf
Personal tools