cancel
Showing results for 
Search instead for 
Did you mean: 

IAR STM8S103F3P6 SPI transfer

gafbich
Associate
Posted on November 29, 2016 at 21:13

There is a problem with the transfer on SPI how to track that this left?! Here is the function code for the transfer of bytes via SPI and a picture with a logic analyzer, circled in red, what confuses me is that for a glitch!

void init_SPI(void)

{

  CLK_PCKENR1 = 0x02; // Включаем тактирование SPI

  PC_DDR|=(1<<6)|(1<<5)|(1<<4);//MOSI(6) SCLK(5) CS(4)

  PC_CR1|=(1<<4);

  PC_CR2|=(1<<4);

  SPI_CR2|=(1<<1)|(1<<0);//CS Sofware

  SPI_CR1|=(1<<5)|(1<<4)|(1<<3)|(1<<2); //Fmaster/256, режим Master

  SPI_CR1&=~((1<<1)|(1<<0));

  SPI_CR1|=(1<<6);// Включаем SPI

}

void spi_send_2(unsigned char dummy)

{

  unsigned char tmp;

SPI_DR=dummy;

while (!SPI_SR_bit.TXE);

}

void cc1101_strobe(unsigned char s)

{

//

PC_ODR&=~(1<<4);

spi_send_2(s);

PC_ODR|=(1<<4);

}

void cc1101_init()

{

int a;

PC_ODR&=~(1<<4);

cc1101_strobe(SRES);

for(a=0; a<74; a++)

{

spi_send_2(cc_config[a]);

}

PC_ODR|=(1<<4);

delay(100);

}

0690X00000602o7QAA.jpg

0 REPLIES 0