Hello,
I am interfacing an external Flash via SPI using a MC9S12D64 Controller. The SS-line has to be kept low, while reading data. So i did the following, to control the SS-Pin by myself. The Idea was:
1) pull SS low
2) SPI-Communication
3) bring SS back high
This is my Code:
void INIT_SPI()
{
DDRS |=11100000; //SS, MOSI, SCK as Outut
SPIBR = 0b00000000; // (0+1)*2^(0+1)=2
//=> 16MHz/2 = 8MHZ
SPICR1 = 0b01010000;
SPICR2 = 0b00000000; //SS not used by SPI
WOMS = 0;
}
After that i had expected, that when the command:
PTS = (PTS & ~0x80);
would set SS= 0 and
PTS = (PTS|0x80);
would set SS =1
but the SS-line stays high, whatever i do!
Has someone used the SPI-Interface in that way?
Using MOSI,MISO,SCK normal and manage the SS-line manually?
Perhaps someone has working Code, or can tell my where my mistake is?