cherry-embedded / CherryUSB

CherryUSB is a tiny and portable USB Stack (device & host) for embedded system with USB IP
https://cherryusb.readthedocs.io/
Apache License 2.0
1.17k stars 249 forks source link

STM32F407 Problem #121

Closed AndyW999 closed 1 year ago

AndyW999 commented 1 year ago

I am using an STM32F407-Disco board using FS interface. I have done all as described in https://cherryusb.readthedocs.io/zh_CN/latest/quick_start/stm32.html I get the USB Serial Device enumerated in Win10 Device Manager but if I try to connect Putty to it I get 'Unable to open connection to COM3' 'Unable to configure serial port'

The STM32CubeIDE project is in Dropbox -

https://www.dropbox.com/scl/fo/ofwl3x4rvzbg2nj2xnqdy/h?rlkey=gdpsh40vuqq322hcixo89xakv&dl=0

Thanks

Andy.

sakumisu commented 1 year ago

Please check your printf, thanks, fputc is valid in keil not gcc.

sakumisu commented 1 year ago

It is not usb issue i think, please refer to my stm32 demo, and confirm your board is ok.

AndyW999 commented 1 year ago

I know ;)

I just copied it all.

From: sakumisu @. Sent: 25 July 2023 17:41 To: cherry-embedded/CherryUSB @.> Cc: AndyW999 @.>; Author @.> Subject: Re: [cherry-embedded/CherryUSB] STM32F407 Problem (Issue #121)

Please check your printf, thanks, fputc is valid in keil not gcc.

— Reply to this email directly, view it on GitHubhttps://github.com/cherry-embedded/CherryUSB/issues/121#issuecomment-1650081851, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABK5DZDRDPTBE57Y6CQ4K2DXR7SJ5ANCNFSM6AAAAAA2XAZRDU. You are receiving this because you authored the thread.Message ID: @.**@.>>

AndyW999 commented 1 year ago

If I use the normal STM32CubeIDE ioc set up and use their middleware to set it to CDC it works and I can connect Putty.

So the board is OK.

I am using the cdc_acm_template.c file from your demo directory.

Viewing the USB status using USBDeview it shows ST Class 02, Protocol 01 with Cherry Class 00 Protocol 00.

Please see attached files.

But as it is using your files I have no idea why.

CherryUSB - USBDeview STUSB - USBDeview

sakumisu commented 1 year ago

Please implment your printf, thanks, you do not implment this and COM3 is not cherryusb port.

sakumisu commented 1 year ago

Others i cannot help you, try by yourself, or use my demo.

sakumisu commented 1 year ago

https://github.com/CherryUSB/cherryusb_stm32

sakumisu commented 1 year ago

If you do not implment printf, please do not use cherryusb

AndyW999 commented 1 year ago

I have implemented printf and here are the results -

[I/USB] ========== dwc2 udc params ========== [I/USB] CID:00001200 [I/USB] GSNPSID:4f54281a [I/USB] GHWCFG1:00000000 [I/USB] GHWCFG2:229dcd20 [I/USB] GHWCFG3:020001e8 [I/USB] GHWCFG4:0ff08030 [I/USB] dwc2 fsphy type:1, hsphy type:0, dma support:0 [I/USB] dwc2 has 4 endpoints, default config: 4 endpoints [I/USB] ================================= [W/USB] Ignore DQD in fs [I/USB] Open ep:0x83 type:3 mps:8 [I/USB] Open ep:0x02 type:2 mps:64 [I/USB] Open ep:0x81 type:2 mps:64

sakumisu commented 1 year ago

It works ok, but why serial port doesnot work, i dont know, sorry.

AndyW999 commented 1 year ago

I have put in cdc_acm_data_send_with_dtr_test();

There is something not quite right here. In Device Manager -> USB Serial Device -> Events -> Information ->Device USB\VID_FFFF&PID_FFFF&MI_00\8&f52fcd3&0&0000 requires further installation.

When the USB device is first detected it does not have a COM number associated with it, this takes a while to be assigned.

I run Putty and after an indeterminate amount of time its window appears and shows what it should - 1234567890 and loads of 'a' characters.

And the Putty session connected to the board shows - actual in len:0 actual in len:2048

I am using up to date Win10 and my laptop shows the exact same results - Putty opening eventually.

AndyW999 commented 1 year ago

If you have the time and patience to work with me I would like to solve this.

My goal is to eventually get RNDIS host working to interface with the DMR radios we use.

I still think the problem is related to the earlier views I sent from USBDeview where the class and protocol are shown as 00

sakumisu commented 1 year ago

If it is class and protocol issue, do you think this issue can exist 2 years?

sakumisu commented 1 year ago

Please use my demo, thanks ,others i cannot help you.

AndyW999 commented 1 year ago

I am using the code from your demo and following the instructions you give to do it.

I had to generate my own project as I do not have an STM32f469 board, only an STM32F407 board.

I have set up a Win7 32 bit VM and it will not even load a driver.

I tried a ‘clean’ Win10 VM and it took a while to get a Com port number but Putty kept timing out.

I have re-uploaded the STM32CubeIDE zipped archive project to the same Dropbox as before –

https://www.dropbox.com/scl/fo/ofwl3x4rvzbg2nj2xnqdy/h?rlkey=gdpsh40vuqq322hcixo89xakv&dl=0

From: sakumisu @. Sent: 26 July 2023 11:14 To: cherry-embedded/CherryUSB @.> Cc: AndyW999 @.>; Author @.> Subject: Re: [cherry-embedded/CherryUSB] STM32F407 Problem (Issue #121)

Please use my demo, thanks ,others i cannot help you.

— Reply to this email directly, view it on GitHubhttps://github.com/cherry-embedded/CherryUSB/issues/121#issuecomment-1651315684, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABK5DZCSB27A4Q4M3MAHOHLXSDNT3ANCNFSM6AAAAAA2XAZRDU. You are receiving this because you authored the thread.Message ID: @.**@.>>

sakumisu commented 1 year ago

Solve it byyourself.

sakumisu commented 1 year ago

Are you a chinese? You can join the qq group to talk with it.

AndyW999 commented 1 year ago

I would solve it by myself, but USB and women are both a great mystery to me ;)

Am English - which is why I am writing at a strange time of day to you...

AndyW999 commented 1 year ago

I have now tried NUCLEO -F429ZI board using FS and it is the same.

Please could you tell me which drivers are used in Windows 10?

Mine uses C:|WINDOWS\system32\DRIVERS\usbser.sys and I do not know if this is correct.

sakumisu commented 1 year ago

I do not modify windows driver,if you cannot work, please choose other usb stack, i have asked others, they all work.

sakumisu commented 1 year ago

And my class code is 02 02 01, not 00 00 00,thanks

sakumisu commented 1 year ago

image

sakumisu commented 1 year ago

image

sakumisu commented 1 year ago

image

sakumisu commented 1 year ago

Nothing problem, sir, use USBDeview v3.06

sakumisu commented 1 year ago

And for stm32, they have their own windows driver, you can use other class like hid or msc. I doo not want to answer for this, it is an invalid time.

AndyW999 commented 1 year ago

Thanks for the screenshots!

This is really strange, I updated USBDview to 3.06, screenshot attached.

I did a driver update and put usbser.inf in it's own directory and told it to use it but it continues to use usb.inf.

Why do things like this always happen to me ;)

