Autor Tema: DUDAS CON ENDPOINT EN EL PIC18F4550 + C#  (Leído 2544 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado washi_w_z_r

  • PIC10
  • *
  • Mensajes: 20
DUDAS CON ENDPOINT EN EL PIC18F4550 + C#
« en: 28 de Abril de 2009, 11:56:00 »
Hola amigos : una consulta , cuando adquirí datos por un canal con el pic18f4550 y lo envie a la PC mediante el USB con un solo endpoint, no tengo ningun problema con los datos y los visualizo en c#, pero cuando implemento los cinco canales necesarios para mi proyecto la transmicion es muy lenta o caso contrario no envia datos y todos son ceros .

Asi que pense uhm  8) , "por que no implementar con mas endpoint y reducir tiempos" , asi que observe el archivo picusb.h donde el endpoint 1 esta definido de la siguiente manera:
Código: [Seleccionar]
//endpoint descriptor
         USB_DESC_ENDPOINT_LEN, //length of descriptor
         USB_DESC_ENDPOINT_TYPE,     //constant ENDPOINT (0x05)
         0x81,              //endpoint number and direction (0x81 = EP1 IN)
         0x02,              //transfer type supported (0 is control, 1 is iso, 2 is bulk, 3 is interrupt)
         USB_EP1_TX_SIZE,0x00,         //maximum packet size supported
         0x01,              //polling interval in ms. (for interrupt transfers ONLY)

   //endpoint descriptor
         USB_DESC_ENDPOINT_LEN, //length of descriptor
         USB_DESC_ENDPOINT_TYPE,     //constant ENDPOINT (0x05)
         0x01,              //endpoint number and direction (0x01 = EP1 OUT)
         0x02,              //transfer type supported (0 is control, 1 is iso, 2 is bulk, 3 is interrupt)
         USB_EP1_RX_SIZE,0x00,         //maximum packet size supported
         0x01,              //polling interval in ms. (for interrupt transfers ONLY)

Uhmm, asi que pense en expandir mas endpoints , con elsiguiente cod en el archivo .h:
Código: C#
  1. //*******************************************************************//
  2.     //endpoint descriptor
  3.          USB_DESC_ENDPOINT_LEN, //length of descriptor
  4.          USB_DESC_ENDPOINT_TYPE,     //constant ENDPOINT (0x05)
  5.          0x82,              //endpoint number and direction (0x82 = EP1 IN)
  6.          0x02,              //transfer type supported (0 is control, 1 is iso, 2 is bulk, 3 is interrupt)
  7.          USB_EP2_TX_SIZE,0x00,         //maximum packet size supported
  8.          0x01,              //polling interval in ms. (for interrupt transfers ONLY)
  9.  
  10.    //endpoint descriptor
  11.          USB_DESC_ENDPOINT_LEN, //length of descriptor
  12.          USB_DESC_ENDPOINT_TYPE,     //constant ENDPOINT (0x05)
  13.          0x02,              //endpoint number and direction (0x02 = EP1 OUT)
  14.          0x02,              //transfer type supported (0 is control, 1 is iso, 2 is bulk, 3 is interrupt)
  15.          USB_EP2_RX_SIZE,0x00,         //maximum packet size supported
  16.          0x01,
  17.  //**********************************************************************//
  18.     //endpoint descriptor
  19.          USB_DESC_ENDPOINT_LEN, //length of descriptor
  20.          USB_DESC_ENDPOINT_TYPE,     //constant ENDPOINT (0x05)
  21.          0x83,              //endpoint number and direction (0x83 = EP1 IN)
  22.          0x02,              //transfer type supported (0 is control, 1 is iso, 2 is bulk, 3 is interrupt)
  23.          USB_EP3_TX_SIZE,0x00,         //maximum packet size supported
  24.          0x01,              //polling interval in ms. (for interrupt transfers ONLY)
  25.  
  26.    //endpoint descriptor
  27.          USB_DESC_ENDPOINT_LEN, //length of descriptor
  28.          USB_DESC_ENDPOINT_TYPE,     //constant ENDPOINT (0x05)
  29.          0x03,              //endpoint number and direction (0x03 = EP1 OUT)
  30.          0x02,              //transfer type supported (0 is control, 1 is iso, 2 is bulk, 3 is interrupt)
  31.          USB_EP3_RX_SIZE,0x00,         //maximum packet size supported
  32.          0x01,
  33.  //********************************************************************//
  34.     //endpoint descriptor
  35.          USB_DESC_ENDPOINT_LEN, //length of descriptor
  36.          USB_DESC_ENDPOINT_TYPE,     //constant ENDPOINT (0x05)
  37.          0x84,              //endpoint number and direction (0x84 = EP1 IN)
  38.          0x02,              //transfer type supported (0 is control, 1 is iso, 2 is bulk, 3 is interrupt)
  39.          USB_EP4_TX_SIZE,0x00,         //maximum packet size supported
  40.          0x01,              //polling interval in ms. (for interrupt transfers ONLY)
  41.  
  42.    //endpoint descriptor
  43.          USB_DESC_ENDPOINT_LEN, //length of descriptor
  44.          USB_DESC_ENDPOINT_TYPE,     //constant ENDPOINT (0x05)
  45.          0x04,              //endpoint number and direction (0x04 = EP1 OUT)
  46.          0x02,              //transfer type supported (0 is control, 1 is iso, 2 is bulk, 3 is interrupt)
  47.          USB_EP4_RX_SIZE,0x00,         //maximum packet size supported
  48.          0x01,
  49.  //*********************************************************************//
  50.     //endpoint descriptor
  51.          USB_DESC_ENDPOINT_LEN, //length of descriptor
  52.          USB_DESC_ENDPOINT_TYPE,     //constant ENDPOINT (0x05)
  53.          0x85,              //endpoint number and direction (0x85 = EP1 IN)
  54.          0x02,              //transfer type supported (0 is control, 1 is iso, 2 is bulk, 3 is interrupt)
  55.          USB_EP5_TX_SIZE,0x00,         //maximum packet size supported
  56.          0x01,              //polling interval in ms. (for interrupt transfers ONLY)
  57.  
  58.    //endpoint descriptor
  59.          USB_DESC_ENDPOINT_LEN, //length of descriptor
  60.          USB_DESC_ENDPOINT_TYPE,     //constant ENDPOINT (0x05)
  61.          0x05,              //endpoint number and direction (0x05 = EP1 OUT)
  62.          0x02,              //transfer type supported (0 is control, 1 is iso, 2 is bulk, 3 is interrupt)
  63.          USB_EP5_RX_SIZE,0x00,         //maximum packet size supported
  64.          0x01,

