Forum Discussion

MCOUNSELL's avatar
MCOUNSELL
Icon for Occasional Contributor rankOccasional Contributor
7 years ago

alt_qspi_read() QSPI addressing problem

alt_qspi_read() is returning data from the QSPI address -1. I've written data to the QSPI by two different methods. quartus_hps.exe and also using alt_qspi_write function it in both cases the data from QSPI is returned out by 1byte address.

I am using the Altera Cyclone V dev kit.

QSPI is setup in PlatformDesigner as per the GSRD examples.

I have debugged through the alt_qspi_read() code and I cannot see any obvious "out by one" issues.

The hardware must be OK I assume since the preloader runs correctly from QSPI and loads my bare metal application and runs it.

The problem is quite easy for me to work around BUT I'm worried that it is the sign of something bad elsewhere!! Has anyone seen similar?

Intel? Can you comment please?

14 Replies

    • MCOUNSELL's avatar
      MCOUNSELL
      Icon for Occasional Contributor rankOccasional Contributor

      Hi,

      No, writing via quartus_hps.exe is perfect. Never seen any errors and I have written many many times using this exe.

      Mike

      • EBERLAZARE_I_Intel's avatar
        EBERLAZARE_I_Intel
        Icon for Regular Contributor rankRegular Contributor

        Hi,

        I assume if there was no error when booting up the board such as bad u-boot.img etc or anything that prevented the board from booting, everything should be fine.

  • JEkla's avatar
    JEkla
    Icon for New Contributor rankNew Contributor

    Having the same issue. We are reading an image that was programed with quartus_hps.exe and data read with alt_qspi_read is shifted 1 byte.

    • MCOUNSELL's avatar
      MCOUNSELL
      Icon for Occasional Contributor rankOccasional Contributor

      Hi JEKla,

      I'm kinda pleased to hear that it's not just me..... maybe we'll get more help from Intel in this case....

      What h/w are you using? Are you on the Intel/Atlera dev board?

      Mike

      • MCOUNSELL's avatar
        MCOUNSELL
        Icon for Occasional Contributor rankOccasional Contributor

        I see, that's the same IC as I have on the Dev Kit board. My gut is that the Altera C code is to blame rather than the IC/board...... something in the QSPI indirect read code............. but no comment yet from Intel/Altera....

        I've worked around the issue by adjusting the requests into alt_qspi_read(). I wrote a wrapper around this function and I read to address -4 with size +4. Hence I read the preceeding 4 bytes also.... then I pull out the data that I really want........ it's a total HACK of course but it is a reliable HACK for now until I find out the real source of the issue.

        @INTEL ----- please give us some more input guys/girls.... your FPGA SoC is awesome.... loadsa folks wanna make solutions out of it and give you loads more money for these ICs but you really need to support us better..... pleeeease

  • Oaksys's avatar
    Oaksys
    Icon for New Contributor rankNew Contributor

    You need to change the number of read dummy cycles. I guess in your case from 10 to 8. In the hwlib I am using, this number can be changed in alt_qspi.c. It might be possible to use alt_qspi_device_read_config_get and alt_qspi_device_read_config_set to change the dummy cycle setting, but it needs to be done after calling alt_qspi_enable since this function will revert to the settings in alt_qspi.c.

    The number of read dummy cycles can change if the QSPI reference clock is changed.