cancel
Showing results for 
Search instead for 
Did you mean: 

USb OTG FS Device Mode with STM32F412/411

Nalika Dona
Associate II
Posted on February 09, 2017 at 03:07

Hi all,

I am currently trying to get USB OTG FS working with STM32F412/411 MCUs in device mode but unfortunately the PC doesn't recognize the device. Cannot figure out if it is a hardware or software problem because I do not have a proper code which is proven to be working on STM32F412/411. STMCubeMx generated code for USB_FS_OTG_Device mode also doesn't work for any of STM32 MCUs (tested on STM32F429IIT6, STM32F412/411). I do have a working application for STM32F429IIT6 in USB_OTG_HS_Device mode but this code doesn't work for STM32F412/411 after modifications to USB pins and clocks even though the USB OTG circuit is similar in both cases. The USB Analyzer shows that the device doesn't respond to the packets sent by the Host. Please find attached the USB analyzer screenshots of working USB device on STM32F429IIT6 and not-working USB device on STM32F412. Could someone share a working USB OTG FS Device mode code for STM32F412/411 please or anyone who had the same problem and found a solution please share your ideas. Thanks!

13 REPLIES 13
shingadaddy
Senior
Posted on February 21, 2017 at 18:37

Limited time/resources here prevent me from loading up yet ANOTHER IDE (other than Truestudio - which there are NO PRE SUPPLIED examples for this F4 USB thing in a Truestudio project anyway - ) will limit my help to the following:

Well the only QUICK paths to supposedly workable 'example code' offerings are

CUBEMX  - Auto generate SOME level of functionality

or

CUBEF4 - precanned HID and MSC device examples in the Discovery F4 CubeF4 offering.

But I'm not familiar with their level of BUGGINESS.

As far as the CUBEF4 offering -

I realize you have your own board (Unknown feasibility / functionality level) and as a quick confidence test, you would be trying to run code on it, that is targeted toward a DISCOVERY board.You have no Discovery board but that's where the CUBEF4 examples want to run on. I make the ASSUMPTION that the DISCOVER F4 example code EXPECTS an LCD to be there. Your LED might blink but without finding all the LCD communication functionality that is EXPECTED by the CUBEF4 example code, and making sure it's commented out to keep it from putting on a parachute and bailing out of ALL the rest of the example code functionality - including some of the USB stuff -  your USB stuff may be non-functional at some level. And - THERE MAY BE MORE THAN JUST THAT which needs attention (commenting around/out) along with the LCD stuff. I mentioned the LCD before but you make no mention of how you might have approached that. In MAIN - I see you commented out     GetPointerData(HID_Buffer);

But this application example relies heavily on Interrupt routines so other calls to other LCD functions might be causing issues. I don't have time to look that deep.

An I/O expander derailed me on a different project that was similar to this while I was using precanned example programs that EXPECTED and I/O expander that I did not have on my PCB.

You make no mention of DEBUGGER so I ASSUME you have no way to use one. (STLINK)

AS far as CUBEMX -

Sorry your on your own there. No familiarity here what so ever.

Tuttle.Darrell
Associate II
Posted on February 21, 2017 at 20:00

How about trying System Memory Boot Mode (BOOT0 high) and seeing if the PC recognizes the ST DFU Bootloader? This should tell you if your hardware is working.

shingadaddy
Senior
Posted on February 21, 2017 at 20:19

Good one Tut. I hadn't looked to see if this part had DFU built in. I suspect it would mean you need to have the DFU driver from ST installed maybe. Then the PC should recognize it as a USB device in DFU mode.

And if that doesn't work right, the way things are around here with purchasing, receiving, inspection, kitting, assembing interactions, you might want to make sure R9 and 10 are REALLY the values that you REALLY wanted.

Also you might want to make sure R9 and 10 are really needed for this part. Variation of ST devices sort of mingle in and out of that need. Some are BUILT IN.

Posted on February 21, 2017 at 20:32

Even without the driver, if working it will show up in Device Manager as something like 'ST Micro DFU Bootloader', but it will not go into DFU mode without the driver so will not be recognizable by DfuSeDemo. And yes, the STM32F412 includes the FS DFU bootloader in system memory boot mode.