if (SPI == SPI1) { RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE); } else { RCC_APB2PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE); SPI2 is connected to APB1 not APB2 , so you should modify the second line to RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE); hope this helps you :) STOne-32.
I have created set of functions to initialize and use SPI1 channel with DMA. I have tried to expand it to be able to use SPI2 also. But I'm not getting any DMA interrupts for SPI2 channel. Does SPI2 differ from SPI1? Did I miss something in the Datasheet ? I'm attaching the code as spi.txt