Download Latest Version Arcade-_NB_WIP_01.zip (20.9 kB)
Email in envelope

Get an email when there's a new version of DarFPGA

Home / Software VHDL / usb_host
Name Modified Size InfoDownloads / Week
Parent folder
DE10_usb_host_max3421e_Nios_2017_04_13.zip 2017-04-13 25.7 kB
README.txt 2017-04-13 5.4 kB
Totals: 2 Items   31.1 kB 0
--------------------------------------------------------------------
-- DE10 Lite - USB host demo by Dar (darfpga@aol.fr) 13/04/2017
-- http://darfpga.blogspot.fr
--
-- Board 
--   Terasic DE10 Lite (MAX 10M50)
--
--   MODIFIED Arduino shield usb host shield max3421e
--   from sparkfun.com
--
-- Nios II processor
--
--------------------------------------------------------------------
-- VERY IMPORTANT
--
-- Arduino usb host max3421e shield modification --
--
--  Shield has to be modified to supply 5V directly at input of 3.3V
--  regulator. Arduino board provides 9-12V on Vin shield. DE10 
--  board provide only 5V on Vin. So 5V regulator has to be bypassed.
--
--  Modification is only 1 wire from middle pin of ON/OFF switch (Vin)
--  to middle pin (output) of 5V regulator (LD1117).
--
--  Look at this modification pictures on my web site. 
--
--  Always make sure to keep ON/OFF switch in OFF position.
--
--  Use at your own risk  
--------------------------------------------------------------------
-- What does it do ?
--
--  Send max3421e commands to init USB bus, enumerate single periph.
--  Request device descriptor, request config descriptor, set config
--  set protocol, request report.
--
--  Every major command/reply are displayed in Nios II console. 
--  (waiting loop command are not display, source may easily be 
--  modified to display each single command)   
--
--------------------------------------------------------------------
-- Requirements :
--
--  Quartus Prime and Nios II Software Build Tools for Eclipse
--  Tested with 16.1 release.
--
--  Work with USB LS/FS (low/full speed) keyboard, mouse, joystick,
--  wireless joystick
--
--------------------------------------------------------------------
-- Follow below procedure to build everythings
--------------------------------------------------------------------
--------------------------------------------------------------------
-- Delivered files :

--  uproc_base.qsys    : QSYS Nios II/32Ko FPGA memory/SPI IF
--  uproc_base.qpf     : quartus project
--  uproc_base.qsf     : quartus project
--  uproc_base_top.vhd : top file wiring QSYS system to DE10 pinout 

--  usb_host_main.c : small C simple demo straight forward 
--                    max3421e USB host programmed from Nios II proc 
--
--------------------------------------------------------------------

Quartus Prime
  Menu File Open project -> select ...\de10\uproc_base.qpf
  Project Navigator : Files
  Dbl click on uproc_base.qsys
	
  Qsys 
    Status bar : Generate HDL
	Generation Synthesis -> select VHDL
        Generation -> Generate
        Generation complete -> Close

    Status bar -> Finish

Back to Quartus Prime
  Menu bar : start compilation
  (Wait full compilation was succesful)
  Menu File Exit

(Files created by Quartus Prime: 
  ...\de10\uproc_base.sopcinfo
  ...\de10\output_files\uproc_base.sof
)

Nios II Software Build Tools for eclipse
  Workspace : browse ...\de10
              create new directory 'software'
              select directory 'software'
  File New Nios II Application and BSP from Template	
    SOPC Information File name -> select ...\de10\uproc_base.sopcinfo
    (wait... : CPU name : nios2_gen2_0)
    Project name -> usb_host
    Template -> Blank Project
    Finish
  (Project Explorer : usb_host and usb_host_bsp created)


  Project Explorer right click on usb_host_bsp, Nios II -> BSP editor
    BSP Editor,Main Tab, Settings, Common -> tick 'enable_small_c_library'
    BSP Editor, Status bar -> Generate
    BSP Editor, Status bar -> Exit
 
  (Project Explorer right click on usb_host_bsp, Nios II -> Generate BSP)

->Copy (or move) file usb_host_main.c from ...\de10 to ..\de10\software\usb_host

  Project Explorer right click on usb_host -> Refresh

  Menu bar, Project -> Build all 

  Menu bar, Nios II, Quartus Prime Programmer
  (->Connect USB cable from PC to DE10 board [not to usb host shield])

    Quartus Prime Programmer
       Click Auto Detect
         Select 10M50DA and OK
       Click on 10M50DA picture in the lower frame and Change File
         Select ...\de10\output_files\uproc_base.sof and Open
       Tick Program/Configure in the upper frame
       Click Start
       ( Wait progress : 100%)
       File, Exit (save or not dont care)

Back to Nios II Software Build Tools for eclipse

  Menu bar, Run, Run Configurations
     Dbl click Nios II Hardware (create New_configuration)
        Project Tab, Project Name -> Select usb_host
        (Should select Project ELF file name : ...... usb_host\usb_host.elf)
        Target Connection Tab, (extend windows) click on Refresh Connections
        (Should find cable and device on USB-Blaster ....)
        Close Run Configuration (and save)

->Connect a keyboard or a joystick or a mouse on usb host shield
(be careful, keep USB plug away from any metalic part or wire on DE10 board or shield)

  Project Explorer, select usb_host
  Menu bar, Run, Run As -> Nios II Hardware

  Output are displayed on Nios II Console.
  Click Red square in the top bar of the lower frame to stop program.
  (Dont't forget to stop program before doing something else, otherwise Eclipse
  would stuck ; no response)

  After modifing C code just do : Menu, Run, Run As -> Nois II Hardware

EndOfFile
Source: README.txt, updated 2017-04-13