Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

why 3-wire spi have 4-prot ??

Altera_Forum
Honored Contributor II
1,027 Views

Dear ALL 

 

I want to use the spi in sopc builder . but I find it have 4 paort . i can connect it to my extern device . I want to know how to do it . thanks!
0 Kudos
12 Replies
Altera_Forum
Honored Contributor II
233 Views

You should get four signals at the top level: 

 

sclk (serial clock) 

mosi (master out slave in) --> so if you use a SPI master in SOPC Builder this is your serial output 

miso (master in slave out) --> so if you use a SPI master in SOPC Builder this is your serial input 

ss/ss_n (slave select) 

 

So if the component you are trying to talk to can only do reads for example you don't need to use the mosi signal (your component can't do anything with the data).
Altera_Forum
Honored Contributor II
233 Views

 

--- Quote Start ---  

originally posted by badomen@Nov 10 2006, 11:47 PM 

you should get four signals at the top level: 

 

sclk (serial clock) 

mosi (master out slave in)  --> so if you use a spi master in sopc builder this is your serial output 

miso (master in slave out) --> so if you use a spi master in sopc builder this is your serial input 

ss/ss_n (slave select) 

 

so if the component you are trying to talk to can only do reads for example you don't need to use the mosi signal (your component can't do anything with the data). 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=19370) 

--- quote end ---  

 

--- Quote End ---  

 

 

sopc builder shows only 3 pins either for master or slave how can we include the 4th pin as in the spi protocol. 

thanks in advance.
Altera_Forum
Honored Contributor II
233 Views

Which three signals? Which signal is missing on the symbol? Be verbose please? 

 

IzI
Altera_Forum
Honored Contributor II
233 Views

 

--- Quote Start ---  

originally posted by iztok.jeras@Dec 20 2006, 01:41 PM 

which three signals? which signal is missing on the symbol? be verbose please? 

 

izi 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=20135) 

--- quote end ---  

 

--- Quote End ---  

 

 

In sopc when i try to configure nios as slave in avlon communication it has spi 3 wire serial 

ss_n, sclk, miso 

 

where is mosi and if we need it in our project how to get this 4th line... 

 

thanks in advance...
Altera_Forum
Honored Contributor II
233 Views

 

--- Quote Start ---  

originally posted by ashish+dec 20 2006, 06:54 pm--><div class='quotetop'>quote (ashish @ dec 20 2006, 06:54 pm)</div> 

--- quote start ---  

<!--quotebegin-iztok.jeras@Dec 20 2006, 01:41 PM 

which three signals? which signal is missing on the symbol? be verbose please? 

 

izi 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=20135) 

--- quote end ---  

 

--- Quote End ---  

 

 

In sopc when i try to configure nios as slave in avlon communication it has spi 3 wire serial 

ss_n, sclk, miso 

 

where is mosi and if we need it in our project how to get this 4th line... 

 

thanks in advance... 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=20141)</div> 

[/b] 

--- Quote End ---  

 

 

 

please also guide me on how to use nios 2 as a spi slave using sopc builder.. 

i am a newbie in it.. 

thanks fr ur response in advance.... 

please response as soon as possible
Altera_Forum
Honored Contributor II
233 Views

This may be a stupid question, but did you check the right side of the processor symbol created in SOPC builder? 

 

Input signals are located on the left side of the symbol and output signals on the right side. 

 

Slave input signals: 

- sclk 

- ss_n 

- mosi 

Slave output signals: 

- miso 

 

Otherwise, are there any special parameter for SPI slave in SOPC builder? I never implemented a SPI slave, only masters. 

 

IzI
Altera_Forum
Honored Contributor II
233 Views

main objective of our project is to test spi master that we have built on MAX 2 cpld with nios acting as slave and also a host for our master. 

we are not able to figure out how to use nios 2 as spi slave. 

can we use spi core available with avalon interface for our purpose. 

we also need ide code for nios 2 slave. 

thanks in advance
Altera_Forum
Honored Contributor II
233 Views

It is not very common to have SPI slave connected to a processor and a SPI master on a less intelligent MAX II chip. Usually the roles are inverted. 

 

For instructions on how to use a SPI slave on Nios II, you should stay with the Altera documentation, since this is a rare usage of SPI, probably you will not be able to find someone with experience on the forum. 

 

As far as I checked the Altera provided drivers for SPI, they are only for master configurations, where all transfers are initiated by the Nios. 

 

IzI
Altera_Forum
Honored Contributor II
233 Views

thanks for reply.. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif  

 

actually we are planning a demo for a spi master and we have nios.. so we want to use it as a slave and as a host...  

could u suggest some other means for demo.. 

should we post our problem anywhere else also in the forum if so can u suggest in which link... 

 

thanks in advance..
Altera_Forum
Honored Contributor II
233 Views

SPI flash devices like the EPCS are a good SPI slave for a demo of your SPI master. In your demo you may access a SPI Flash (read its ID, read data, write data). Another good slave for a demo would be a SPI thermometer. 

 

IzI
Altera_Forum
Honored Contributor II
233 Views

 

--- Quote Start ---  

originally posted by iztok.jeras@Dec 22 2006, 01:52 PM 

spi flash devices like the epcs are a good spi slave for a demo of your spi master. in your demo you may access a spi flash (read its id, read data, write data). another good slave for a demo would be a spi thermometer. 

 

izi 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=20186) 

--- quote end ---  

 

--- Quote End ---  

 

 

Thanks for replying.. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif  

 

we have just started working on nios so the question which i am going to post may look stupid but will be great help for us if u reply soon. 

 

once i design spi slave on the nios development board do i need to specify the spi logic in nios ide software like do i need to specify the instructions for spi registers the command for read and write data or these protocol directly becomes the part of system as soon as we define it. 

 

if we have to define the logic for spi slave in ide then can u suggest where we can find a working code for demonstration and can we simulate the design in quartus before downloading it on board 

 

thanks in advance 

ashish
Altera_Forum
Honored Contributor II
233 Views

In SOPC i use SPI ( 3wire serial ) to read data from sdcard..some body help me to edit module : SPI clock (SCLK) rate , Actual clock rate, target delay, Actual delay, Width, Shift direction, Clock polarity, Clock phase, Thanks so much.. clock system i use: 50MHz

Reply