...
Note |
---|
USB FX2 microcontroller reference firmware does NOT support Slave Parallel (SelectMAP) Mode and/or Slave Serial Mode; if the user needs to use these configuration modes, he/she should write a custom firmware that load the configuration data from a source (SPI Flash, USB connection or B2B connection) and write the retrieved configuration data in the FPGA. |
In the following table is described the tasks executed by the reference firmware (Trenz Electronic v3.02).
Scroll Title | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||
|
In this super loop ("while(1)") reference firmware is used to:
...
Code Block | ||||
---|---|---|---|---|
| ||||
void activity(void){ ep1_pool(); int_pin_pool(); } |
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).
...
Info |
---|
Even if user/devloper's firmware sets RENUM bit to 1, meaning that it wants to handle vendor commands by itself, the user/developer can still replace the current running firmware with another one. |
This process is realized by function ep1_pool().
...
Code Block | ||
---|---|---|
| ||
Test data for internal test; if (in the EP1 OUT FIFO exist at least one USB command packet not yet readed) { Increment command count; Fill output buffer EP1INBUF with 0xFF value; switch(EPOUTBUF[0]) //Decode USB FX2 API Command correponding to received EPOUTBUF[0] default: // EPOUTBUF[0] different from any USB FX2 API encoded value Code to execute if EPOUTBUF[0] does not equal the value of any of the cases break; Â ... case USB_FX2_API_0xYZ: // EPOUTBUF[0] = USB_FX2_API_0xYZ , USB_FX2_API encoded value hexadecimal YZ Run the correspoding code snippet/function with auxiliary functions (if any) Write the reply (if any) in EP1INBUF Set a flag_new_data to indicate that a USB reply packet could be delivered to host computer's USB break; ... Free input buffer; if (flag_new_data = 1) //Check the flag to know if a USB reply packet should be delivered to host computer's USB { if(it is possible to send the USB reply packet using EP1) { Send the USB reply packet using EP1 Reset the flag flag_new_data to indicate that a USB reply packet has been delivered to host computer's USB //the buffer is free for use } } } |
If
...
The host computer's SW should use a polling procedure to retrieve the I2C bytes read (and stored) by FX2 microcontroller (the pull response to host computer's pull is realized by task2: ep1_pool())
If
...
This byte array coul be pulled out by host computer'SW using SET_INTERRUPT ( => CMD_GET_AUTORESPONSE => for(i = 0; i < 32; i++) EP1INBUF[i+1] = auto_response_data[i];).
It is usually used with XPS_I2C_SLAVE custom IP block (LINK) for command, settings and status communication. When MicroBlaze write data to MB2FX2_REG0, the interrupt pin INT0 (aka FPGA_INT0 in firmware files) is rised. This pin is connected to PA0/INT0 pin of FX2 microcontroller. When the FX2 microcontroller's firmware read the rise of pin INT0 (=1 because MicroBlaze writes data to MB2FX2_REG0) it set the firmware variable FPGA_INT0 to 1.
...