SPI2->CR1 = 0x0000; //SPI禁止
delay_ms(1);
SPI2->CR1 |= (1<<12); //SSI bit has an effect only when the SSM bit is set
delay_ms(1);
SPI2->CFG1 = (3<<28)|(15<<16)|(15<<0); //16位数据,波特率=SPI master clock/16
delay_ms(1);
SPI2->CFG2 = (1<<26)|(0<<25)|(0<<24)|(0<<23)|(1<<22)|(0<<17); //SSM置位,SCK空闲低,第1个时钟沿开始采样,先发MSB,Master,
delay_ms(1);
SPI2->CR1 |= 1; //使能SPI
delay_ms(1);
SPI2->CR1 |= (1<<9);//CSTART置位, CSTART can be set only when SPE=1 and MASTER=1.
delay_ms(1);
}