de     

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:discussions:problem_with_a_in-out_communication [2013/11/21 10:27] – [C CODE:] 62.81.195.254en:discussions:problem_with_a_in-out_communication [2017/02/04 19:23] (current) – gelöscht stefan
Line 1: Line 1:
-<- [[:en:discussions:start]] 
  
-====== Problem with a IN-OUT Communication ====== 
- 
-//, 2013/11/21 11:11 // 
- 
- 
- 
-~~DISCUSSION~~ 
-======C CODE:====== 
-<code> 
-#include[ztex-conf.h] // Loads the configuration macros, see ztex-conf.h for the available macros 
-#include[ztex-utils.h] // include basic functions 
- 
-// configure endpoint 2, in, quad buffered, 512 bytes, interface 0 
-EP_CONFIG(2,0,BULK,IN,512,4); 
- 
-// configure endpoint 6, out, doublebuffered, 512 bytes, interface 0 
-EP_CONFIG(6,0,BULK,OUT,512,2); 
- 
-// select ZTEX USB FPGA Module 1.15 as target  (required for FPGA configuration) 
-IDENTITY_UFM_1_15(10.13.0.0,0);   
- 
-// this product string is also used for identification by the host software 
-#define[PRODUCT_STRING]["intraffic example for UFM 1.15"] 
- 
-// enables high speed FPGA configuration via EP6 
-ENABLE_HS_FPGA_CONF(6); 
- 
-// this is called automatically after FPGA configuration 
-#define[POST_FPGA_CONFIG][POST_FPGA_CONFIG 
- IOA7 = 1; // reset on 
- IOA0 = 1; // reset on 
- IOA3 = 0; 
- OEA |= bmBIT0 | bmBIT3; 
- IOC0 = 0; // controlled mode 
- OEC = 1; 
- //Configuration of CPUCS and IFconfig 
-    CPUCS = 0x12; 
-    IFCONFIG = bmBIT7 | bmBIT5 | 3;         // internel 30MHz clock, drive IFCLK ouput, slave FIFO interface 
-    //Configuration of flags Pin 
-    SYNCDELAY; 
-    FIFOPINPOLAR = 0; 
- SYNCDELAY;  
- PINFLAGSAB = 0x80; 
- SYNCDELAY;  
- PINFLAGSCD = 0x0E; 
- SYNCDELAY;  
-  
- //Configuration PORTACFG 
- //PORTACFG = 0x00; 
-  
- //Configuration of EPxCFG 
- EP2CFG = 0xA0; 
- SYNCDELAY; 
- EP6CFG = 0xE0; 
- SYNCDELAY; 
-  
- //FIFOreset 
-    FIFORESET = 0x80; // reset all FIFOs 
-    SYNCDELAY; 
-    FIFORESET = 0x82; 
-    SYNCDELAY; 
-    FIFORESET = 0x84; 
-    SYNCDELAY; 
-    FIFORESET = 0x86; 
-    SYNCDELAY; 
-    FIFORESET = 0x88; 
-    SYNCDELAY; 
-    FIFORESET = 0x00; 
-    SYNCDELAY; 
-  
- //Arm out buffers 
- OUTPKTEND = 0x82; 
- SYNCDELAY; 
- //Configuration of EPxFIFOCFG 
-    EP2FIFOCFG = 0x10; 
- SYNCDELAY; 
- EP6FIFOCFG = 0x4C;//0x0c 
- SYNCDELAY; 
- EP6AUTOINLENH = 0x02; 
- SYNCDELAY; 
- EP6AUTOINLENL = 0x00; 
- SYNCDELAY; 
- ] 
- 
-// set mode 
-ADD_EP0_VENDOR_COMMAND((0x60,, 
- IOA7 = 1; // reset on 
- IOC0 = SETUPDAT[2] ? 1 : 0; 
- IOA7 = 0; // reset off 
-,, 
- NOP; 
-));; 
- 
-ADD_EP0_VENDOR_REQUEST((0x70,, // return the checksum 
-    EP0BUF[0] = IOC; 
-    EP0BCH = 0; 
-    EP0BCL = 1;  
-,,));;  
-// include the main part of the firmware kit, define the descriptors, ... 
-#include[ztex.h] 
- 
-void main(void)  
-{ 
-    init_USB(); 
- 
-    while (1) {  
-    } 
-} 
- 
-</code> 
-~~JAVA FUNCTION~~ 
- 
-<code> 
- 
-System.out.println( LibusbJava.usb_bulk_write(ztex.handle(), 6, buf1, buf1.length, 1000) + " Bytes\r"); 
-bufBytes[i] = LibusbJava.usb_bulk_read(ztex.handle(), 2, buf[i], bufSize, 1000); 
-</code> 
- 
- 
- 
-It doesn´t work. Anyone know why this code doesn´t work. I have tried to add the configuration of AUTOIN and AUTOOUT. I have been several days with the manuals but I cannot find the problem. 
- 
-I want to send 512 bytes, then I process the bytes and finally I want to receive the 512 bytes. I want to use EP2 and EP6. 
-buf1 is an array of 512 bytes and buf[i] is an arry of 512 bytes too.  
- 
-Thank you very much.  
- 
-Best Regards 
 
en/discussions/problem_with_a_in-out_communication.1385029668.txt.gz · Last modified: 2013/11/21 10:27 by 62.81.195.254
 
Recent changes RSS feed Creative Commons License Powered by PHP Debian Driven by DokuWiki
[ZTEX Home] [Imprint] [Privacy policy]