2014-02-18 05:56 PM
Hi,i want to make a f4 USB driver and i got a problem that when i run my program the computer can identify the USB device but cant transfer data between it, i try to trace the program and found the interrupte(DCD_HandleOutEP_ISR and DCD_HandleInEP_ISR) didn't trigger all my program is based on VCP example, the example works totally fine so i need some help
the attached file is my program and usb driver for it2014-02-19 01:20 AM
Hi
''the attached file is my program and usb driver for it'' I do not have time to unrar and look at your files. ''found the interrupte(DCD_HandleOutEP_ISR and DCD_HandleInEP_ISR) didn't trigger all my program is based on VCP example, the example works totally fine so i need some help'' The example program works. If the IRQ is not triggering - then you have modified something wrong. The only thing you have to do to get the CDC/VCP example doing something different is to modify the code in usbd_cdc_vcp.c Everything else should be left alone. The tricky part is understanding the use of APP_Rx_Buffer[] and APP_Rx_ptr_in which are actually used for sending data to the host through USB. The example also uses it for recieving text but I would create a seperate buffer for that. The APP_Rx_Buffer buffer and the ptr are used as a ring buffer which increments and wraps. Im still trying to fathom how the next layer determines when the buffer is used/full and needs emptying.2014-02-19 01:56 AM
thanks your help, im trying to compare the progress different between my program and VCP, i found i can trigger tx interrupt but it didnt run if(diepint.b.xfercompl) part that i cant see any actions on bushound orher tools
2014-02-19 02:15 AM
Hi
'' im trying to compare the progress different between my program and VCP'' If you have re-written the USB stack - I am unable to give you much help. I only know about how to use the existing USB stack provided by ST. The only part of the USB stack that needs to be modified is in file : usbd_cdc_vcp.c for a USB CDC device2014-02-19 04:42 PM
Sorry i didn't explained it. i defined it as vendor specific device not the CDC device.
So far i just modify usbd_cdc_core.c and usbd_desc.c part to change the descriptor to vendor specific, class callback function to delete SOF,EP0_RxReady and modify init and Deinit function, i think i need to change something more but i cant figure out what things and how2014-02-20 01:08 AM
''i defined it as vendor specific device not the CDC device.''
If you do that, then you will have to a) define and create drivers on the host to handle your 'new' device. b) write installation scripts for this new driver. Stick with the CDC class if you are new to USB. ''So far i just modify usbd_cdc_core.c'' I recommend you do not modify this file. This is the core implementation for a CDC device. The file you should be editing is usbd_cdc_vcp.c ''So far i just modify usbd_cdc_core.c and usbd_desc.c part to change the descriptor to vendor specific, class callback function to delete SOF,EP0_RxReady and modify init and Deinit function, i think i need to change something more but i cant figure out what things and how'' How many times do I have to say this - just modify usbd_cdc_vcp.c If you are new to USB just learn the basics first - just modify the minimum to get a USB device up and running. Just modify usbd_cdc_vcp.c Learn to walk before you try and run!2014-02-20 08:01 PM
Hi, followe what u said, i changed class back to CDC, read data works fine but send data still got problem。
when i use VCP_DataTx or use DCD_EP_Tx function without SOF, there no data send into PC and program very frequently run into DCD_HandleInEP_ISR and did nothing.i changed VCP example with my USB driver(made by libusb) same problem occur so what should i do? i think it may protocol error or something but i dont figure how to fix2014-02-21 01:12 AM
''followe what u said, i changed class back to CDC, read data works fine but send data still got problem。''
VCP_DataTx() - this does not appear to get called - do not know why. ''or use DCD_EP_Tx function'' - do not need to call it directly. To get data to be sent (device to Host) - use USBDataTx() - do not change it. I am not very happy with the way it works because from what I can see there is no way for it to detect buffer overwrite/overflow but it seems to work.2014-02-27 09:34 PM
Hi sung, i followed you said and almost fix everything but one problem still here: i got 4eps 2out 2in, one in_ep didn't work but all other 3 work fine, the in_ep get same setting and config(of course address is different) with another in_ep, i'm working on it too much time and still get no idea with it, please give me some help.
the program attached ________________ Attachments : stm32f407bsptestusb.rar : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1El&d=%2Fa%2F0X0000000bkC%2F4liHJFyOtPzW241jMXW1kJi3qQBSjWzYz6fXT7mH5m4&asPdf=false2014-02-28 01:19 AM
Hi
''i'm working on it too much time and still get no idea with it, please give me some help. the program attached'' I am sorry but I do not have time to read and fix your program, I have a job of my own to do. ''i got 4eps 2out 2in, one in_ep didn't work but all other 3 work fine,'' What exactly is the problem? (I found that I did not need to worry about the lower layers of the USB stack, I did not need to look at what the EndPoints are doing)