Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > How to configure endpoints from PRIPH.C

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



How to configure endpoints from PRIPH.C
Moderator:
RSKV

Post Reply
Follow this topic



How to configure endpoints from PRIPH.C

ragers posted on 25 Aug 2011 1:02 AM PST
Top Contributor
25 Forum Posts

Hi.

I want to configure my 68013 from fx.uv2 project with  

<<EP2 -> balk OUT 1024 bytes>>    <<EP4 -> deactivated>>   << EP6 balk in 1024 bytes >>  << EP8 -> deactivated>>

It did it by changing ";;Endpoint descriptor " in DSCR.c

but reading documents it seams Endpoints should be configured from PRIPH.c.  I wrote the folowing program in To_Init procedure of PREPH.C file in the project it generates no error but the device still has the default configuration (4 512 bytes Endpoints)

..................

  IFCONFIG=0xcb; //Slave FIFO Interface (external master) ASYNC 48Mh IFCLKOE=Tri-state
// IFCLK signal is inverted
SYNCDELAY;
REVCTL = 0x03; // REVCTL.0 and REVCTL.1 set to 1
SYNCDELAY;
//<didn't work>
//EP2CFG = 0xAA; // out, bulk, 1024 bytes, double buffered
EP4CFG = 0; // deactivate
//EP6CFG = 0xEA; // in, bulk, 1024 bytes, double buffered
EP8CFG = 0; // deactivate
//</didn't work>
SYNCDELAY;
FIFORESET = 0x80; // Reset the FIFO
SYNCDELAY;
FIFORESET = 0x02;
SYNCDELAY;
FIFORESET = 0x00;
SYNCDELAY;
  OUTPKTEND = 0x82; // Arm both EP2 buffers to “prime the pump” = 10-00-00-10b
  SYNCDELAY;
 OUTPKTEND = 0x82; // Arm both EP2 buffers to “prime the pump” 
SYNCDELAY;
EP2FIFOCFG=0x10; //for Auto-Out transfers between endpoint and slave FIFO
SYNCDELAY;
EP6FIFOCFG=0x0C; //for Auto-In transfers between slave FIFO and endpoint
SYNCDELAY;
EP6AUTOINLENH = 0x04; // Auto-commit 1024-byte packets
SYNCDELAY;
EP6AUTOINLENL = 0x00;

.................

what is wrong?

thanks in advance.




Re: How to configure endpoints from PRIPH.C

PRJI posted on 25 Aug 2011 07:07 AM PST
Cypress Employee
333 Forum Posts

Hi,

                   Please check your packet size. As per USB specification maximum packet size must be 512 bytes for bulk transfer.

Regards,

Prajith



Re: How to configure endpoints from PRIPH.C

ragers posted on 26 Aug 2011 09:00 PM PST
Top Contributor
25 Forum Posts

Thanks Prajith for replay 

I changed   the code to:

IFCONFIG=0xcb; 
SYNCDELAY;
REVCTL = 0x03; // REVCTL.0 and REVCTL.1 set to 1
SYNCDELAY;
//<didn't work>
EP2CFG = 0xA2; // out, bulk, 512 bytes, double buffered
EP4CFG = 0; // deactivate
EP6CFG = 0xE2; // in, bulk, 512 bytes, double buffered
EP8CFG = 0; // deactivate
//</didn't work>
SYNCDELAY;
FIFORESET = 0x80; // Reset the FIFO
SYNCDELAY;
FIFORESET = 0x02;
SYNCDELAY;
FIFORESET = 0x00;
SYNCDELAY;
OUTPKTEND = 0x82; // Arm both EP2 buffers to “prime the pump” = 10-00-00-10b
SYNCDELAY;
OUTPKTEND = 0x82; // Arm both EP2 buffers to “prime the pump”
SYNCDELAY;
EP2FIFOCFG=0x10; //for Auto-Out transfers between endpoint and slave FIFO
SYNCDELAY;
EP6FIFOCFG=0x0C; //for Auto-In transfers between slave FIFO and endpoint
SYNCDELAY;
EP6AUTOINLENH = 0x02; // Auto-commit 512-byte packets
SYNCDELAY;
EP6AUTOINLENL = 0x00;
 

but it did not work device still has 4 bulk endpoints with 512bytes lenght

other configurations from To_Init such quad buffered and ... does not work.

am I making a stupid mistake?



