Hi to all, I am new in keil v5 and i want to implement usb ufi class mass storage under cbi protocol and i want use keil usb custom class in order to done that,but i do not know how i can use keil custom class and port it to my MCB17000 board and after searching in internet i do not find anything about that. Can any one me how can i create and config project with keil usb custom class??
in the following of my previous post i seen that after receiving last setup packet that contain a request with brequest=0x09(Set configuration request), USBD_Device0_Endpoint0_SetupPacketProcessed function that must be called after processing this request dose not call in the even that for previous request this function triggered.
excuse for continuous posts, but in following my previous post i added below code to USBD_Device0_Endpoint0_SetupPacketReceived function:
switch (setup_packet->bmRequestType.Type) { case USB_REQUEST_STANDARD: if(setup_packet->bRequest == 0x09) { return usbdRequestOK; handle_request = true; } break; case USB_REQUEST_CLASS: if(setup_packet->bmRequestType.Type == 0x01) return usbdRequestNotProcessed; break; case USB_REQUEST_VENDOR: if(setup_packet->bmRequestType.Type == 0x01) return usbdRequestNotProcessed; break; case USB_REQUEST_RESERVED: if(setup_packet->bmRequestType.Type == 0x01) return usbdRequestNotProcessed; break; } return usbdRequestNotProcessed;
as you can see if SetConfiguration request received, i will return usbdRequestOK code without handling it and in this manner communication despite to previous state with host will continue and host send another setup packet as below :
setup packet 8 : brequest=0x00 :mean Get Status Request
but because i didn't really handle it host in following request ask me to done it again. what is your opinion, problem is os configuration such as stack and others???
Well, you should try to first understand things before implementing functionality as otherwise you are only guessing and using trial and error mechanism.
Anyways, if you defined all configuration paramaters for your device then when SetConfiguration request is received by USB stack it will configure and start all endpoints that device uses. In case that you are doing what you are doing, USB stack will not configure any endpoints nor start any communication, and you say you do not handle that request but return usbdRequestOK, so it can not work that way.
SetConfiguration request is very important if you do want to override default functionality of the USB stack you should know much more of what you need to do, but I do not see much reason why you would override SetConfiguration request, you can catch it to know when USB Host has requested that your device is configured but you should leave processing to USB stack.
as i said i want to implement ufi spec under cbi communication protocol so i need 4 endpoint as below :
endpoint 0 : default control endpoint endpoint 1 : bulk in and out endpoint endpoint 2 : interrupt endpoint
i add these endpoints to USBD_Config_CustomClass_0.h as i need, but when leaving processing of SetConfiguration command to usb_stack it fail to handle it, i say this because after receiving this command and i return usbdRequestNotProcessed, usb_stack do not call USBD_Device0_Endpoint0_SetupPacketProcessed function that must call after processing received command. also after leaving this command to usb_stack i dose not receive any setup packet in USBD_Device0_Endpoint0_SetupPacketReceived function. now i am searching for solution for this problem.
I can already point one problem if you setup your endpoints as described, by documentation LPC17xx microcontroller has specific endpoint types for specific endpoint numbers for example endpoint 1 can not be of bulk type but only interrupt, and endpoint 2 can only be of bulk type. So, I first suggest you reverse to use endpoint 2 as bulk, and endpoint 1 as interrupt.
you are my best man Milorad, it worked and my problem was that you point. because i was in hurry to done this project i didn't read lpc17xx datasheet. thanks again.
Ignoring the data sheets seldom speeds up the progress.