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