EmbDev.net

Forum: µC & Digital Electronics SPI not able to be switched off (MOSI - PIN ) @ATmega1284p


von Daniel (Guest)


Rate this post
0 useful
not useful
Hello Forum,


I'm using the SPI of ATMega 1284(p) and need for creating a longer pulse 
a short switchoff of the intended SPI function.
The SPI is configured to be a master and works.

Unfortunately the SPI can't realy switched off, because i can't drive 
the MOSI (Pin B5) to Grounds.

My basic idea was: Get all registers back to initial value!

This don't work(!):
1
// Switchoff SPI Interface (to abtain control of lines)
2
      
3
      PRR0 |= (1<<PRSPI); // Disconnect Clock
4
      SPCR = 0;  // Init Value
5
      SPSR = 0;

If i  do not apply the commented line "Disconnect Clock" and leave it 
complet off like this:
1
// Switchoff SPI Interface (to abtain control of lines)
2
      SPCR = 0;  // Init Value
3
      SPSR = 0;

It works !
I don't find any hint in spec for switching off SPI !

Datasheet regarding  PRSPI:
1
Bit 2 - PRSPI: Power Reduction Serial Peripheral Interface
2
3
Writing a logic one to this bit shuts down the Serial Peripheral 
4
Interface by stopping the clock to the module. 
5
When waking up the SPI again, the SPI should be re initialized 
6
to ensure proper operation.

I assume that the ATMEL need the clock to switch of (and load) the 
registers!

Did anybody out there share the same experiance ?

(Finding and fixing time appros 4 hours ! **grr**)

Regards Daniel

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.