This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cc2530 spi 主机模式下允许接收问题

Other Parts Discussed in Thread: CC2530

你好:

    我通过CC2530 SPI 接口接外部SPI 接口数据,出现cc2530 spi接收到的数据不对。我cc2530 spi 配置为主机模式,同时允许接收。

    我spi配置的代码如下:

  U1CSR &= 0x7f ;       //SPI Master Mode
 
  U1CSR |= 0x40;           //设置为spi主机,允许接收
  // Configure phase, polarity, and bit order
  U1GCR &= ~0x80 ;      // CPOL = 0,CPHA = 0

  U1GCR |= 0x20 ;       // ORDER = 1

spi读数据代码:

char  spi_read_data()

{

char rxBuffer = 0x00 ;
  U1DBUF = 0xff ;
  while(0==(U1CSR&(1<<1)));         //直到发送完成
 
  rxBuffer = U1DBUF ;
  U1CSR&=~(1<<1);
 
  return rxBuffer ;

}

如:我外部SPI输出数据为0x08时,cc2530 spi接收到得数据为:0x04