Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

CFI Power Cycle code

Altera_Forum
Honored Contributor II
1,120 Views

Hi 

 

I have trouble with the sampling of ATA_SEL line during POR. 

I am trying to run the CFI in PC-ATA IO Mode using PIOs driving the CFI pins ( well most of them) 

 

 

Hence i am trying to Power off the CF Card and wait for a couple of seconds before switching the power on. 

 

I figured this should let me setup my ATASEL line to 1 and then Power on the chip, 

so that the chip would sample 1 on ATASEL and switch to PC-mem Mode. 

 

But even after Switching power off for 10 sec and then switching it back on, any registers i set previously are not getting reset to their Power on Defaults. 

 

What am i doing wrong ??? 

 

BTW i am using Nios Stratix Dev Kit 1s10 

 

My code :--> 

 

void init() 

printf("\nWaiting for card to be plugged in"); 

while(RD(CF_DETECT_BASE)==1) 

printf("\nCard Detected "); 

printf("\nPower Cycling Card"); 

WR(CF_ATASEL_BASE,1); 

WR(CF_POWER_BASE,0); 

printf("\nWaiting 10 Sec to take care of Leakage Currents"); 

usleep(10000000); //10 sec 

WR(CF_POWER_BASE,1); 

printf("\nRestarting:: Waiting 1 Seconds for CF Power Supply Ckt To Stabilise"); 

usleep(1000000); //1 sec 

WR(CF_RFU_BASE,0); 

WR(CF_IORD_N_BASE,1); 

WR(CF_IOWR_N_BASE,1); 

WR(CF_WE_N_BASE,1); 

WR(CF_ATASEL_BASE,0); 

WR(CF_CS_N_BASE,0); 

SW(CF_SPKR_BASE,0); 

SW(CF_DATA_BASE,0); 

while(RD(CF_SPKR_BASE)==0) 

printf("\nCard Powered up Successfully"); 

 

regards 

Pavan
0 Kudos
0 Replies
Reply