Forum: Mikrocontroller und Digitale Elektronik Atmega SPI-SS Pin


von Michi (Gast)


Lesenswert?

Hallo,

ich möchte ein ATmega als SPI Slave Betreiben.
habe aber keine möglichkeit vom anderen Master ein Slave Select Signal 
zu bekommen.

Wird SS zwingend gebraucht um Daten von einem anderen Master zu 
erhalten.

Oder kann man hier denoch Daten per SPI lesen auch wen der SS Pin 
anderweitig verwendet wird?

: Verschoben durch Moderator
von Stringtänzer (Gast)


Lesenswert?

Steht im Datenblatt, bspw. atmega32:

/When the SPI is configured as a Slave, the Slave Select (SS) pin is 
always input. When SS is held low, the SPI is activated, and MISO 
becomes an output if configured so by the user. All other pins are 
inputs. When SS is driven high, all pins are inputs except MISO which 
can be user configured as an output, and the SPI is passive, which means 
that it will not receive incoming data. Note that the SPI logic will be 
reset once the SS pin is driven high./

Du bist auf SS und die Signalisierung angewiesen.

von Michi (Gast)


Lesenswert?

AVR1309:
The control lines are SCK (SPI Clock) and SS (Slave Select). If
SS is used, the master selects a slave device by pulling this line low, 
and supplies the
clock signal.


Das besagt ganz klar "If SS is used" also scheinbar kann man das auch 
weg lassen. gibt es da irgend eine SPI Konfigurationsmöglichkeit ide SS 
abschaltet?


3.2 The SS Pin:

If the SPI module's SS pin is configured as input, the function is like 
the first option
above. This SS input function is controlled from the SPI module 
hardware, and the SS
pin must be held logic high to ensure master SPI operation. If pulled 
low by other
master(s) using the SPI bus, the SPI module will avoid bus contention by 
entering
slave mode and consequently not driving the SCK and MOSI lines. Entering 
slave
mode is signaled by setting the SPI interrupt flag, generating an 
interrupt if enabled.
Configuring the SS pin as output enables the two last typical options, 
both controlled
from software and not affecting the SPI module operation. The SS pin is 
no different
than any other GPIO pins when it is configured as an output.




Wenn ich das richtig verstehe;

Wenn ich den SS Pin auf low bringe, arbeitet er als Slave.
Kann ich hier den SS Pin auch permanent auf Low bringen?
Was geschieht mit dem Interrupt in dem Fall?

(Es ist nur ein Master und ein Slave an dem SPI Bus)

von Jörg W. (dl8dtl) (Moderator) Benutzerseite


Lesenswert?

Stringtänzer schrieb:

> When SS is held low, the SPI is activated, and MISO
> becomes an output if configured so by the user.

Wobei das nicht heißt, dass man es nicht auch permanent auf low
legen könnte.  Wirklich sinnvoll ist das aber nicht, da man /SS
als Synchronisationssignal in der Regel irgendwie braucht.

Slave-SPI ist ohnehin eher suboptimal auf einem Controller, da der
Master vollständig das Timing vorgibt und der Slave keine Möglichkeit
hat zu rufen: "Halt, Moment bitte, bin gerade beschäftigt!".  Slave
I²C ist eigentlich die sinnvollere Variante für einen Controller,
wenn man sich das aussuchen kann.

von Michi (Gast)


Lesenswert?

Mein Problem ist hier das es um ein ST7540 IC geht.
Dieser Arbeitet als Master, sprich er gibt meinem µC den Takt vor.

Ich kann zwar Daten anfordern, indem ich am ST7540 RXTX (Einstellung der 
Datenrichtung) vorgebe

ST7540 Datenblatt Seite 21 Zeigt Das Timing beim Senden und Empfangen.

http://www.st.com/internet/imag_video/product/130228.jsp

Ich frage mich ob ich das hier nicht ganz in Software SPI mache

von holger (Gast)


Lesenswert?

>Mein Problem ist hier das es um ein ST7540 IC geht.
>Dieser Arbeitet als Master, sprich er gibt meinem µC den Takt vor.

Mit max 4800 Baud. Da langweilt sich dein uC;)

von Michi (Gast)


Lesenswert?

@holger:
Ich dachte da an 600 baud, das würde mir schon reichen :-)



Nur dieses Pseudo SPI was das ding da hat.. arrrg. Ich kann da nichts 
wirklich als SS Leitung nutzen. Das sieht mir nach unglaublich assigem 
code aus.

von Michi (Gast)


Lesenswert?

So langsam komme ich der Sache näher....


es gibt bei ST µC die möglichkeit den SS ein zu stellen mit:


SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;

Ich bin mir nicht sicher aber ich vermute das man hiermit einstellt wer 
den SS Pin schaltet, das gibts so bei Atmel scheinbar nicht

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.