-
Notifications
You must be signed in to change notification settings - Fork 554
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
KakuteF7 board support #138
Conversation
According to the datasheet only PA9 can be used for VBUS sensing on the OTG peripheral. If any other pin is used, we need to disable VBUS sensing but can still use the pin for fast boot detection (gpio input).
b70ff10
to
eccf9eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkueng - ST has multiple versions of USB OTG IP. The incorporation is based on release timeline not family. Please verify the USB IP on the supported Soc and insure we are not changing undefined bits.
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_GPIOAEN); | ||
# if defined(USE_VBUS_PULL_DOWN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed on HW with interface issues raising VBUS above threshold do to leakage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it because no board was using it. Do you want to keep it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it is used out of tree
stm32/cdcacm.c
Outdated
@@ -316,6 +323,9 @@ usb_cinit(void) | |||
|
|||
#if defined(BOARD_USB_VBUS_SENSE_DISABLED) | |||
OTG_FS_GCCFG |= OTG_GCCFG_NOVBUSSENS; | |||
|
|||
/* Force valid B-peripheral session */ | |||
OTG_FS_GOTGCTL |= OTG_GOTGCTL_BVALOEN | OTG_GOTGCTL_BVALOVAL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to update comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I found it, we can check for OTG_FS_CID >= 0x00002000
.
@@ -316,6 +323,12 @@ usb_cinit(void) | |||
|
|||
#if defined(BOARD_USB_VBUS_SENSE_DISABLED) | |||
OTG_FS_GCCFG |= OTG_GCCFG_NOVBUSSENS; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkueng Please see line 64 and use the same pattern to document the IP change and test for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
…_DISABLED Required for example on STM32F745 boards.
@@ -316,6 +323,12 @@ usb_cinit(void) | |||
|
|||
#if defined(BOARD_USB_VBUS_SENSE_DISABLED) | |||
OTG_FS_GCCFG |= OTG_GCCFG_NOVBUSSENS; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
Great, let's merge then! Thanks @davids5 |
@bkueng and @davids5 the change to board_types.txt should not have gone in. The layout for this bootloader was defined by the ardupilot bootloader in this case, and it started in the ardupilot bootloader. |
@tridge - Not having any procedural information in the file, nor knowing what you expect from the file. I would not know what was correct or incorrect. I look at this as a reservation system for code points. Is it more than that? From my perspective for this to be useful and serve that purpose the correct approach would be 3 columns in sorted order by code point. |code point | PX4 ID | AP ID| Freedom to add a row with a Col 1 and Col 2 or/and Col 3 would make sense. What am I missing? |
Yes it should be a single table sorted by id. We can preserve the separate identifiers if people actually care, but given they don't seem to be consumed directly in any project why don't we just keep it simple? |
I wasn't aware of such a convention either. A single list would IMO make more sense as well. |
@davids5 yes, it is a reservation system. And by adding AP_HW_KAKUTEF7 I was reserving that ID. Implicit in that is the particular layout of flash for that board. This PR took that reservation and grabbed it for px4.
It is in principle a good thing for the px4 and ardupilot bootloader to use common IDs for the same board where possible so that vendors can ship with one bootloader that supports both, but that only works if the above info lines up. |
@tridge There doesn't need to be a PX4 section and an Ardupilot section. A list of IDs (even including layout) can be shared. I don't think centralizing the layout is going to cause any real problems and it's certainly better than unnecessarily bifurcating. If you would like to move forward collaboratively I will make sure these PRs are merged immediately. If there are cases that truly can't be reconciled we can carry alternate IDs, but it's not too late to prevent the mess from getting worse. |
I chose the same values, which is why I moved it in the first place. The intention was to stay compatible, not to grab ID's. |
This adds support for the Holybro KakuteF7 board.
There are 2*32KB sectors reserved for parameters - I used 2 to stay compatible with ArduPilot's configuration.
VBUS sensing
Looking through the datasheet, only PA9 can be used for VBUS sensing. If another pin is assigned (which is the case for KakuteF7), we can still use it for fast-boot detection. I did some changes to account for that in general. In case of disabled VBUS sensing, we need to force valid B-peripheral session, otherwise the USB device will not show up.
I think we could generally just disable VBUS sensing (but still use the pin for fast-boot detection). On the Firmware/NuttX we have it disabled as well.
The only other boards affected by this are OmnibusF4SD and Crazyflie. I cross-tested on Omnibus.