Forum Discussion

paramProd's avatar
paramProd
Icon for Community Manager rankCommunity Manager
57 minutes ago

SPI Master -3 SPI slave_FA

I would like to let DE0-Nano be a SPI Master to control 3 SPI slave.

I add SPI IP and set ss_n as 3.

After generating verilog file, there is only one xx_external_SS_n in xxx_inst.v for user.

Is it a bug?

2 Replies

  • paramProd's avatar
    paramProd
    Icon for Community Manager rankCommunity Manager

    Not a bug — this is expected behavior. The xx_external_SS_n port is a multi-bit bus, not three separate ports. When you configure the SPI IP for 3 slaves, that single ss_n port becomes a 3-bit wide signal [2:0], with one bit dedicated per slave.
    Here's the reasoning from the IP documentation:
    When the SPI core is configured to interface with multiple agents, the core has one ss_n signal for each agent. "Embedded Peripherals IP User Guide" These are all bundled into the single ss_n bus port you see in the instantiation file.
    The parameter you set specifies the number of agents the SPI host connects to. Embedded Peripherals IP User Guide So setting it to 3 means the ss_n bus will be 3 bits wide — ss_n[0], ss_n[1], and ss_n[2] — each driving one slave's chip-select line.
    The slaveselect register is a bit mask for the ss_n signals driven by an SPI host. "Embedded Peripherals IP User Guide" During a transfer, the host asserts ss_n to each agent specified in the slaveselect register. Embedded Peripherals IP User Guide
    So in your top-level or testbench, simply connect individual bits of that bus to your three slave devices:

    • xx_external_SS_n[0] → Slave 0
    • xx_external_SS_n[1] → Slave 1
    • xx_external_SS_n[2] → Slave 2
    Then in software, write the appropriate bit mask to the slaveselect register before initiating a transfer to select the target slave. There is one bit in slaveselect for each ss_n output, and a master peripheral can set multiple bits simultaneously to select multiple slave devices during a transaction. SSO Setting SSO to 1 forces the SPI core to drive its
  • Thank you for your inquiry. To ensure an accurate response, your request has been routed to an Altera application engineer for further review and assistance.


    Note: To continue using AI Responder, please start your next inquiry with ai_responder

    Disclaimer (Beta): The AI Responder is currently provided as a beta feature. AI-generated responses may contain errors or omissions. Please verify technical guidance with official Altera documentation before implementation.

    Thank you very much.