Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
This is just an example firmware to demonstrate the Auto channel where SPI is the producer. This has to be modified according to the actual use cases.
This example communicates with SPI Flash like FX3 SDK example.
Only the channel where SPI is the producer is made Auto in the attached firmware. The channel which has SPI as the consumer remains Manual out.
Testing procedure is as follows:
Program the attached firmware into RAM.
Issue 0xC3 vendor command with wLength = 0x200, wIndex = 0x0000, wValue = 0x0000. Zero Length Packet is returned in the data phase of the control transfer as the actual read out data from SPI is sent to the Bulk IN endpoint.
Perform IN transfer on Bulk IN endpoint, where the Flash data can be obtained.
With the attached firmware, reading data length(wLength) > 0x200 is not supported as the Auto channel has only one buffer of size 0x200. The functionality when there are multiple buffers in the Auto channel with SPI as the producer is not in the scope of present discussion.
Referto the attached firmware, only when the 0x200 bytes are read out of the Bulk IN endpoint by the USB Host. This event CY_U3P_DMA_CB_XFER_CPLT is received in the DMA callback.
The CyU3PDebugPrint API can be used to send debug messages to the host over the USB-CDC interface instead of using a dedicated onboard UART-USB bridge device. To do this, the following changes are made to the AN75779 firmware.
Added a CDC interface to Hi-Speed and SuperSpeed configuration descriptors in cyfxuvcdscr.c.
Created an RTOS thread (cdcThread).
Added CDC class request handling to CyFxUVCApplnUSBSetupCB().
Defined the DebugInit() function, which does the following:
a. Configure the endpoints required for the CDC interface.
b. Call CyU3PDebugInit() by passing the USB consumer socket as argument. Doing this allows the use of the CyU3PDebugPrint API function for sending debug messages over the CDC interface.
This function is called when the SET_CONFIGURATION event occurs in CyFxUVCApplnUSBEventCB().
When the firmware with these changes is programmed to the FX3 device, the following devices get enumerated in the host which can be seen in Device Manager as follows:
The following debug messages appear in the terminal:
The message “cdc-debug-enabled” appears because of the following code in the firmware. You can change this according to your application.
The UART block is initialized in this project, but not used.
If data from the USB Bulk-IN end point of the CDC interface (EP5 in this project) must be sent to the UART block of FX3, enable the ENABLE_CDC_USB_TO_UART_CHANNEL macro in uvc.h. Doing so will configure the USB-to-UART Auto DMA channel.
Version: **By default, the S25FS128S flash device comes with hybrid sectors (the first sector of 64KB divided into 9 sectors (8 sectors of 4KB and one...
By default, the S25FS128S flash device comes with hybrid sectors (the first sector of 64KB divided into 9 sectors (8 sectors of 4KB and one 32KB sector). All remaining sectors are uniform (64KB each).
When you use the Control Center application from the FX3 SDK, the internal programming utility (CyBootProgrammer.img) assumes uniform sector size for the flash device; this leads to corrupted data in the first sector, which is a hybrid sector.
To prevent this, configure the flash device to use uniform sectors of 64KB each by modifying the Configuration Register 3 (CR3NV) – see Figure 1.
To configure the flash with uniform 64KB sectors, write ‘1’ to CR3NV and ‘0’ to CR3NV using the WRAR 71h command (write 0x08 into the CR3NV register). After updating this register, use the default Control Center application to load the firmware image to the flash.
An alternative approach is to modify the default programmer tool in the Control Center utility (CyBootProgrammer.img). However, note that this may cause errors if other types of flash are used. Therefore, create a backup of CyBootProgrammer.img for use with other flash devices.
Do the following to modify CyBootProgrammer.img:
1. Import the SDK example project cyfxflashprog from the following location into EZ-USB Suite:
Question: How can I check if the flash content is correct?
Answer: In the FX3/CX3 design, SPI Flash is frequently used to store firmware. One of the problems customers often face is that of FX3/CX3 not booting from flash. To check if the firmware stored in flash is valid, the flash read/write firmware can be used for troubleshooting.
The example project is located at C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxusbspidmamode. Build and download the Img file into FX3 RAM. FX3 will enumerate as the bulkloop device, as shown in the following screenshots
Figure1. Download Firmware into RAM
Figure 2. FX3 Enumerates as Bulk Loop Device
Expand configuration 1, choose control endpoint, and fill the blanks on the right side of the panel. After that, click Transfer Data. This will issue the vendor command, which reads 1024 bytes from byte address 0.
Figure 3. Read 1024 Bytes from Flash
The length of the read data and the start address can be changed as required. For more information about this command, check the readme.txt in this project.
The data read back can be stored in a hex file. After checking the content of entire flash, the data in flash can be compared with the Hex editor to check if it is valid.