EmbeddedRelated.com
Forums

problem with EZ USB FX2

Started by mimran June 15, 2006
I am trying to put some value on FD[0..15] by PORT B and PORT D. The
FD[0..7] is connected to LEDs on Spartan board.But I am having problem as
these values are not shown up. The code on kiel is compiling fine and I
can upload the firmware onto EZ USB FX2 without any problem but the
desired values are not displayed. BTW, i use vhdl code to make reset for
board. Here is my code:


#define ALLOCATE_EXTERN
#include <fx2.h>
#include <fx2regs.h>

void init_fx2(void);
void init_gpif(void);

void init_fx2(void)
{
    CPUCS = 0x10;								// Sets CPU to 48MHz clock
	EP1INCS = EP1INCS & (0xff - bmEPSTALL);		// Resetting the STALL bit in
case it was set so the USB-Host
    EP1OUTCS = EP1OUTCS & (0xff - bmEPSTALL);	// doesn't get an error
message for trying to read
    EP1OUTBC = 0x40;							// Writing to EP1OUTBC rearms for an out
transfer
}

void init_gpif(void)
{
    IFCONFIG = 0xCE;		// 48 MHz,internal clock, and master GPIF
	OEB = 0xFF;		// Configure as output port
	OED = 0xFF;		// Configure as output port
}

void main(void)
{
	init_fx2();
	init_gpif();
	while (1){			// Forever do:
    	IOB = 0xAA;		// For blinking of LEDs
		IOD = 0xAA;		// For blinking of LEDs
    }
}


Anticipating in advance.
Muhammad Imran
The Netherlands

Port B & D I believe are part of the GPIF. Read up on those ports.. I forget 
what it is but I know you have to diddle something extra to actually make 
those ports available.. Read up on it..


"mimran" <Muhammad@delfic3.nl> wrote in message 
news:wYqdnRtHiPArGAzZnZ2dnUVZ_radnZ2d@giganews.com...
>I am trying to put some value on FD[0..15] by PORT B and PORT D. The > FD[0..7] is connected to LEDs on Spartan board.But I am having problem as > these values are not shown up. The code on kiel is compiling fine and I > can upload the firmware onto EZ USB FX2 without any problem but the > desired values are not displayed. BTW, i use vhdl code to make reset for > board. Here is my code: > > > #define ALLOCATE_EXTERN > #include <fx2.h> > #include <fx2regs.h> > > void init_fx2(void); > void init_gpif(void); > > void init_fx2(void) > { > CPUCS = 0x10; // Sets CPU to 48MHz clock > EP1INCS = EP1INCS & (0xff - bmEPSTALL); // Resetting the STALL bit in > case it was set so the USB-Host > EP1OUTCS = EP1OUTCS & (0xff - bmEPSTALL); // doesn't get an error > message for trying to read > EP1OUTBC = 0x40; // Writing to EP1OUTBC rearms for an out > transfer > } > > void init_gpif(void) > { > IFCONFIG = 0xCE; // 48 MHz,internal clock, and master GPIF > OEB = 0xFF; // Configure as output port > OED = 0xFF; // Configure as output port > } > > void main(void) > { > init_fx2(); > init_gpif(); > while (1){ // Forever do: > IOB = 0xAA; // For blinking of LEDs > IOD = 0xAA; // For blinking of LEDs > } > } > > > Anticipating in advance. > Muhammad Imran > The Netherlands >