微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI WIFI设计交流 > CC3200 无线SPI转发遇到问题,求解答

CC3200 无线SPI转发遇到问题,求解答

时间:10-02 整理:3721RD 点击:

想实现无线SPI输出,结合sdk的spi_demo例程进行修改,引脚配置什么的都修改好并通过编译,结果在线调试卡在MAP_SPITransfer,请问大家能否帮忙找一下原因呢?

int TcpServerMultiClient(unsigned int usPort)
{
  int serverID;

  SlSockAddrIn_t sAddr;
  SlSockAddrIn_t sLocalAddr;
  int iAddrSize;
  int iStatus;
  int i, Ret,lLoopCount;
  int socketID[5] = {-1, -1, -1, -1, -1};
  //Start TCP Server;
  sLocalAddr.sin_family = SL_AF_INET;
  sLocalAddr.sin_port = sl_Htons((unsigned short)usPort);
  sLocalAddr.sin_addr.s_addr = 0;

  serverID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
  if(serverID < 0)
  {
    ASSERT_ON_ERROR(SOCKET_CREATE_ERROR);
  }

  iAddrSize = sizeof(SlSockAddrIn_t);
  iStatus = sl_Listen(serverID, 0);

  if( iStatus < 0 )
  {
    ASSERT_ON_ERROR(sl_Close(serverID));
    ASSERT_ON_ERROR(LISTEN_ERROR);
   }

   UART_PRINT("\n\rListen OK\n\r");
   //
   // Reset SPI
   //
   MAP_SPIReset(GSPI_BASE);
 
   //
   // Configure SPI interface
   //
   MAP_SPIConfigSetExpClk(GSPI_BASE,MAP_PRCMPeripheralClockGet(PRCM_GSPI),
                   SPI_IF_BIT_RATE,SPI_MODE_SLAVE,SPI_SUB_MODE_0,
                   (SPI_HW_CTRL_CS |
                   SPI_4PIN_MODE |
                   SPI_TURBO_OFF |
                   SPI_CS_ACTIVEHIGH |
                   SPI_WL_8));
   //
   // Enable SPI for communication
   //
   MAP_SPIEnable(GSPI_BASE);
   for(i = 0; i < 5; i ++)
	  {
		  if(socketID[i] < 0)
		  {  socketID[i] = sl_Accept(serverID, ( struct SlSockAddr_t *)&sAddr, 

(SlSocklen_t*)&iAddrSize);
		  }

		  if(socketID[i] > 0)
		  {
		      int LOOP,m;
                      for(LOOP = 0;LOOP < 1000 ; LOOP++)     {
                                 Ret = sl_Recv(socketID[i], g_cBsdBuf, 1000, 0);
                                 for ( m = 0 ;m < Ret ; m++ )	  {	    MAP_SPITransfer(GSPI_BASE,&g_cBsdBuf[m],0,10,	      			SPI_CS_ENABLE|SPI_CS_DISABLE);	    	    UART_PRINT("%s",&g_cBsdBuf[m]);	   }	  memset(g_cBsdBuf,0,sizeof(g_cBsdBuf));
	                      }
		  }
	  }

 	  for(i = 0; i < 5; i ++)
	  {
		  sl_Close(socketID[i]);
		  socketID[i]= -1;
	  }

}

 这都卡住的地方

你好,

你所谓的无线spi是什么意思?

是做一个spi转wifi的透传模块模块吗?

 这都卡住的地方

这是接收,你没有数据过来程序就pending。

你好,我是想通过无线给cc3200发送tcp包,3200接收到之后通过SPI转发给其他设备。 利用了SPITransfer这个函数,请问我该如何修改才能达到这个目的呢?谢谢!

可以参考Github 上的一个SPI DMA的例子,通过DMA提高使用效率

https://github.com/severin-kacianka/cc3200_dma_spi_example/

cc3200_dma_spi_example

Here are two examples that show how to use SPI with DMA and FIFO on the CC3200. I hope that they are a useful starting point for anyone, who wants to work on SPI and DMA in the future.

The examples are compiling fine on Linux with gcc 4.9.3 from http://launchpad.net/gcc-arm-embedded. All you need to change is the path for the SDK in the Makefile. The hardware setup is similar to the SPI example in the SDK: just connect two CC3200 via cable (Pins GND, P05, P06, P07 and P08). I have set the following jumpers: J6, J7, J8. J9. J10, J11, J12, J13.

simple_spi_transfer is an example of an SPI transfer without DMA and FIFO. The master sends a buffer to the slave, reads it back in the next transfers and verifies the checksums.

transfer_1024_byte implements a simple SPI/DMA transfer that will transfer 1024 (or whatever DMA_SIZE is set to) bytes from the master to the slave and back. It then calculates the buffer's CRC checksum and (on the master) compares the send checksum to the received checksum.

transfer_64k shows how to transfer a 64k buffer from the master to the slave and back again.

windows contains a Makefile send to me by Matt van de Werken that also works using the Launchpad tools in a Cygwin enviroment

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top