SPI not able to be switched off (MOSI - PIN ) @ATmega1284p

Guest #2962322
Rate this post
• ▲ 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

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.