cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lelio83
Visitor
Visitor
3,168 Views
Registered: ‎09-25-2011

Spartan 6 lx9 microboard and PmodNic100

Hi all. I'm trying to add another ethernet port to my lx9 microboard using the PmodNic100 wich uses the SPI protocol. I've created the MicroBlaze Processor and added the axi SPI interface to the MicroBlaze as you can see in my UCF file. After I exported the bitstream to the SDK...But now I don't know what to do in order to process ethernet frames from and to the Pmod. Can you help me on how to start? I've not been able to find anything on the web about this pmod on the microblaze. Thanks in advance.

0 Kudos
Reply
2 Replies
joelby
Advisor
Advisor
3,165 Views
Registered: ‎10-05-2010

Have you studied the ENC424J600 data sheet? You'll just need to decide which SPI commands to send to it, and then implement that with the MicroBlaze.

0 Kudos
Reply
lelio83
Visitor
Visitor
3,152 Views
Registered: ‎09-25-2011

Thanks for the answer. So, I'm trying to send a simple hardware reset to the pmod. As far as I've read on the datasheet I have to do it through a single byte instrunction. I'm using the pmod in polled mode so no interrupts are used.The pmod is also in only slave mode and the MicroBlaze in master mode. The datasheet says at page 41 that, for the System reset, I have to send an opcode 11001010  so (with MSB first) it has to be 0xCA and then i wrote the code to to this, but on the instruction XSpi_Transfer the execution stucks.It seems like crashing... I attach the code (obviously the function init_eth_spi() is beeing called in another code). Pls help me. Thanks.

 

/*
 * pmodNic100.c
 *
 *  Created on: 14/mar/2012
 *      Author: Lelio
 */

#include<xbasic_types.h>
#include<xparameters.h>
#include<xspi.h>
#include<xspi_l.h>
#include<xstatus.h>
#include<mb_interface.h>
#include<stdio.h>
#include "platform.h"
#include "platform_config.h"

#define ETH_SPI_ID XPAR_AXI_SPI_0_DEVICE_ID
#define ETH_BASEADDR XPAR_axi_spi_0_BASEADDR


static XSpi axi_spi_0;

void Delay(unsigned int msec);

void init_eth_spi() {
	Xuint8 inBuffer[1] = {0x00};
	Xuint8 outBuffer[1] = {0xCA};
	XStatus status;

	status=XSpi_Initialize(&axi_spi_0,ETH_SPI_ID);
	if (status==XST_SUCCESS)
		xil_printf("driver inizializzato\n");
	XSpi_Enable(&axi_spi_0);
	status=XSpi_Start(&axi_spi_0);
	if (status==XST_SUCCESS)
		xil_printf("driver avviato\n");
	status=XSpi_IntrGlobalDisable(&axi_spi_0);
	if (status==XST_SUCCESS)
		xil_printf("Interrupt disabilitati, polled mode\n");
	status=XSpi_SetSlaveSelect(&axi_spi_0,1);
	if (status==XST_SUCCESS)
		xil_printf("slave selezionato\n");


	status = XSpi_Transfer(&axi_spi_0, &outBuffer[0], NULL, 1);
	if(XSpi_SetSlaveSelect(&axi_spi_0,1)==XST_SUCCESS)
		xil_printf("Scrittura a buon fine"\n");
	


}

void Delay(unsigned int usec)
{
	int count = 0;

	for(count = usec * XPAR_MICROBLAZE_0_FREQ / 1000000; count > 0; count--)
	{
		asm("nop");
	}
}

 

 

 

 

 

 

 

0 Kudos
Reply