Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20640 Discussions

DE2 board USB communication

Altera_Forum
Honored Contributor II
4,592 Views

Hello people, 

I'm curious to know is there anyone who have experience with DE2 board USB communication ? 

There is some ISP1362 USB-OTG controller which must be appropriate configured in order to communicate with USB device plugged into DE2 USB connector. 

Does anybody worked with this controller using VHDL programming language ? 

Is there a lot of problem to configure ISP1362 USB-OTG controller ? 

 

Thank you very much, 

Bojan
0 Kudos
34 Replies
Altera_Forum
Honored Contributor II
785 Views

There are a number of ways that you can communicate via USB on the DE2 board.

  1. You can set up a Nios-II architecture in SOPC and add a JTAGUART. You can use the JTAGUART to communicate from the Nios-II to your PC 

  2. On the CD-ROM that goes with the DE2 there is an example DE2_USB_API in the "DE2_emonstrations" Folder. 

  3. See the DE2_UserManual.pdf section 4.14 "Using USB Host and Device".
Hope this helps...
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

Thank you anyway... 

But there is no visible code for this examples, and USB  

controller is configured using Nios II processor. I want to use VHDL to configure controller. 

 

Regards, 

Bojan
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

Hi Koce, 

 

to build up your USB communication you will have to configure your Philips ISP1362 USB-OTG controller from your VHDL code. Given that a simple Nios-II only takes a few procent of the Logic Elements on your DE2, it is probably the easiest to realize your USB communication via a Nios processor and using a JTAGUART.
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

hello 

I am now working in a project which needs to make the DE2-70 board as a USB device and the host is the PC.  

I write some codes in vhdl to communicate with the ISP1362, because I can not to use the NIOS processor... 

 

When I try to probe the system, I found these problems: 

 

1) If I connect both the blaster cable and the device cable to the pc or only the blaster, the host  

shows initially the blaster, then I download the firmware to the FPGA and the system do the Enumeration and initialization  

process and the ISP1362 is recognize by the host PC. But, if I disconnect the blaster cable, the system  

is not respond, then I reset the driver by the firmware and the device is doesn't show by the host. 

I am using the VISA USB Raw of National Instrument and its driver in the host. 

 

 

 

2) If I work with both the blaster cable and the device cable connected, the system can transmit data 

from PC to device successful, but when I try to send data from device to host PC, it show me a timeout error. I check the firmware step by step and it apparently work correctly. 

 

 

Could you help me with these????
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

 

--- Quote Start ---  

But there is no visible code for this examples, and USB  

controller is configured using Nios II processor. I want to use VHDL to configure controller. 

 

--- Quote End ---  

 

 

Implementing USB host mode without a processor is very difficult. USB was designed for a processor managing the host. 

 

I'm not sure you would find a hardware-only USB-host core. Such a core would probably need almost as much resources as a NIOS II processor, possibly even more.
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

Actually, I need very very simple USB communication: I need to receive via USB just one byte of command for my design. My design then will do some actions and will respond via USB with a few bytes. I use VHDL for desing programming. 

Which is the best way to realize this ? If I well understood, I must use Nios II processor with some kind of assembly programming to configure ISP1362 USB controller ? 

Can I combine in one Quartus II project Nios II processor like a part of my design and VHDL programming for the rest of my desing? 

 

Thank you for your time and effort, 

Regards, 

Bojan
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

 

--- Quote Start ---  

If I well understood, I must use Nios II processor with some kind of assembly programming to configure ISP1362 USB controller ? 

--- Quote End ---  

 

 

The easiest is to use C code. 

 

 

--- Quote Start ---  

Can I combine in one Quartus II project Nios II processor like a part of my design and VHDL programming for the rest of my desing? 

--- Quote End ---  

Yes, you can!
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

Hello... 

Now, i am doing my project to transfer image between host computer (PC) and FPGA DE2 Altera via USB and display it into monitor. I am still new in using NIOS II Processor. First, I try to buil project USB Device given in Altera CD-ROM (DE2_NIOS_DEVICE_LED.sof in DE2_Demonstrations folder). But, i found error when building project like below: 

