cancel
Showing results for 
Search instead for 
Did you mean: 

No MOSI PULSE if use SPI re-mapped

ronrafer
Associate
Posted on February 28, 2013 at 04:03

A am using STM32F103T4, a low density device, and want to use the re-mapped SPI1. Below is my implementation:

  /* GPIO and AFIO clock enable */

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO| RCC_APB2Periph_GPIOB, ENABLE);

       

      /* Enable SPI */

        RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);

       /*JTAG-DP Disabled and SW-DP Enabled */

       GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); //JTAG-DP Disabled and SW-DP Enabled 

        

        /* Configure REmapped- SPI pins: SCK, MISO and MOSI */

        GPIO_PinRemapConfig(GPIO_Remap_SPI1, ENABLE);

        

        //Configure SPI pins:  SCLK=PB3, MOSI=PB5

        GPIO_InitTypeDef GPIO_InitStructureB;

        GPIO_InitStructureB.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_5;

        GPIO_InitStructureB.GPIO_Mode = GPIO_Mode_AF_PP;

        GPIO_InitStructureB.GPIO_Speed = GPIO_Speed_50MHz;

        GPIO_Init(GPIOB, &GPIO_InitStructureB);

           

        //Configure SPI pins:  MISO=PB4

        GPIO_InitStructureB.GPIO_Pin = GPIO_Pin_4;

        GPIO_InitStructureB.GPIO_Mode = GPIO_Mode_IN_FLOATING;

        GPIO_Init(GPIOB, &GPIO_InitStructureB);

        GPIO_InitTypeDef GPIO_InitStructure;

My problem is I have a clock pulse but no MOSI pulse. Do I have a missing code for MOSI on PB5 to work. kindly help.

#spi-stm32f103 #spi-re-mapped
2 REPLIES 2
Amel NASRI
ST Employee
Posted on February 28, 2013 at 11:08 Hello, Try to add SPI1 alternate fucntion mapping before configuring GPIOs and le me know...

GPIO_PinRemapConfig(GPIO_Remap_SPI1, ENABLE);

Best Regards, ST.MCU

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

PMICH.3
Associate

The Mosi pin is conflicting with I2C1_SMBAl . Disable i2c and it will work !!