Re: How to configure endpoints from PRIPH.C

ragers posted on 27 Aug 2011 10:02 PM PST
Top Contributor
25 Forum Posts

According to trm "EZ-USB Endpoint Buffers" using configuration 5 i changed EP2CFG to 0xA0 and EP6CFG to 0xE0  still the same. 



Re: How to configure endpoints from PRIPH.C

PRJI posted on 29 Aug 2011 04:57 AM PST
Cypress Employee
333 Forum Posts

Hi,

                  Have you modified your descriptor file dscr.a51? Can you upload your descriptor file?

Regards,

Prajith



Re: How to configure endpoints from PRIPH.C

ragers posted on 02 Sep 2011 08:24 PM PST
Top Contributor
25 Forum Posts

the file is attached.

The question is that why changing EPxCFG has no effect.

may be i should include some alternatives in dscr.a51 included the one i am assigning to EPxCFG ? cause the values i said for EPxCFG are not in the descriptor!!!

 



Re: How to configure endpoints from PRIPH.C

ragers posted on 02 Sep 2011 08:26 PM PST
Top Contributor
25 Forum Posts


Re: How to configure endpoints from PRIPH.C

PRJI posted on 05 Sep 2011 05:06 AM PST
Cypress Employee
333 Forum Posts

Hi,

        Your file has not been attached.

Regards

Prajith



Re: How to configure endpoints from PRIPH.C

ragers posted on 05 Sep 2011 08:47 PM PST
Top Contributor
25 Forum Posts

this is dscr.a51

;;-----------------------------------------------------------------------------
;; File: dscr.a51
;; Contents: This file contains descriptor data tables.
;;
;; $Archive: /USB/Examples/Fx2lp/bulkloop/dscr.a51 $
;; $Date: 9/01/03 8:51p $
;; $Revision: 3 $
;;
;;
;;-----------------------------------------------------------------------------
;; Copyright 2003, Cypress Semiconductor Corporation
;;-----------------------------------------------------------------------------;;-----------------------------------------------------------------------------

DSCR_DEVICE equ 1 ;; Descriptor type: Device
DSCR_CONFIG equ 2 ;; Descriptor type: Configuration
DSCR_STRING equ 3 ;; Descriptor type: String
DSCR_INTRFC equ 4 ;; Descriptor type: Interface
DSCR_ENDPNT equ 5 ;; Descriptor type: Endpoint
DSCR_DEVQUAL equ 6 ;; Descriptor type: Device Qualifier

DSCR_DEVICE_LEN equ 18
DSCR_CONFIG_LEN equ 9
DSCR_INTRFC_LEN equ 9
DSCR_ENDPNT_LEN equ 7
DSCR_DEVQUAL_LEN equ 10

ET_CONTROL equ 0 ;; Endpoint type: Control
ET_ISO equ 1 ;; Endpoint type: Isochronous
ET_BULK equ 2 ;; Endpoint type: Bulk
ET_INT equ 3 ;; Endpoint type: Interrupt

public DeviceDscr, DeviceQualDscr, HighSpeedConfigDscr, FullSpeedConfigDscr, StringDscr, UserDscr

DSCR SEGMENT CODE PAGE

;;-----------------------------------------------------------------------------
;; Global Variables
;;-----------------------------------------------------------------------------
rseg DSCR ;; locate the descriptor table in on-part memory.

DeviceDscr:
db DSCR_DEVICE_LEN ;; Descriptor length
db DSCR_DEVICE ;; Decriptor type
dw 0002H ;; Specification Version (BCD)
db 00H ;; Device class
db 00H ;; Device sub-class
db 00H ;; Device sub-sub-class
db 64 ;; Maximum packet size
dw 04b4H ;; Vendor ID
dw 1006H ;; Product ID (Sample Device)
dw 0000H ;; Product version ID
db 1 ;; Manufacturer string index
db 2 ;; Product string index
db 0 ;; Serial number string index
db 1 ;; Number of configurations

DeviceQualDscr:
db DSCR_DEVQUAL_LEN ;; Descriptor length
db DSCR_DEVQUAL ;; Decriptor type
dw 0002H ;; Specification Version (BCD)
db 00H ;; Device class
db 00H ;; Device sub-class
db 00H ;; Device sub-sub-class
db 64 ;; Maximum packet size
db 1 ;; Number of configurations
db 0 ;; Reserved

