Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

No FX2 vend_ax example tutorial

No FX2 vend_ax example tutorial

Anonymous
Not applicable
Question: Using the tutorial, the steps to follow for the vend_ax example states not to follow the steps listed with the FX2. It further states that a tutorial for the FX2 is included later in the tutorial. The steps to follow for using the vend_ax example with the FX2 is nowhere to be found in the tutorial.

 

Answer:

The following steps should be used to demonstrate the FX2 vend_ax example.

Trying out the Vendor Request Bar on the EZ-USB FX2 Development Kit (CY3681) board NOTE: The following tutorial is defined for the EZ-USB FX2 DevKit board. DO NOT run it on the EZ-USB FX (CY3671) DevKitbBoard or EZ-USB (Series AN2100) DevKit board. There is a tutorial included earlier for using the Vendor Request bar on the FX Dev Kit Board and EZ-USB (Series AN2100) DevKit board.

1. If you simply press the "Vend Req" button, the device will not respond. The default device does not have any "Vendor Specific Requests" defined, so sending one will just hang the driver. First you must download some 8051 code that defines and responds to "Vendor Specific Requests". The Vend_Ax example, located in Cypress\USB\Examples\FX2\vend_ax, program is a good example to try. It is called Vend_Ax, because it defines several commands including:
- 0xA2: EEPROM Read/Write
- 0XA3: External Ram Read/Write

2. Ensure the EZ-USB Control Panel indicates FX2 as the Target Device.

3. Download Vend_Ax.hex using the "Download..." button, ensure you are downloading from Cypress\USB\Examples\FX2\vend_ax

4. Press "Vend Req" with Req = 0xA2 (as set by default).

5. Note that you see 16 bytes of data returned from the EEPROM on the Development Board. Note: The first 8 bytes are the important ones: "C0 B4 04 81 00 01 00 08". "C0" means that a Vendor ID and Product ID follow.
- 0x04b4 is the Cypress Semiconductor unique USB Vendor ID.
- 0x0081 is the Product ID for the EzUsb FX2 Development Board.

6. You will notice that the 2 bytes in a word must be swapped to be interpreted correctly.

7. The default values shown in the dropdown list at the right end of the bar are for the EZ-USB (Series AN2100). These values must not be used for the EZ-USB FX2. Note: If you do not change these values and you select Dir = OUT and press "Vend Req", the EEPROM will be programmed as a EZ-USB (Series AN2100) development board by default.

8. Change the length to 8.

9. Press "Vend Req" again.

10. Note that you just get 8 bytes back this time.

11. Press the "Get Dev" button.

12. Note that the idVendor is 0x4b4, and the idProduct is 0x81.

13. Set the "Value" field to 0x0001 and press "Vend Req". This field is used as the address for the OxA2 Vendor Specific Request, but the actual use for these fields may, in general, be determined by the firmware programmer Note that the bytes returned now start at 0xB4 (it starts reading from address 1).

14. Set the "Value" field back to 0x0000. Note: The "Index" field is not used by any of the Vendor Specific Request commands defined by Vend_Ax, so you can set it to whatever you want, and it will not make a difference.

15. Select "0 OUT" in the "Dir" dropdown list.

16. You will now reprogram the EEPROM and change it back. Please use caution when reprogramming the EEPROM.

17. In the EZ-USB Control Panel, change the "Hex Bytes" field to read C0 47 05 02 10 01 00 08. This represents a "USB Sample device" as indicated in C:\Windows\System\ezusb.inf. It is the default ID given to new projects when you derive a new example from the "frameworks" example.
PLEASE NOTE: Do not select any of the predefined options in the dropdown list.
PLEASE NOTE: It is also important here that the "Value" (address) field is set back to "0x0000".

18. Press the "Vend Req" button to reprogram the EEPROM. Note that the new values are displayed in the text output window.

19. Select "1 IN" in the "Dir" dropdown list. You will read back the new values using the Vend_Ax command.

20. Press "Vend Req" to read back the new values. Notice that the values have been changed.

21. Press the "Get Dev" button on the Control Panel. Notice that the idProduct is still 0x81. This is because you have programmed the EEPROM, but you have not changed the product ID in 8051 memory! The 8051 pulls the product ID from ram memory when it gets a Device Descriptor request. It normally gets the product ID from the EEPROM at reset, so you will have to reset the Development Board before it will return the new product ID value you have just programmed. The Vend_Ax program, on the other hand, reads directly from the EEPROM itself.

22. Press the "Reset" button on the Development Board. Notice how the mouse pointer on the PC screen changes to the "hour glass" cursor momentarily. It does this when a USB device is enumerated. The operating system notices that there is a new USB device when the "Reset" button is pressed and must take a moment to get information about the new device and configure it into the system.

23. Notice that the green "Bkpt/Monitor" light has not come on again. This is because the Development Board has "changed its personality" to be a "USB Sample device" (which is any frameworks derived user example application).

24. Press the "Get Dev" button.

25. Notice that idProduct has now changed to 0x1002.

26. Change the "Hex Bytes" field to read "C0 B4 04 81 00 01 00 08".

27. You will now reprogram the EEPROM back to being an Cypress Semiconductor Ez-Usb FX2 Development board.

28. Select "0 OUT" in the "Dir" dropdown list.

29. Download Vend_Ax.hex using the "Download..." button. NOTE: You must reload Vend_Ax to reprogram the EEPROM. The Vend_Ax program is no longer in memory after a reset.

30. Press "Vend Req" to reprogram the EEPROM.

31. Press the "Reset" button on the Development Board. Notice that the green "Bkpt/Monitor" light will now come on again by default. This is because the Development Board is back to being idProduct = 0x81.



0 Likes
1592 Views
Contributors