Skip to content

STM32: Add STM32F4Discovery support #2570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Feb 11, 2020
Merged

STM32: Add STM32F4Discovery support #2570

merged 20 commits into from
Feb 11, 2020

Conversation

hierophect
Copy link
Collaborator

@hierophect hierophect commented Jan 31, 2020

This PR adds support to the STM32F4 Discovery board (a bit confusingly named, possibly because it was the first Discovery?). This board runs an STM32F407VG MCU with 1MB of flash and 192K of SRAM, and has a nearly identical pin layout to the STM32F411 Discovery board (this board adds the PB11 pin to replace an NC pin). Requires #2568 for some linker stuff.

Todos for this PR:

I'm not sure what the USB issue is - possibly a lack of Tusb support for the F407?

@hierophect hierophect requested a review from tannewt January 31, 2020 22:30
@hierophect hierophect changed the title STM32 - Add STM32F4Discovery support STM32: Add STM32F4Discovery support Jan 31, 2020
@hierophect hierophect added the stm label Jan 31, 2020
@hathach
Copy link
Member

hathach commented Feb 1, 2020

maybe we can call it STM32F407 Discovery although its official name is only STM32F4 Discovery . TinyUSB does support f407, in fact this is one of the first board I used to tested with STM32 port, here is its BSP
https://github.com/hathach/tinyusb/tree/master/hw/bsp/stm32f407disco

However, F407 USB FS only has 4 pairs of endpoints, including control endpoints. Which means we can only have CDC ( 2 IN + 1 OUT) and MSC ( 1 IN + 1 OUT) only. Could you skip the hid, midi to see if that work. Else I will try to help troubleshoot this issue on Monday,

@hierophect
Copy link
Collaborator Author

@hathach Thanks for the info - this build is already only using CDC and MSC as per mpconfigboard.mk, so I don't believe that's it.

One of the lines returned by the debugger is this:
tud_cdc_n_connected (itf=itf@entry=0 '\000') at ../../lib/tinyusb/src/device/usbd.h:62. Wondering if that 0 parameter is problematic?

@tannewt
Copy link
Member

tannewt commented Feb 4, 2020

Here are IDs:

STM32F407 Discovery VID 0x239A    PID 0x0089  # bootloader
                                  PID 0x8089  # arduino
                                  PID 0x808A  # circuitpython

@tannewt
Copy link
Member

tannewt commented Feb 4, 2020

maybe we can call it STM32F407 Discovery although its official name is only STM32F4 Discovery . TinyUSB does support f407, in fact this is one of the first board I used to tested with STM32 port, here is its BSP
https://github.com/hathach/tinyusb/tree/master/hw/bsp/stm32f407disco

My preference is to follow the official name even though it is ambiguous.

@hierophect Please add the new board to the board list to fix the test.

@hierophect
Copy link
Collaborator Author

@hathach the _usbd_dev object is empty - where should I poke around to try and find the root cause of that?

p _usbd_dev
$2 = {{connected = 0 '\000', configured = 0 '\000', suspended = 0 '\000', remote_wakeup_en = 0 '\000', remote_wakeup_support = 0 '\000', self_powered = 0 '\000'}, itf2drv = '\377' <repeats 16 times>, 
  ep2drv = {"\377\377", "\377\377", "\377\377", "\377\377", "\377\377", "\377\377", "\377\377", "\377\377"}, ep_status = {{{busy = false, stalled = false}, {busy = false, stalled = false}}, {{
        busy = false, stalled = false}, {busy = false, stalled = false}}, {{busy = false, stalled = false}, {busy = false, stalled = false}}, {{busy = false, stalled = false}, {busy = false, 
        stalled = false}}, {{busy = false, stalled = false}, {busy = false, stalled = false}}, {{busy = false, stalled = false}, {busy = false, stalled = false}}, {{busy = false, stalled = false}, {
        busy = false, stalled = false}}, {{busy = false, stalled = false}, {busy = false, stalled = false}}}}

@hierophect
Copy link
Collaborator Author

I'm now getting this same issue on the Espruino, but it doesn't occur on fresh feather builds, so I'm really puzzled as to what's up.

@hierophect
Copy link
Collaborator Author

Found it, was just an oscillator oversight. Sorry for the trouble.

@hierophect
Copy link
Collaborator Author

@tannewt this is tested and ready for review.

@hierophect
Copy link
Collaborator Author

@tannewt ping: ready for re-review

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you!

@tannewt tannewt merged commit 8364c60 into adafruit:master Feb 11, 2020
@hierophect hierophect deleted the stm32-f407-disco branch February 29, 2020 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants