PB13 (SPI2_CLK) is used in the Evaluation board from ST (MB525) to drive the TFT LCD and is working fine on my board, I suggest you to re-check your code for sure you have something missing in the initilisation. :) Magigimix
On 27-12-2007 at 19:41, Anonymous wrote: Hi pinwu1, PB13 (SPI2_CLK) is used in the Evaluation board from ST (MB525) to drive the TFT LCD and is working fine on my board, I suggest you to re-check your code for sure you have something missing in the initilisation. :) Magigimix
I studied that part of source code. That clock for LCD is not generated by SPI internal clock. I simplified the code to initialize SPI registers and releated clocks only. I tested on this way, and found SPI1 working, but not SPI2.
For STM32F103RB chip, both SPI1 and SPI2 not working. Thank You,
I think that you mising part is in line : /* Enable SPI1 and GPIOA clocks */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1 | RCC_APB2Periph_GPIOA, ENABLE); // RCC_APB2PeriphClockCmd(RCC_APB1Periph_SPI2 | RCC_APB2Periph_GPIOB, ENABLE); SPI2 is connected in APB1 and not like SPI1 which is connected to APB2 with all GPIOs. So the right code to enbale SPI2 is something like : /* Enable SPI2 and GPIOB clocks */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE); Tell me if it is working well now ;) Magigimix ;)
My project has also this problem. The clk of SPI2 does not work at all, but there is signal on MOSI pin.
Already set like this RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
Quote:
On 28-12-2007 at 15:48, Anonymous wrote: Dear pinwu1, I think that you mising part is in line : /* Enable SPI1 and GPIOA clocks */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1 | RCC_APB2Periph_GPIOA, ENABLE); // RCC_APB2PeriphClockCmd(RCC_APB1Periph_SPI2 | RCC_APB2Periph_GPIOB, ENABLE); SPI2 is connected in APB1 and not like SPI1 which is connected to APB2 with all GPIOs. So the right code to enbale SPI2 is something like : /* Enable SPI2 and GPIOB clocks */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE); Tell me if it is working well now ;) Magigimix ;)