How to configure endpoints from PRIPH.C

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi,

   

        Try out with the attached code.

   

Regards,

   

Prajith

View solution in original post

0 Likes
10 Replies
Anonymous
Not applicable

Hi,

   

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

   

Regards,

   

Prajith

0 Likes
Anonymous
Not applicable

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?

0 Likes
Anonymous
Not applicable

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

0 Likes
Anonymous
Not applicable

Hi,

   

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

   

Regards,

   

Prajith

0 Likes
Anonymous
Not applicable

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!!!

0 Likes
Anonymous
Not applicable
0 Likes
Anonymous
Not applicable

Hi,

   

        Your file has not been attached.

   

Regards

   

Prajith

0 Likes
Anonymous
Not applicable

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

 

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi,

   

        Try out with the attached code.

   

Regards,

   

Prajith

0 Likes
Anonymous
Not applicable

thanks

   

solved 

0 Likes