ARMmbed / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
4.68k stars 2.98k forks source link

USB CDC/MSD on STM32F429 Discovery Board #13153

Closed narinaviation closed 4 years ago

narinaviation commented 4 years ago

Description of defect

Hello, I'm trying to use the STM32F429 Discovery Board With USB CDC/USB MSD feature, Like when It works perfectly on my FRDM-K64F. I have tried the example codes from https://os.mbed.com/docs/mbed-os/v6.0/apis/usbcdc.html and https://os.mbed.com/docs/mbed-os/v6.0/apis/usbmsd.html It then compiles without any error, and started to run. BUT!!! When I plug the Micro USB cable to the USB USER port on the other side of the board. There is nothing happened. No "Found new hardware", No device connected sound. and the device does not appear in the "Device Manager" (The Windows can't detect it) Suddenly, I found that the Green LED on PG13 was blinking without any code to do it. So, I try to do the debugging. And I see that it goes into the mbed_die() function. Anyway, When I use STM32CubeMX + MDK-ARM v5.27 to create the USB CDC Application. The device is detected and worked correctly!!! So I can confirm that it is not a hardware issues.

Target(s) affected by this defect ?

The target board is STM32F429-DISCO (Haven't tried it on STM32F429-DISC1 yet)

Toolchain(s) (name and version) displaying this defect ?

Mbed Studio 1.0.0

What version of Mbed-os are you using (tag or sha) ?

I've tested it on both the mbed-os-5.15.4 and mbed-os-6.0.0

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

both on Mbed Online Compiler and Mbed Studio 1.0.0

ciarmcom commented 4 years ago

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers. Internal Jira reference: https://jira.arm.com/browse/MBOTRIAGE-2726

0xc0170 commented 4 years ago

@narinaviation Please keep the issue template with the information

cc @ARMmbed/team-st-mcd

narinaviation commented 4 years ago

@narinaviation Please keep the issue template with the information

cc @ARMmbed/team-st-mcd

I'm very sorry, I've updated it now.

narinaviation commented 4 years ago

Here, I come to supply more details about the error message found in serial monitor.

++ MbedOS Fault Handler ++

FaultType: HardFault

Context:
R0: 0
R1: 0
R2: 80003CC
R3: 0
R4: 200006E0
R5: 0
R6: 200006BC
R7: 80
R8: 1
R9: 20001C18
R10: 0
R11: 0
R12: 0
SP   : 20001478
LR   : 8001FBD
PC   : 8003F7A
xPSR : 61000000
PSP  : 20001410
MSP  : 2002FFD0
CPUID: 410FC241
HFSR : 40000000
MMFSR: 82
BFSR : 0
UFSR : 0
DFSR : 0
AFSR : 0
MMFAR: 8
Mode : Thread
Priv : Privileged
Stack: PSP

-- MbedOS Fault Handler --

++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x8003F7A
Error Value: 0x20001CB0
Current Thread: main Id: 0x2000209C Entry: 0x800F18D StackSize: 0x1000 StackMem: 0x20000AF0 SP: 0x20001478 
For more info, visit: https://mbed.com/s/error?error=0x80FF013D&tgt=DISCO_F429ZI
-- MbedOS Error Info --
jeromecoutant commented 4 years ago

Current default DISCO_F429ZI configuration doesn't support USB_DEVICE. Any help to support USB is welcome. Starting point is to add "USBDEVICE" in "device_has_add" in targets.json file

narinaviation commented 4 years ago

@jeromecoutant I've tried adding the "USBDEVICE" in the "device_has_add" section of the targets.json file The result is still the same, then i try and into the mbed_app.json file, like this...

{
    "target_overrides" : {
        "*" : {
            "target.device_has_add" : ["USBDEVICE"]
        }
    }
}

Still not working, With the same error code 0x80FF013D. Could you please let me know some working case configuration of the USBDEVICE on STM32F429-DISCO? please.

0xc0170 commented 4 years ago

As mentioned by @jeromecoutant , the target does not support USB_DEVICE. Thus if you enable it, it might fail. More work is needed, to fix outstanding issues you are seeing. The starting point would be what triggers hardfault and fix the rootcause.

jeromecoutant commented 4 years ago

More work is needed, to fix outstanding issues you are seeing.

Yes... I can share my dev branch as a starting point : https://github.com/jeromecoutant/mbed/tree/DEV_STM32_USB

0xc0170 commented 4 years ago

I'll close this issue , we can keep the discussion ongoing or move rather to a forum for this type of request.