Hi,
I m writing the driver for the usb modem. It uses CDC settings for the driver. I am able to attach the device. Get the configuration & interface descriptors. But when i go for endpoint descriptors, it gives me error ‘memory fault [core dumped]’. or when i try usin the usbd_parse_descriptors for the endpoint descriptors, it doesnt get the descriptors at al, instead nothing in the for looop is printed. So can anyone please suggest how the pipes are established between a CDC device & usb host. And wats the *node & *root significance used in usbd_parse_descriptors()?Are there any other attributes which can be used to open pipe instead of bmAttributes in endpoint?
My for loop is as follows:
for (i=0; (ddesc = usbd_parse_descriptors(device,root,USB_DESC_ENDPOINT,i,node ))!= NULL ; ++i)
{
printf("packet size: %d\n",ddesc->endpoint.wMaxPacketSize);
printf("attribute: %d\n",ddesc->endpoint.bmAttributes);
printf("address: %d\n",ddesc->endpoint.bEndpointAddress);
switch(ddesc->endpoint.bmAttributes)
{
case USB_ATTRIB_CONTROL:
if ((usbd_open_pipe (device,ddesc,&control_pipe_out)) != EOK)
{
perror ("Could not open the CONTROL pipe \n");
exit (0);
}
else
{
printf("opened control pipe\n");
break;
}
case USB_ATTRIB_INTERRUPT:
if ((usbd_open_pipe (device,ddesc,&intr_pipe)) != EOK)
{
perror ("Could not open the interrupt pipe \n");
exit (0);
}
else
{
printf("opened interrupt pipe\n");
break;
}
case USB_ATTRIB_BULK:
if(ddesc->endpoint.bEndpointAddress & USB_ENDPOINT_IN )
{
printf("bulk in endpoint\n");
if ((usbd_open_pipe (device, ddesc, &data_pipe_in )) != EOK)
{
perror ("Could not open the in pipe \n");
exit (0);
//break;
}
else
{
printf("opened bulk in pipe\n");
break;
}
}
else if(ddesc->endpoint.bEndpointAddress & USB_ENDPOINT_OUT )
{
printf("bulk out endpoint\n");
if ((usbd_open_pipe (device,ddesc,&data_pipe_out)) != EOK)
{
perror ("Could not open the out pipe \n");
exit (0);
}
else
{
printf("opened bulk out pipe\n");
break;
}
}
default:
printf("pipes not opened as configurations did not match\n");
}
}