Forum Discussion
DE2 board USB communication
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, Bojan34 Replies
- Altera_Forum
Honored Contributor
i'm trying to do DMA mode, that can read and write data, when buffer_full = '1' then it can start, my teacher said cannot use "wait until"... should i give you my whole code?
- Altera_Forum
Honored Contributor
You need to write a clocked process and check the status of buffer_full. Don't use a while' use a if instead. If buffer_full is 0 then you don't do anything, if it is 1 then you start.
If you need to do more complex operations after that, it could be easier to do with a state machine. - Altera_Forum
Honored Contributor
i know the clock process, but i dont know how to use it to check buffer_full. Can you explain more, thanks...
- Altera_Forum
Honored Contributor
I assume that you are using tmp to detect a change in buffer_full ?
In that case, in the clocked part put something like:
Don't forget to give an initial value to tmp. And choose another name for tmp, to make your code more readable and maintainable. Something like 'active' or 'enabled' as an example.if (tmp = '0') and (buffer_full = '1') then tmp <= '1'; -- do your start stuff here end if; - Altera_Forum
Honored Contributor
i changed, but an new Error is appear...
count := count + 1; case count is when 0 => NULL; when 1 => word_buffer (03 downto 00) <= in_data; when 2 => word_buffer (07 downto 04) <= in_data; when 3 => word_buffer (11 downto 08) <= in_data; when 4 => word_buffer (15 downto 12) <= in_data; buffer_full <= '1'; bufferpicked: if tmp = '0' then buffer_picked <= '0'; elsif tmp = '1' then buffer_picked <= '1'; end if; Error : slice that is assigned to target slice has 16 elements, but must have same number of element as target slice (4) Error: Can’t elaborate top-level user hierarchy - Altera_Forum
Honored Contributor
How big is in_data? The error message suggests that it is 16 bits, and you are trying to load it into 4 bits of another vector.
- Altera_Forum
Honored Contributor
i change to when 1 => word_buffer (0011 downto 0000) <= in_data;
when 2 => word_buffer (0111 downto 0100) <= in_data; when 3 => word_buffer (1011 downto 1000) <= in_data; when 4 => word_buffer (1111 downto 1100) <= in_data; but it said it is 12 elements, so confuzed, how to change? thank you - Altera_Forum
Honored Contributor
I think the vector indexes were right in your previous message. Constant integers in VHDL are expressed in decimal by default, not binary.
The problem must rather come from the fact that your input data vector in_data is 16 bits wide, and not 4. - Altera_Forum
Honored Contributor
Thank for your help, I correct all the errors and it can work lol^^...
But a new question is appeared, my teather said that the buffer_full cannot decided by the tmp, the program should check wether buffer_full is 0 or 1... This buffer is decided by the DE2board, the PC or anything else??? I dont know checking where and how to check. - Altera_Forum
Honored Contributor
I don't have a DE2 board, but the answer should be in the kit and/or IP documentation.