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

Author: Daniel (Guest)
Posted on:

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(!):
// Switchoff SPI Interface (to abtain control of lines)
      PRR0 |= (1<<PRSPI); // Disconnect Clock
      SPCR = 0;  // Init Value
      SPSR = 0;

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

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

Datasheet regarding  PRSPI:
Bit 2 - PRSPI: Power Reduction Serial Peripheral Interface

Writing a logic one to this bit shuts down the Serial Peripheral 
Interface by stopping the clock to the module. 
When waking up the SPI again, the SPI should be re initialized 
to ensure proper operation.

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

Did anybody out there share the same experiance ?

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

Regards Daniel


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]
  • [avrasm]AVR assembler code[/avrasm]
  • [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.