Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Firmware] Every other FPGA load fails #195

Closed
jynik opened this issue Jan 5, 2014 · 2 comments
Closed

[Firmware] Every other FPGA load fails #195

jynik opened this issue Jan 5, 2014 · 2 comments
Labels

Comments

@jynik
Copy link
Contributor

@jynik jynik commented Jan 5, 2014

Per discussion with bpadalino, this may be due to a PIB bug encountered when switching from 16-bit to 32-bit configurations, which was worked around by resetting the GPIF in the RF stream code.

@jynik
Copy link
Contributor Author

@jynik jynik commented Jan 5, 2014

I verified that the PIB reset used in rf.c does work via a quick copy and paste of the PIB reset from rf.c:

diff --git a/fx3_firmware/fpga.c b/fx3_firmware/fpga.c
index e86092f..7e195e3 100644
--- a/fx3_firmware/fpga.c
+++ b/fx3_firmware/fpga.c
@@ -25,6 +25,7 @@
 #include "cyu3usb.h"
 #include "cyu3gpif.h"
 #include "cyu3spi.h"
+#include "cyu3pib.h"
 #include "cyfxgpif_C4loader.h"
 #include "spi_flash_lib.h"

@@ -118,6 +119,30 @@ static void NuandFpgaConfigStart(void)
     NuandGPIOReconfigure(CyFalse, !first_call);
     first_call = 0;

+    /* Restart the PIB block, due to a bug where 16-bit to 32-bit GPIF transitions
+       mess up the first DMA transaction.  Restarting the PIB wipes all of the GPIF
+       configurations */
+    CyU3PPibClock_t pibClock;
+
+    apiRetStatus = CyU3PPibDeInit();
+    if (apiRetStatus != CY_U3P_SUCCESS) {
+        CyU3PDebugPrint(4, "P-Port DeInitialization failed, Error Code = %d\n", apiRetStatus);
+        CyFxAppErrorHandler(apiRetStatus);
+    }
+
+    /* Initialize the P-Port here */
+    pibClock.clkDiv = 4;
+    pibClock.clkSrc = CY_U3P_SYS_CLK;
+    pibClock.isHalfDiv = CyFalse;
+
+    /* Enable DLL for async GPIF */
+    pibClock.isDllEnable = CyFalse;
+    apiRetStatus = CyU3PPibInit(CyTrue, &pibClock);
+    if (apiRetStatus != CY_U3P_SUCCESS) {
+        CyU3PDebugPrint(4, "P-Port Initialization failed, Error Code = %d\n", apiRetStatus);
+        CyFxAppErrorHandler(apiRetStatus);
+    }
+

     /* Load the GPIF configuration for loading the FPGA */
     apiRetStatus = CyU3PGpifLoad(&C4loader_CyFxGpifConfig);

However, rather than copying code all over the place, I think it best to take a few minutes (tomorrow or Monday?) to review the places where we're loading GPIF configurations and consolidate that a bit to a single gpif_load_configuration(GPIF_CONFIG_FPGA | GPIF_CONFIG_RFLINK) interface...

jynik added a commit that referenced this issue Jan 6, 2014
The GPIF reconfiguration (including the PIB reset workaround) have been
tucked away in gpif.c, which is now used by the FPGA loader and RF link configurations.

This fixes Issue #195, as the FPGA loader previously did not include the
PIB reset workaround.
jynik added a commit that referenced this issue Jan 10, 2014
The GPIF reconfiguration (including the PIB reset workaround) have been
tucked away in gpif.c, which is now used by the FPGA loader and RF link configurations.

This fixes Issue #195, as the FPGA loader previously did not include the
PIB reset workaround.
jynik added a commit that referenced this issue Jan 12, 2014
The GPIF reconfiguration (including the PIB reset workaround) have been
tucked away in gpif.c, which is now used by the FPGA loader and RF link configurations.

This fixes Issue #195, as the FPGA loader previously did not include the
PIB reset workaround.
jynik added a commit that referenced this issue Jan 14, 2014
The PIB and GPIF (re)configuration have been tucked away in gpif.c,
which is now used by the FPGA loader and RF link configurations.

Unnecessary PIB and IOMatrix configurations have been removed.

This fixes Issue #195, as the FPGA loader previously did not include a
PIB reset, which has been found to be required when changing from a
16-bit to 32-bit GPIF configuration.
jynik added a commit that referenced this issue Jan 14, 2014
The PIB and GPIF (re)configuration have been tucked away in gpif.c,
which is now used by the FPGA loader and RF link configurations.

Unnecessary PIB and IOMatrix configurations have been removed.

This fixes Issue #195, as the FPGA loader previously did not include a
PIB reset, which has been found to be required when changing from a
16-bit to 32-bit GPIF configuration.
jynik added a commit that referenced this issue Jan 14, 2014
The PIB and GPIF (re)configuration have been tucked away in gpif.c,
which is now used by the FPGA loader and RF link configurations.

Unnecessary PIB and IOMatrix configurations have been removed.

This fixes Issue #195, as the FPGA loader previously did not include a
PIB reset, which has been found to be required when changing from a
16-bit to 32-bit GPIF configuration.
jynik added a commit that referenced this issue Jan 14, 2014
The PIB and GPIF (re)configuration have been tucked away in gpif.c,
which is now used by the FPGA loader and RF link configurations.

Unnecessary PIB and IOMatrix configurations have been removed.

This fixes Issue #195, as the FPGA loader previously did not include a
PIB reset, which has been found to be required when changing from a
16-bit to 32-bit GPIF configuration.
@jynik
Copy link
Contributor Author

@jynik jynik commented Jan 21, 2014

Fixed in FW v1.6.1

@jynik jynik closed this Jan 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.