cancel
Showing results for 
Search instead for 
Did you mean: 

strange spi signal problem

ckaya
Associate II
Posted on February 28, 2013 at 14:40

Hello everyone,

We are using STM32F215VGT on our project. When we send data over SPI from STM32F2, clock and data signals are not square wave. i attached clock signal.

0690X00000602kpQAA.jpg

On our board, there is TXB0106 between STM32F2 and receiver. We removed TXB0106 but signals didn't change. Also output signal of TXB0106 is corrupted. I also attached SPI clock signal of STM32F2 and output signal of TXB0106.

Blue signal is SPI clock signal of STM32F2 and yellow signal is output signal of TXB0106.

0690X00000602nxQAA.jpg

Also we tried the codes on STM3220E eval kit but result is same.

How can we fix it?

Our SPI configuration is:

    SPI_InitTypeDef  SPI_InitStructure;

    GPIO_InitTypeDef GPIO_InitStructure;

    SPI_CLK_INIT(SPI_CLK, ENABLE);

    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);

    GPIO_PinAFConfig(GPIOB, GPIO_PinSource10, SPI_SCK_AF);

    GPIO_PinAFConfig(GPIOB, GPIO_PinSource15, SPI_MOSI_AF);

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;

    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

    GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_UP;

    /*!< SPI SCK pin configuration */

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;

    GPIO_Init(GPIOB, &GPIO_InitStructure);

    /*!< SPI MOSI pin configuration */

    GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_15;

    GPIO_Init(GPIOB, &GPIO_InitStructure);

    SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;

    SPI_InitStructure.SPI_Mode = SPI_Mode_Master;

    SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;

    SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;

    SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;

    SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;

    SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8;

    SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;

    SPI_InitStructure.SPI_CRCPolynomial = 7;

    SPI_Init(SPI, &SPI_InitStructure);

    SPI_Cmd(SPI, ENABLE);

Thanks.

#stm32f2-spi-txb0106
6 REPLIES 6
emalund
Associate III
Posted on February 28, 2013 at 16:24

looks like long connections - is it?

ckaya
Associate II
Posted on March 01, 2013 at 07:29

There is 5-6 cm distance between MCU and TXB0106, but we use another SPI connected device (AT45DB161). The distance between MCU and AT45DB161 is 2 cm, but signals are same.

ter
Associate II
Posted on March 01, 2013 at 14:09

If i see it right, you have a clock frequency of 4Mhz

With a typical pin capacitance of 5pF you have 15pF (uc + tbx.. + at45..), lets at another 5pf for the pcb track so we have 20pF. I thing with this capacitance, this waveform is normal and not corruptive. (As long as the SPI spec of the tbx and at45 are met)

But check the OSPEEDRy I/O speed is configuration register and the I/O AC characteristics in the STM32 data sheet. This can make the pins faster.

regards

timon

ckaya
Associate II
Posted on March 04, 2013 at 08:25

If you mean GPIOSpeed_TypeDef  parameter on stm standart peripheral library, we set it to 100 MHz. Also we set this parameter for all values (2, 25, 50 and 100 MHZ) but there is no difference

andersonb
Associate
Posted on February 04, 2014 at 03:05

That's a pretty normal waveform for that high of frequency. You've got parasitics that are creating a high time constant in reference to your clock signal. Especially at 2 cm. I would take a waveform generator and inject a signal along your line to your device and compare it to your generated SCK signal.

Posted on February 04, 2014 at 03:48

That, and people using 1X/10X probes in 1X mode, unaware of the awful bandwidth they have.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..