Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

the problem of compactflash test

yesterday£¬my group produced the slot between compactflash card and up3 board

I first write a test code# include <stdio.h># include <stdlib.h># include <unistd.h>

# include "system.h"# include "sys/alt_alarm.h"# include "sys/alt_irq.h"# include "altera_avalon_cf_regs.h"# include "altera_avalon_cf.h"# include "ide.h"# define ctl_base (int*)CF_CTL_BASE# define ctl_irq (int)CF_CTL_IRQ# define ide_base (int*)CF_IDE_BASE# define ide_irq (int)CF_IDE_IRQ

int cardPresent(void);

int main()

{

unsigned short usStatus, usBuffer[256];

unsigned int i;

printf("cf card inert or not");

if( !cardPresent() )

{

printf("error: Compact Flash card not detected.\n");

return -1;

}

IOWR_ALTERA_AVALON_CF_IDE_COMMAND(ide_base, IdentifyDeviceCmd);

usleep(1);

usStatus = IORD_ALTERA_AVALON_CF_IDE_STATUS(ide_base);

usStatus = IORD_ALTERA_AVALON_CF_IDE_ALTERNATE_STATUS(ide_base);

if(usStatus & StatusRegBitDRQ)

{

for(i = 0; i < 256; ++i)

{

usBuffer = iord_altera_avalon_cf_ide_data(ide_base);

}

}

else

{

printf("error: drq not set in status reg\n");

return -1;

}

for(i=0;i<256;i++)

{

printf(¡°%04x\n",usbuffer);

}

}

int cardPresent(void)

{

if( (IORD_ALTERA_AVALON_CF_CTL_STATUS(ctl_base) &

ALTERA_AVALON_CF_CTL_STATUS_PRESENT_MSK) )

{

printf("you have insert the cf card");

return 1;

}

else

{

return 0;

}

}

the result is ¡±you have insert the cf card¡°

ffffffff

fffffff

¡£¡£¡£

ffffff

why£¿

then i use the test code on our forum

it only show

nios2-terminal: Warning: Unable to verify whether your download cable is

nios2-terminal: supported for Nios II systems. If you use an unsupported cable

nios2-terminal: you may experience intermittent JTAG communication failures.

nios2-terminal: Please refer to the file errata.txt included in the Nios II

nios2-terminal: development kit documents directory for information on how to

nios2-terminal: update your system.

nios2-terminal: connected to hardware target using JTAG UART on cable

nios2-terminal: "ByteBlasterII [LPT1]", device 1, instance 0

nios2-terminal: starting in terminal mode (Control-C exits)

the design of slot error£¿£¿£¿£¿£¿
No RepliesBe the first to reply