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 registers! Did anybody out there share the same experiance ? (Finding and fixing time appros 4 hours ! **grr**) Regards Daniel