Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flash 从闪存读取的数据挂起不一致_Flash_Fpga_Xilinx - Fatal编程技术网

Flash 从闪存读取的数据挂起不一致

Flash 从闪存读取的数据挂起不一致,flash,fpga,xilinx,Flash,Fpga,Xilinx,我编写了一个lwip代码,用于从flash中写入和读取ip地址,写入很好,读取也正常,但读取后我调用平台启用中断();在这里的某个地方它被挂了有人能帮我吗 (使用spartan6 lx25板,应用程序Xilinx sdk) 我的代码部分也附在后面 在这里输入代码 int main() { /* the mac address of the board. this should be unique per board */ unsign

我编写了一个lwip代码,用于从flash中写入和读取ip地址,写入很好,读取也正常,但读取后我调用平台启用中断();在这里的某个地方它被挂了有人能帮我吗 (使用spartan6 lx25板,应用程序Xilinx sdk)

我的代码部分也附在后面 在这里输入代码

   int main()
       {
         /* the mac address of the board. this should be unique per board */
            unsigned char mac_ethernet_address[] =
            { 0x00, 0x0a, 0x35, 0x00, 0x01, 0x02 };

  echo_netif = &server_netif;

  init_platform();
  u8 *command1;
  u8 *response;
  int *len_response;
  int i=0;
  int k = 1;
  char *command4;
//reading from flash//
 command4 = network_settings_read_handler(command1,response,len_response);

if( command1[0]== 97)   //checking while flash has some values//
                     {
                       parse_sring_to_integers((command1 + 1));

 IP4_ADDR(&ipaddr,  ipaddress[0], ipaddress[1],ipaddress[2],         ipaddress[3]);
 IP4_ADDR(&netmask, 255, 255, 255,  0);
 IP4_ADDR(&gw, gwaddr[0], gwaddr[1], gwaddr[2], gwaddr[3]);
                        }
                else
                     {

                        /* initliaze IP addresses to be used */
                        IP4_ADDR(&ipaddr,  192, 168,   1, 10);
                        IP4_ADDR(&netmask, 255, 255, 255,  0);
                        IP4_ADDR(&gw,      192, 168,   1,  1);
                         port = 7;
                      }

//print_ip_settings(&ipaddr, &netmask, &gw);


lwip_init();

/* Add network interface to the netif_list, and set it as default */
if (!xemac_add(echo_netif, &ipaddr, &netmask,
                    &gw, mac_ethernet_address,
                    PLATFORM_EMAC_BASEADDR)) {
    xil_printf("Error adding N/W interface\n\r");
    return -1;
}

netif_set_default(echo_netif);

/* Create a new DHCP client for this interface.
 * Note: you must call dhcp_fine_tmr() and dhcp_coarse_tmr() at
 * the predefined regular intervals after starting the client.
 */
//dhcp_start(echo_netif);

/* now enable interrupts */

platform_enable_interrupts();  /* ???? here i think it hangs??????? */

/* specify that the network if is up */
netif_set_up(echo_netif);
unsigned portaddr;
start_application(port);
/* receive and process packets */
while (1) {
    xemacif_input(echo_netif);
    transfer_data();
    if(k){
        k = 0;
        u8 * command_body;
        u8 *response;
        int *len_response;

    }
}
/* never reached */
cleanup_platform();

return 0;
}
我从flash功能读取的数据是

 char network_settings_read_handler(u8 *command_body1, u8 *response1, int   *len_response1) {strong text


int numofbytes =27;//(command_body[1]<<8 | command_body[2]);
//xil_printf("command body is %x %x %x\r\n", command_body[0],   command_body[1], command_body[2]);

unsigned char ReadBuffer[100];
int errorcode = 0;
int i,j;enter code here
int Status = XST_SUCCESS;


    //add flash read here
    //--------------------------------

   // Initialization start
    Status = XSpi_Initialize(&Spi,XPAR_SPI_FLASH_DEVICE_ID);
//xil_printf("SPI initialize status is %d.\r\n",Status);

Status = XSpi_Start(&Spi);
//xil_printf("SPI start status is %d.\r\n",Status);


Status = XSpi_IntrGlobalDisable(&Spi);
//xil_printf("SPI global disable status is %d.\r\n",Status);
//xil_printf("isf is %x, spi is %x, iswb is  %x\r\n",&Isf,&Spi,&IsfWriteBuffer);

Status = XIsf_Initialize(&Isf, &Spi, ISF_SPI_SELECT, IsfReadBuffer);
//xil_printf("ISF initialize status is %d.\r\n",Status);
//xil_printf("dev code is %x\r\n",Isf.DeviceCode);
// Initialization end

//xil_printf("Setting read parameters...\r\n");


ReadParam.Address = nw_settings_address_rw;
ReadParam.NumBytes = 27;
ReadParam.ReadPtr = ReadBuffer;
//print("read parameters set.\r\n");
//xil_printf("Starting read...\r\n");

//Status = XIsf_Read(&Isf, XISF_READ, (void*) &ReadParam);
Status = XIsf_Read(&Isf, XISF_READ, (void*) &ReadParam);

IsfWaitForFlashNotBusy();
if (Status != XST_SUCCESS) {
    //print("read failure.\r\n");
}

//xil_printf("read done...\r\n");

//(response) = (ReadBuffer + 4);
for(i=0;i<27;i++)
{
    //response[i]= ReadBuffer[i + 4];
    command_body1[i]= ReadBuffer[i + 4];
//  for(j=0;j<5;j++)
    //{}
    //xil_printf(" read value in read handler: %c\n\r",command_body1[i]);
}
command_body1[numofbytes]='\0';

for(i=0;i<15000;i++){}


return command_body1 ;

}
char网络\u设置\u读取\u处理程序(u8*命令\u正文1,u8*响应1,int*len\u响应1){强文本
int numobytes=27;//(命令体[1]