Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

Access HPS SDRAM from NIOS II

Hello,

i am new to SOC devices, and i am using QII 15.0 and NIOS II ESD 15.0.

Now i am trying to access HPS SDRAM from a NIOS II programm. The HPS is running Linux, and the FPGA has a NIOS II Processor without OS.

I added a FPGA to SDRAM Interface (f2h_sdram0, Avalon MM Bidirectional, 32) to the Cyclone V hps and i connected it to a address span extender (Enable slave control port = false).

In my NIOS II system.h i have the following entry:

# define ALT_MODULE_CLASS_hps_0_bridges hps_bridge_avalon# define HPS_0_BRIDGES_BASE 0x1400000# define HPS_0_BRIDGES_IRQ -1# define HPS_0_BRIDGES_IRQ_INTERRUPT_CONTROLLER_ID -1# define HPS_0_BRIDGES_NAME "/dev/hps_0_bridges"# define HPS_0_BRIDGES_SPAN 4194304# define HPS_0_BRIDGES_TYPE "hps_bridge_avalon"

Now i am tryingt to read from the HPS SDRAM using:

data = IORD(HPS_0_BRIDGES_BASE, 1)

When NIOS II executes the instruction it gets stalled. A read to other addresses outside the address span extenders range works.

Do i have to use any other function to read from HPS sdram / address span extender?

Do i have to tell the HPS that there is another device trying to access the memory?

Any other ideas, why NIOS II gets stalled when reading from addresses inside the HPS / address span extenders space?

Thanks, Patrick

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    have you build a new Preloader (SPL) after building the QSYS-System and have you enabled the bridges in uboot-stage? What is your fpga2sdram_handoff in uboot?

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    That's right, not sure if you enable this in preloader or uboot. By the way, are you using bsp-editor or custom yocto build ?.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    normally the bridges get enabled in uboot-stage, but the handoff for the bridges gets passed from preloader, but if you know the handoff, you could use the old preloader and set the handoff manually...

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello,

    thank you for your fast responses!

    I think you are right, i never build the preloader / uboot, because the Demoboard i am using came shipped with a example (Ubuntu Linux) which i adapted to my needs (FPGA-Fabric only). I did not know, that the preloader affects the bridges to the FPGA.

    I will try to build the preloader and uboot using bsp-editor. I will post my results here!

    Thanks again,

    Patrick