No me dio nungun problema al compilar , por cierto tambien se modifica lo siguiente
 #DEFINE USB_TOTAL_CONFIG_LEN    88//config+interface+class+endpoint

El numero 88 es claramente por la cantidad de configuraciones , interfaces , clases y endpoint definidos dentro de la clase  char const USB_CONFIG_DESC[] , pero oh sorpresa  :8} al momento de conectar ala pc NO ME RECONOCE EL DISPOSITIVO Y ME ENVIA ERROR [10] , pense que era el vip y pid , al cambiarlo no paso nada, volvi al archivo .h y deshice lo que agrege y volvio a conectar ala PC.

¿Ustedes creen que no se puede configurar mas de 1 endpoint?  , saludos a todos  :-)

Desconectado morpheusoliver

  • PIC10
  • *
  • Mensajes: 19
Re: DUDAS CON ENDPOINT EN EL PIC18F4550 + C#
« Respuesta #1 en: 30 de Noviembre de 2009, 17:12:27 »
tengo exactamente el msimo problema  :( :( :( :(

he buscado por todo el foro y no encuentro informacion para abrir dos pipes...
utilizo VB 6.0 y la api MPUSBAPI.DLL, si es encesario posteo el codigo, pero es igual que el del compañero...


saludos!

Desconectado Modulay

  • Moderadores
  • DsPIC30
  • *****
  • Mensajes: 2651
Re: DUDAS CON ENDPOINT EN EL PIC18F4550 + C#
« Respuesta #2 en: 30 de Noviembre de 2009, 20:11:13 »
Tienes que modificar también el descriptor de interfaz, en el cual se especifica el número de endpoints que usa la interfaz, si no recuerdo mal.
Y aparte, en el descriptor de configuración hay que modificar el parámetro que especifica el tamaño total de los descriptores...como has añadido cosas, dicho tamaño ha aumentado...
Pon todos los descriptores y vemos a ver qué falta

Desconectado Modulay

  • Moderadores
  • DsPIC30
  • *****
  • Mensajes: 2651
Re: DUDAS CON ENDPOINT EN EL PIC18F4550 + C#
« Respuesta #3 en: 30 de Noviembre de 2009, 20:22:44 »
Ahora veo que ya tuviste en cuenta el tamaño de los descriptores, aunque puede darse el caso de que compile y ese parámetro no esté bien configurado, dependiendo de qué cambios hayas hecho.

Postea el contenido de picusb.h entero a ver


 

anything