I have tried - STM32F407Disco with FS and HS Nucleo STM32F429ZIT6 with FS

I do not know what to do as my other Windows PC's do the same.

Thanks for helping me, I do appreciate it ;)

Screenshot (258)

AndyW999 commented 1 year ago

Is it possible for you to send me an STM32F407 working demo?

AndyW999 commented 1 year ago

And this is the output from UVCview.

UVCView-CherryUSB_CDC.txt

sakumisu commented 1 year ago

I donot want to talk about this. Thanks

sakumisu commented 1 year ago

And you do not use USBDview correctly, you should select COMX and device name is a serie number.

sakumisu commented 1 year ago

You driver letter is null but mine is COM58.

sakumisu commented 1 year ago

That's all, please check by yourself, if you think my descriptor is incorrect, you can copy st descriptor

sakumisu commented 1 year ago

OK, i know, you can change your vid and pid to other, not ffff, you can modfiy with 0xabcd and have a try.

sakumisu commented 1 year ago

Last, you should solve by yourself, you can use other pc with windows or linux to have a try, or stop using cherryusb.

sakumisu commented 1 year ago

It wastes me too much time.

AndyW999 commented 1 year ago

I know!

I have some STM32F103 boards soon, I will try it with them.

I know CherryUSB works but I wish it would for me.

Can you let me have a working set of source code that use have tried or even HEX code to program my STM32F407 board with?

I am sorry for wasting your time.

From: sakumisu @. Sent: 27 July 2023 11:28 To: cherry-embedded/CherryUSB @.> Cc: AndyW999 @.>; Author @.> Subject: Re: [cherry-embedded/CherryUSB] STM32F407 Problem (Issue #121)

It wastes me too much time.

— Reply to this email directly, view it on GitHubhttps://github.com/cherry-embedded/CherryUSB/issues/121#issuecomment-1653243772, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABK5DZD2BJOMZEOJNSXIGL3XSIYDXANCNFSM6AAAAAA2XAZRDU. You are receiving this because you authored the thread.Message ID: @.**@.>>

sakumisu commented 1 year ago

how about testing other class like msc or hid?dwc driver is ok i think, maybe some others like windows drivers have confused

AndyW999 commented 1 year ago

Windows confused? However could that happen ;)

Yes, trying other classes was next for me to try but I will try not to bother you…

I will wait until I get the F103 boards so I can try the fsdev driver instead.

From: sakumisu @. Sent: 27 July 2023 12:33 To: cherry-embedded/CherryUSB @.> Cc: AndyW999 @.>; Author @.> Subject: Re: [cherry-embedded/CherryUSB] STM32F407 Problem (Issue #121)

how about testing other class like msc or hid?dwc driver is ok i think, maybe some others like windows drivers have confused

— Reply to this email directly, view it on GitHubhttps://github.com/cherry-embedded/CherryUSB/issues/121#issuecomment-1653348474, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABK5DZGBYILZ5PPFEYH6TULXSI7WFANCNFSM6AAAAAA2XAZRDU. You are receiving this because you authored the thread.Message ID: @.**@.>>