Forum Discussion
Altera_Forum
Honored Contributor
17 years agoJrunner + Serial Flash Loader (SFL) + EPCS4 [How to programm EPCS without Quartus II]
Hello,
I'd like to adapt Jrunner to work with Serial Flash Loader. I've integrated SFL megafunction into my design and it works great. When I click auto detect in quartus II programmer it detects Cyclone II and EPCS4 which is good. How does it detect EPCS4? I'd like to modify Jrunner so I can read sillicon ID of EPCS4, erase or programm it. Reading sillicon ID is the simplest operation so I will implement it first. I've read AN39 (JTAG in Altera Devices) but there is nothing about "talking" with secondary device (EPCS) by SFL. I don't know which JTAG instruction mode I should use. I just only know that read sillicon ID operation code is "1010 1011" for EPCS devices and that the answer should be 0x12 for EPCS4. Do you have any suggestions?32 Replies
- Altera_Forum
Honored Contributor
Thanks.
When you generate de .rbf file in Quartus, there is an option called "Mode Liste", where you can decide between Fast Parallel, Serial, etc. Do you remember which option you used? And actually, I don't understand this options: we are using JTAG, no one of this options which are propietaries from Altera, and it doesn appear a JTAG option in this list.... - Altera_Forum
Honored Contributor
As I rememer, it was about a minute...
- Altera_Forum
Honored Contributor
Just for knowing.... how long do you take to program the FPGA with the microcontroller?
Because using the Jrunner in the PC, it takes 25 seconds, but with the microcontroller it takes ¡¡¡ 5 minutes !!! (it's independent from the complexity or lenght of the FPGA code) It seems to be a lot, I've searched in the code if it's a place (like a define) where you can modify something related with a delay or something like that, but I've found nothing :( - Altera_Forum
Honored Contributor
--- Quote Start --- how to send data to the fpga to read/write the epcs via jtag? --- Quote End --- You will need to make an interface from LPC to ALTASMI_PARALLEL. And then use it to control EPCS. - Altera_Forum
Honored Contributor
--- Quote Start --- ALTASMI is used to access EPCS through FPGA. I've added ALTASMI module in my FPGA configuration to erase EPCS device and send data to it. --- Quote End --- thanks for your reply, e ~, do we not use the sfl module that our discussed before ? i try to add the ALTASMI_PARALLEL module in my configure ,then how to connect/configure the pins on the modules? and if i have configure the fpga with this configure file,how to send data to the fpga to read/write the epcs via jtag? have some protocol such as AS mode? thank you once again.. - Altera_Forum
Honored Contributor
ALTASMI is used to access EPCS through FPGA.
I've added ALTASMI module in my FPGA configuration to erase EPCS device and send data to it. - Altera_Forum
Honored Contributor
--- Quote Start --- oposdasdsWell, I used ALTASMI_PARALLEL to get access to my epcs16. Now I have some strange behaviour and try to describe it. LPC - my microcontroller (lpc2138). FPGA - Cyclone II, EP2C8T144 EPCS - EPCS16 1. LPC configures FPGA (via JTAG, with Jrunner port and array of *.rbf data) 2. LPC erases EPCS (uses newly configured FPGA with ALTASMI) 3. LPC writes the same array of *.rbf data to EPCS as to FPGA. 4. LPC checks data from EPCS byte-by-byte. All seems to be ok, but after I power off the device and tur it on again, EPCS do not configures FPGA. Can anyone tell me what's the issue? --- Quote End --- hi EnotAruz, the same to u ,i have done the first step that have configured the FPGA via the Jrunner;and then ,how to erase the epcs device and send the data to write epcs or read data. i see that u use the ,wahts that ? a IP? is it contained in the .rbf file at our first step generate? and whats the usage of ALTASMI? Look forward to your reply.thx alot:):) - Altera_Forum
Honored Contributor
That's good news.
- Altera_Forum
Honored Contributor
Thank you so much!! I've fixed my program and now it's working fine. My problem was that I've not realised that I must invert the TDO bit.
See you - Altera_Forum
Honored Contributor
Here it is:
JTAG lines connected to pins P1.16,17,18,19# define TDO_PIN (1<<18) // out # define TMS_PIN (1<<17) // out # define TDI_PIN (1<<16) // in # define TCK_PIN (1<<19) // out # define JTAG_PINS_MASK (TDO_PIN|TMS_PIN|TDI_PIN|TCK_PIN) /***************************************************************//** * Init processor pins. ******************************************************************/ int InitPorts(void) { printf("Init JTAG ports.\n"); IO1CLR = 0x02000000;//(unsigned int)(1<<25); // p1.25 led ON // JTAG IO1CLR = (JTAG_PINS_MASK); IO1DIR |= ( (TDO_PIN)|(TMS_PIN)| (TCK_PIN) ); // out IO1DIR &=~( (TDI_PIN) ); // in return 0; } /***************************************************************//** * DeInit processor pins. ******************************************************************/ int DeInitPorts(void) { printf("De Init JTAG ports.\n"); IO1SET = 0x02000000;//(unsigned int)(1<<25); // p1.25 led OFF // JTAG IO1CLR = (JTAG_PINS_MASK); IO1DIR &=~(JTAG_PINS_MASK); // all in :) return 0; } /******************************************************************/ /* ReadPort (int port input is ignored) /******************************************************************/ int ReadPort(int port) { int data = 0; data = (IO1PIN & (TDI_PIN))?0x00:0x80; // inversed - nTDO = 0x00 or 0x80 return (data & 0xff); } /******************************************************************/ /* WritePort /******************************************************************/ void WritePort(int port,int data,int buffer_enable) { unsigned int pins_to_clr=0,pins_to_set=0; pins_to_set |= ((port==0)&&(data&0x01)) ? (TCK_PIN) : (0); pins_to_set |= ((port==0)&&(data&0x02)) ? (TMS_PIN) : (0); pins_to_set |= ((port==0)&&(data&0x40)) ? (TDO_PIN) : (0); pins_to_clr = (~pins_to_set)&(JTAG_PINS_MASK); IO1SET = pins_to_set; IO1CLR = pins_to_clr; # define PORTS_DEBUG_PRINT 0 # if PORTS_DEBUG_PRINT if((port==0) && (data & 0x01)) {printf("\t TCK=1");}else{printf("\t TCK=0");} if((port==0) && (data & 0x02)) {printf("\t TMS=1");}else{printf("\t TMS=0");} if((port==0) && (data & 0x40)) {printf("\t nTDO=1");}else{printf("\t nTDO=0");} # endif }