5 Replies Latest reply on Mar 31, 2017 4:04 PM by pratapnaidu_2343656

    Firmware to read/write SDHC SD cards using FX3S

    vincentth2_1818301

      We have a board where the Cypress FX3S drives 2x SDHC SD Cards,  We are currently using FX3SMassStorage.img as the firmware, but it appears that it only access 1/2 the storage capacity (fdisk lists the capacity of a 2GB SDHC card as 2Mx512byte disk.

         

      I know that the Pactron Dev Kit can read SDCard successfully.  Can I have a pointer as to what firmware is loaded into the FX3S on the dev board?

         

       

         

      Thanks In Advance

         

      Kernel: 3.14.5

         

      fdisk -l output:

         

      Disk /dev/sde: 1001 MB, 1001357312 bytes
      31 heads, 62 sectors/track, 1017 cylinders, total 1955776 sectors
      Units = sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disk identifier: 0x45b26c0c

         


      Disk /dev/sdd: 1001 MB, 1001390080 bytes
      31 heads, 62 sectors/track, 1017 cylinders, total 1955840 sectors
      Units = sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disk identifier: 0x20202020

        • 1. Re: Firmware to read/write SDHC SD cards using FX3S
          Madhu Lakshmipathy

          The firmware loaded on Pactron Board is avaiable in FX3 SDK: "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\msc_examples\cyfx3s_msc"

             

          Regards,

             

          - Madhu Sudhan

          • 2. Re: Firmware to read/write SDHC SD cards using FX3S
            vincentth2_1818301

            Thanks,

               

            I recompiled cyfx3s_msc and removed the codes that define 2 LUNs for each port (My guess is that codes cause the halving of the CD Card capacity), recompiled the firmware.

               

             

               

            Now, I can't download the new firmware to the Dev board.  Ubuntu 14.04 identify the device as 04b4, idProduct=4721, which is not what the Bootloader should be identified (VID=04b4, PID=00F3).

               

             

               

            How do I set the jumper on the dev board in order to flash the new firmware to SPI?

               

             

               

            303.963415] usb 2-3: new SuperSpeed USB device number 2 using xhci_hcd
            [  303.980922] usb 2-3: LPM exit latency is zeroed, disabling LPM.
            [  303.982828] usb 2-3: New USB device found, idVendor=04b4, idProduct=4721
            [  303.982831] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
            [  303.982833] usb 2-3: Product: SD3 
            [  303.982834] usb 2-3: Manufacturer: Cypress
            [  303.982836] usb 2-3: SerialNumber: 012345678901
            [  304.001179] usb-storage 2-3:1.0: USB Mass Storage device detected
            [  304.001237] scsi host4: usb-storage 2-3:1.0
            [  304.001307] usbcore: registered new interface driver usb-storage
            [  304.004546] usbcore: registered new interface driver uas
            [  305.002051] scsi 4:0:0:0: Direct-Access     Cypress  SD3 MSC DEMO     0001 PQ: 0 ANSI: 0
            [  305.002452] scsi 4:0:0:1: Direct-Access     Cypress  SD3 MSC DEMO     0001 PQ: 0 ANSI: 0
            [  305.003021] sd 4:0:0:0: Attached scsi generic sg1 type 0
            [  305.003240] sd 4:0:0:0: [sdb] 1920000 512-byte logical blocks: (983 MB/937 MiB)
            [  305.003253] sd 4:0:0:1: Attached scsi generic sg2 type 0
            [  305.004611] sd 4:0:0:0: [sdb] Write Protect is off
            [  305.004615] sd 4:0:0:0: [sdb] Mode Sense: 03 00 00 00
            [  305.006068] sd 4:0:0:0: [sdb] No Caching mode page found

               

             

               

            Thanks for the help.

            • 3. Re: Firmware to read/write SDHC SD cards using FX3S
              vincentth2_1818301

              OK, I found the answer to my own question: PMOD set to Z11 to boot to RAM (USB), but the download to SPI failed with error message :

                 

              sudo !!
              sudo ./cyusb_linux &
              [2] 4175
              [1]   Done                    ./cyusb_linux
              zii@zii-Latitude-E5570:~/Cypress/cyusb_linux_1.0.4/bin$ Signal 10 (=SIGUSR1) received !
              No device of interest found
              Signal 10 (=SIGUSR1) received !
              No of devices of interest found = 1
              Current device is not the FX3 flash programmer
              Failed to find FX3 flash programmer
              Trying to download flash programmer to RAM
              Failed to find cyfxflashprog.img file
              FX3 flash programmer not found
              Signal 10 (=SIGUSR1) received !
              No device of interest found
              Signal 10 (=SIGUSR1) received !
              No of devices of interest found = 1
              Found FX3 flash programmer
              Erased sector 0 of SPI flash
              Erased sector 1 of SPI flash
              Erased sector 2 of SPI flash
              Write to SPI flash failed

                 

               

                 

               

                 

              Is there any document to download the firmware, specifically written for Linux and the Pactron FX3S FPGA Dev Board Rev C?  (I read the Windows version for FX3 board but I could not find 1/2 of the switches that the Windows document mentions.

              • 4. Re: Firmware to read/write SDHC SD cards using FX3S
                aditha_1975281

                set CYUSB_ROOT environment variable to your cyusb_linux tool installation path.

                   

                export CYUSB_ROOT=~/Cypress/cyusb_linux_1.0.4/

                • 5. Re: Firmware to read/write SDHC SD cards using FX3S
                  pratapnaidu_2343656

                  Apologies to hijack this thread, this query seems to be the closest to my situation, we are using CyUSB302x as the SD Card Controller, on a daughter board, connected to the root complext main board (x86) via  PCIe. Following is the collective configuration information of the device. Including the root port and the EP devices. The Linux operation system detected the Cypress as scsi device and can able to read and write to the device.

                     

                  I would like to access the  NOR flash attached to the SPI of the Cypress SD controller, the image that was burnt is FX3S MSC Demo:

                     

                  root ~# cat /sys/devices/pci0000\:00/0000\:00\:1c.0/0000\:02\:00.0/usb4/4-1/4-1\:1.0/host2/target2\:0\:0/2\:0\:0\:1/model
                  FX3S MSC DEMO

                     

                  Can someone help me how can my host (Embedded system running x86 with 3.14 Kernel) access the SPI flash attached to the Controller?? when i was exploring the code, stumbled upon the following the example code ( cyfx3s_msc.c) with the below statement:

                     

                   io_cfg.useI2C           = CyFalse;
                      io_cfg.useI2S           = CyFalse;
                      io_cfg.useSpi           = CyFalse;

                     

                  Do it mean that, the firmware running over the chip does not support SPI muxing? If yes..!!! were can i get a copy of firmware to make the SPI work and would appreciate if someone provide me a way to use the linux scsi / custom driver to extract the SPI information.

                     

                   

                     

                   

                     


                  _____________________________________________________________________________________________________________________________________
                  |
                  |---------------------------------------------Root Port Information---------------------------------------------------
                  ______________________________________________________________________________________________________________________________
                  00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4) (prog-if 00 [Normal decode])
                          Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
                          Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
                          Latency: 0, Cache Line Size: 64 bytes
                          Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
                          I/O behind bridge: 00002000-00002fff
                          Memory behind bridge: f7c00000-f7cfffff
                          Prefetchable memory behind bridge: 00000000dfa00000-00000000dfbfffff
                          Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
                          BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B-
                                  PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
                          Capabilities: [40] Express (v2) Root Port (Slot+), MSI 00
                                  DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
                                          ExtTag- RBE+ FLReset-
                                  DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                                          RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
                                          MaxPayload 128 bytes, MaxReadReq 128 bytes
                                  DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
                                  LnkCap: Port #1, Speed 5GT/s, Width x1, ASPM L0s L1, Latency L0 <512ns, L1 <16us
                                          ClockPM- Surprise- LLActRep+ BwNot-
                                  LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
                                          ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                                  LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive+ BWMgmt+ ABWMgmt-
                                  SltCap: AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug+ Surprise+
                                          Slot #0, PowerLimit 10.000W; Interlock- NoCompl+
                                  SltCtl: Enable: AttnBtn- PwrFlt- MRL- PresDet+ CmdCplt- HPIrq- LinkChg-
                                          Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
                                  SltSta: Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
                                          Changed: MRL- PresDet- LinkState-
                                  RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna- CRSVisible-
                                  RootCap: CRSVisible-
                                  RootSta: PME ReqID 0000, PMEStatus- PMEPending-
                                  DevCap2: Completion Timeout: Range BC, TimeoutDis+, LTR-, OBFF Not Supported ARIFwd-
                                  DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled ARIFwd-
                                  LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
                                           Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                                           Compliance De-emphasis: -6dB
                                  LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
                                           EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
                          Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
                                  Address: 00000000  Data: 0000
                          Capabilities: [90] Subsystem: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1
                          Capabilities: [a0] Power Management version 2
                                  Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
                                  Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
                          Kernel driver in use: pcieport
                  --------------------------------------------------------------------------------------------------------------------------------------
                                                                               USB Control Devices
                  --------------------------------------------------------------------------------------------------------------------------------------
                  T:  Bus=06 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
                  D:  Ver= 3.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
                  P:  Vendor=04b4 ProdID=4721 Rev= 0.00
                  S:  Manufacturer=Cypress
                  S:  Product=FX3S
                  S:  SerialNumber=012345678901
                  C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 96mA
                  I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
                  E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
                  E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
                  T:  Bus=06 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  3 Spd=5000 MxCh= 0
                  D:  Ver= 3.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
                  P:  Vendor=04b4 ProdID=4721 Rev= 0.00
                  S:  Manufacturer=Cypress
                  S:  Product=FX3S
                  S:  SerialNumber=012345678901
                  C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 96mA
                  I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
                  E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
                  E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms