Forum Discussion
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
Community Manager
Not a bug — this is expected behavior. The
xx_external_SS_nport is a multi-bit bus, not three separate ports. When you configure the SPI IP for 3 slaves, that singless_nport 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 oness_nsignal for each agent. "Embedded Peripherals IP User Guide" These are all bundled into the singless_nbus 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 thess_nbus will be 3 bits wide —ss_n[0],ss_n[1], andss_n[2]— each driving one slave's chip-select line.
Theslaveselectregister is a bit mask for thess_nsignals driven by an SPI host. "Embedded Peripherals IP User Guide" During a transfer, the host assertsss_nto each agent specified in theslaveselectregister. 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 0xx_external_SS_n[1]→ Slave 1xx_external_SS_n[2]→ Slave 2
slaveselectregister before initiating a transfer to select the target slave. There is one bit inslaveselectfor eachss_noutput, 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 - ai_responder
Community Manager
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_responderDisclaimer (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.