"The software setting (STF) file associated with this project is damaged. This may be fixed by copying your source files into new C/C++ application project. For more details see the error log." 

What should i do? What is the meaning of copying source file into new C/C++ application project? 

 

Thank you
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

what's the type of project that you created? 

 

C/C++ ?
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

Thank you for the help, 

I've found the problem: there is a space in my directory path. I have to rename my folder name so that there is no space anymore on my path directory.
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

Hi, 

I’m modifying the firmware coding of device controller which found from DE2 CD. 

My target is to send 16 bytes data block per transmission. 

I had modify the coding from ISR.c and mainloop.c 

But I still fail to make it transfer 16 bytes data per packet. 

 

(this is the coding from interrupt service routine,ISR.c) 

void Isr_Ep02Done(void) 

unsigned char bbuf[16]; 

int i = 0; 

Hal4D13_GetEndpointStatusWInteruptClear(EPINDEX4EP02); 

Hal4D13_ReadEndpoint(EPINDEX4EP02,&bbuf, 16); //error was found here : passing arg 2 of //'hal4d13_readendpoint' from incompatible pointer type. 

 

if( sendCount < length) 

Hal4D13_WriteEndpoint(EPINDEX4EP02, data + sendCount, 16); 

Hal4D13_GetEndpointStatusWInteruptClear(EPINDEX4EP02); 

 

sendCount += 16; 

 

if(sendCount > length) 

sendCount = 0; 

length = 0; 

 

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

data[i] = 0; 

 

Can anyone give me suggestion on how can I debug this error? I’m stuck…. 

Thanks, 

Summer
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

According to the function prototype 

USHORT Hal4D13_ReadEndpoint(UCHAR bEPIndex, UCHAR * buf, USHORT len); 

the correct syntax is 

Hal4D13_ReadEndpoint(EPINDEX4EP02,bbuf, 16); 

It has nothing to do with NIOS II, just a basic C syntax issue.
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

Hi all, 

Now, i am building SOPC system to make communication between PC and USB in DE2 using USB chip controller philips ISP1362. I read in such tutorial (lower version of NIOS II 9.0) that I have to make interface to the NIOS II Processor by choosing "Interface to User Logic" in the subtree "Legacy Components". But I didn't find that interface in NIOS II 9.0 IDE. What is the name of that interface in the NIOS II 9.0 IDE?  

Thank you...
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

hi, 

i'm doing finnal year project now, the project title is: doing an USB communicatin in VHDL, it is same with your project, DE2board, ISP1362... I haven't learnt VHDL before, so i have no idea about it. Have you finish your project? I need you help...Thank you very much^^
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

I think you should learn about VHDL programming first, then you try to implement simple design in FPGA. After that you move to your true project. One of recommended books to learn VHDL is Circuit Design with VHDL by Volnei A. Pedroni.

0 Kudos
Altera_Forum
Honored Contributor II
785 Views

thanks, but i only have 2 weeks to finish the project, and it is too busy right?!

0 Kudos
Altera_Forum
Honored Contributor II
785 Views

I think that learning VHDL and use it to implement the USB protocol in two weeks is a bit optimistic, yes.

0 Kudos
Altera_Forum
Honored Contributor II
785 Views

aaaa:(, then how to do now, i'm crying la

0 Kudos
Altera_Forum
Honored Contributor II
785 Views

while (tmp = '0') loop 

if (buffer_full = '0') then tmp <= '0'; 

elsif (buffer_full = '1') then tmp <= '1'; 

end if; 

end loop;  

 

 

Error: loop must terminate within 10000 iterations 

Error: can't elaborate top-level user hierarchy 

 

 

anyone who can help me find where is my mistake? thanks veryu much
0 Kudos
Altera_Forum
Honored Contributor II
662 Views

you don't have any pause in your loop, so if buffer_full is 0, then you will get stuck in the loop indefinitely. 

What are you trying to do?
0 Kudos
Reply