Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Scroll Title
titleReference firmware (Trenz Electronic v3.02 description): pseudocode
steppseudocode functiondescription
1interrupt_disable(); //EA=0Disable interrupts
2

setup_autovectors ();

Setup interrupt table

3

usb_install_handlers ();

Setup/install handlers (aka functions) called to manage the interrupt set in interrupt table
4interrupt_enable(); //EA=1Enable interrupts
5

fx2_renumerate();

Simulates disconnection and then reconnection of TE USB FX2 module USB cable with host computer

6

task0(); //system_init();

Initialization phase.

The reference firmware is used to:

  • initialize VID and PID with the Productor (Trenz Electronic) Values;
  • initialize the USB FX2 microcontroller register, memory, etc..
    to (possibly) establish a conection of the TE USB FX2 module
    (FX2 microcontroller) with host computer's though USB.

Step 1,2,3,4,5 can be called pre_task0() or pre_system_init().

7while(1) {Enter the superloop
8task1();

Manage incoming USB setup data packet. See here.

It is used in connection and disconnection (of TE USB FX2 module) phases from
USB host computer: it is used to establish/remove a conection of the
TE USB FX2 module (FX2 microcontroller) with host computer's though USB

.

9task2(); 

Manage incoming USB data packet conforming to TE (FW) API
aka USB "command/reply" packet.

It is used:

  • to control the FPGA status (power on/off, etc)
  • to read/write the EEPROM (change of FX2 microcontroller's firmware
    aka Firmware Layer)
  • to read/write the SPI Flash (change of FPGA image
    aka Logic Architecture Layer)
  • to send SPI Flash commands to SPI Flash
  • to read/write the device connected to I2C bus
  • to read/write the TE USB FX2 module's DRAM

from host computer's software though USB.

The previous activities are realized by TE API Commands (FW APIs)
and can be controlled by SW API Layer's functions.


 

10task3();Manage interruption interrupt request (INT0 pin) incoming from FPGA chip
(normally, FPGA's MicroBlaze soft-processor): used with
(some) MB Command
11}While running the FX2 microcontroller should never exit fromthe from the superloop
and repeat (until a reset) step 8,9 and 10

...

Handles the setup package and the basic device requests like reading descriptors, get/set confifuration etc. It is used in phase of connection/disconnection of the TE USB FX2 module from host computer's USB port. It is also used by CyControl, CyConsole (and other similar programs) to retrieve information about the cofiguration of the USB device (TE USB FX2 module view as USB device).

See this link for further forfurther explanation.

Note

At this moment (Trenz Electronic v3.02), this part of code does not calls the app_class_cmd or app_vendor_cmd functions when needed, because CLASS command and VENDOR commands are not supported.

...