HighSpeedConfigDscr:
db DSCR_CONFIG_LEN ;; Descriptor length
db DSCR_CONFIG ;; Descriptor type
db (HighSpeedConfigDscrEnd-HighSpeedConfigDscr) mod 256 ;; Total Length (LSB)
db (HighSpeedConfigDscrEnd-HighSpeedConfigDscr) / 256 ;; Total Length (MSB)
db 1 ;; Number of interfaces
db 1 ;; Configuration number
db 0 ;; Configuration string
db 10000000b ;; Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
db 50 ;; Power requirement (div 2 ma)

;; Interface Descriptor
db DSCR_INTRFC_LEN ;; Descriptor length
db DSCR_INTRFC ;; Descriptor type
db 0 ;; Zero-based index of this interface
db 0 ;; Alternate setting
db 4 ;; Number of end points
db 0ffH ;; Interface class
db 00H ;; Interface sub class
db 00H ;; Interface sub sub class
db 0 ;; Interface descriptor string index

;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 02H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 00H ;; Maximun packet size (LSB)
db 02H ;; Max packect size (MSB)
db 00H ;; Polling interval

;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 04H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 00H ;; Maximun packet size (LSB)
db 02H ;; Max packect size (MSB)
db 00H ;; Polling interval

;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 86H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 00H ;; Maximun packet size (LSB)
db 02H ;; Max packect size (MSB)
db 00H ;; Polling interval

;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 88H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 00H ;; Maximun packet size (LSB)
db 02H ;; Max packect size (MSB)
db 00H ;; Polling interval

HighSpeedConfigDscrEnd:

FullSpeedConfigDscr:
db DSCR_CONFIG_LEN ;; Descriptor length
db DSCR_CONFIG ;; Descriptor type
db (FullSpeedConfigDscrEnd-FullSpeedConfigDscr) mod 256 ;; Total Length (LSB)
db (FullSpeedConfigDscrEnd-FullSpeedConfigDscr) / 256 ;; Total Length (MSB)
db 1 ;; Number of interfaces
db 1 ;; Configuration number
db 0 ;; Configuration string
db 10000000b ;; Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
db 50 ;; Power requirement (div 2 ma)

;; Interface Descriptor
db DSCR_INTRFC_LEN ;; Descriptor length
db DSCR_INTRFC ;; Descriptor type
db 0 ;; Zero-based index of this interface
db 0 ;; Alternate setting
db 4 ;; Number of end points
db 0ffH ;; Interface class
db 00H ;; Interface sub class
db 00H ;; Interface sub sub class
db 0 ;; Interface descriptor string index

;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 02H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 40H ;; Maximun packet size (LSB)
db 00H ;; Max packect size (MSB)
db 00H ;; Polling interval

;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 04H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 40H ;; Maximun packet size (LSB)
db 00H ;; Max packect size (MSB)
db 00H ;; Polling interval

;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 86H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 40H ;; Maximun packet size (LSB)
db 00H ;; Max packect size (MSB)
db 00H ;; Polling interval

;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 88H ;; Endpoint number, and direction
db ET_BULK ;; Endpoint type
db 40H ;; Maximun packet size (LSB)
db 00H ;; Max packect size (MSB)
db 00H ;; Polling interval

FullSpeedConfigDscrEnd:

StringDscr:

StringDscr0:
db StringDscr0End-StringDscr0 ;; String descriptor length
db DSCR_STRING
db 09H,04H
StringDscr0End:

StringDscr1:
db StringDscr1End-StringDscr1 ;; String descriptor length
db DSCR_STRING
db 'C',00
db 'y',00
db 'p',00
db 'r',00
db 'e',00
db 's',00
db 's',00
StringDscr1End:

StringDscr2:
db StringDscr2End-StringDscr2 ;; Descriptor length
db DSCR_STRING
db 'E',00
db 'Z',00
db '-',00
db 'U',00
db 'S',00
db 'B',00
StringDscr2End:

UserDscr:
dw 0000H
end

 



Re: How to configure endpoints from PRIPH.C

PRJI posted on 06 Sep 2011 11:01 PM PST
Cypress Employee
333 Forum Posts

Hi,

        Try out with the attached code.

Regards,

Prajith



Re: How to configure endpoints from PRIPH.C

ragers posted on 06 Sep 2011 11:20 PM PST
Top Contributor
25 Forum Posts

thanks

solved 






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20