Skip to content
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

Added AnyLeaf H7 FC target #26021

Merged
merged 2 commits into from
Feb 1, 2024
Merged

Conversation

David-OConnor
Copy link
Contributor

LMK if anyone would like a sample.

Note: Currently the status LED is not working; LED on PC13, setup with this; the rest works.

# LED
PC13 LED1 OUTPUT LOW GPIO(91) # amber
define HAL_GPIO_A_LED_PIN 91

@David-OConnor David-OConnor changed the title Added AnyLeaf H7 Added AnyLeaf H7 FC target Jan 18, 2024
@Hwurzburg
Copy link
Collaborator

needs readme..see KakuteH7Wing for example format..do you have a link to photo/bd layout? the board ID is already assigned to PodMAN H7 is that you?if not get a separate PR in asap to reserve a new id in the board_types.txt file for this board
always good to send Tridge a sample and Andy Piper and sometimes me (especially if Plane is a target for the board)

@David-OConnor
Copy link
Contributor Author

David-OConnor commented Jan 18, 2024

PR in; ID changed here; pics attached. I'll reach out on Discord for mailing addresses. Stby for ReadMe.

Actually, would you prefer a DataSheet instead of a Readme? I already have one of this, and the info would be similar.

h7
h7_back

@David-OConnor
Copy link
Contributor Author

Readme added.


## Motor Output

8 Motor outputs are available, mapped to timer peripherals. Each is capable of bidirectional DSHOT,
Copy link
Collaborator

Choose a reason for hiding this comment

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

needs grouping info and which outputs are bidir dshot capable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is that? Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

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

look at KakuteH7Wing readme

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of note, I added to the readme details about how the motor pins are designed to be mapped to timers.

Copy link
Contributor Author

@David-OConnor David-OConnor Jan 18, 2024

Choose a reason for hiding this comment

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

It looks like the Kakute's readme uses the motor definition almost C+P from hwdef.dat. Given that it includes information that is not really relevant relevant to the hardware (PWM(x) and GPIO(y) are AP constructs, and are not directly related to the PCB), and the TIMx_CH7 TIMy is also not really readme material and repeats the tim numbers.

I'm happy to comply with however you would like, but that's my 2c.

Copy link
Collaborator

@Hwurzburg Hwurzburg Jan 18, 2024

Choose a reason for hiding this comment

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

I create the wiki page from the readme.....not the hwdef....thats one of the reason's why I am in the approval loop for new autopilot definitions....please use the correct format as it prevents me from re-reviewing the hwdef when time comes for me to make the wiki page for this autopilot

and all your outputs are NOT bi-diectional DShot capable...only 1-4 have that capability REQUESTED in the hwdef....and probably are not all have DMA assigned since they are not BIDIR tagged....and even if tagged, that they do get the assignment correctly when the build is configured, must be verified and that they are not shared channels...

Copy link
Contributor Author

@David-OConnor David-OConnor Jan 18, 2024

Choose a reason for hiding this comment

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

Sounds good; will make the change. How do I know which to tag as BIDIR? what is a shared channel?

Copy link
Collaborator

Choose a reason for hiding this comment

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

just get bootloader into PR, then we can do a test build and see how DMA is being allocated...it MAY be possible to have all outputs BIDIR ....maybe not...a shared DMA channel is just that...only one hdwr unit can make use of it at a time

# Onboard OSD
OSD_TYPE 5 # MSP
SERIAL2_PROTOCOL 42 # DisplayPort
MSP_OPTIONS 4 # Betaflight fonts; without it, many symbols are missing.
Copy link
Collaborator

Choose a reason for hiding this comment

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

this will cause issues with Walksnail and DJI WTFOS....should leave this at default I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can confirm that this is the correct setting for WTFOS, and O3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, I recognize that this is a subjective thing; for my own use case and the intended use case, it makes sense to set this default. For the general use case, it is better to leave these to the AP defaults. I think, based on the the fact that this FC has no analog OSD chip, and a DJI-format external port, it makes sense to have it set up by default for MSP Displayport OSD.

A relevant question, as you pointed out, is "Do HDZero and WalkSnail also use MSP DisplayPort (Like WTF OS and O3). I leave this to you or another AP maintainer to make the call; my vote is keep it set up for MSP Displayport like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

HD-Zero supports MSP-Displayport. For HD-Zero OSD_TYPE = 5, SERIALx_PROTOCOL = 42, but MSP_OPTIONS should not be set to 4 for HD-Zero.
See the wiki https://ardupilot.org/plane/docs/common-msp-osd-overview-4.2.html#displayport-osd

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed MSP_OPTIONS set; great tip.

The UARTs are marked Rn and Tn in the above pinouts. The Rn pin is the
receive pin for UARTn. The Tn pin is the transmit pin for UARTn.

- SERIAL0 -> USB
Copy link
Collaborator

Choose a reason for hiding this comment

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

needs dma capability addeds for each serial port

Copy link
Contributor Author

@David-OConnor David-OConnor Jan 18, 2024

Choose a reason for hiding this comment

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

How do I do that? Isn't that handled by AP? (They are all DMA capable, and I recommend using DMA for all common use cases of UARTs)

Copy link
Collaborator

Choose a reason for hiding this comment

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

first you have to include the bootloader files in this PR....it wont build without them....then you run a waf configure and look at the hw.dat file produced to see what DMA channels get assigned ...also needed to assure that bidir requests are implemented for outputs in the configure....shared channels in bi-dir is a no-no

Copy link
Contributor Author

@David-OConnor David-OConnor Jan 18, 2024

Choose a reason for hiding this comment

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

Are you referring to hwdef-bl.dat? That is in the PR. (If it's something else, LMK!)

Copy link
Collaborator

Choose a reason for hiding this comment

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

look at this board addition PR.....#25431

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where does this place the hw.dat Unable to find after running ./waf configure AnyleafH7 and using grep.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Screenshot from 2024-01-18 10-28-59

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nvm; found it! /build/board name

Copy link
Contributor Author

@David-OConnor David-OConnor Jan 18, 2024

Choose a reason for hiding this comment

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

Here's the part relevant to UART and Motors; seems to be outputting what I input in the config files:

SERIAL_ORDER OTG1 USART1 USART2 USART3 UART4 UART7 UART8
PB6 USART1_TX USART1
PB7 USART1_RX USART1
PA2 USART2_TX USART2
PA3 USART2_RX USART2
PD8 USART3_TX USART3
PD9 USART3_RX USART3
PC10 UART4_TX UART4
PC11 UART4_RX UART4
PB4 UART7_TX UART7
PB3 UART7_RX UART7
PE1 UART8_TX UART8
PE0 UART8_RX UART8
PD0 CAN1_RX CAN1
PD1 CAN1_TX CAN1
PC6  TIM3_CH1 TIM3  PWM(1)  GPIO(50)  BIDIR
PC7  TIM3_CH2 TIM3  PWM(2)  GPIO(51)  BIDIR
PC8  TIM3_CH3  TIM3  PWM(3)  GPIO(52)  BIDIR
PC9  TIM3_CH4  TIM3  PWM(4)  GPIO(53)  BIDIR
PE5  TIM15_CH1  TIM15  PWM(5)  GPIO(54)
PE6  TIM15_CH2  TIM15  PWM(6)  GPIO(55)
PE13 TIM1_CH3 TIM1 PWM(7) GPIO(56)
PE14 TIM1_CH4 TIM1 PWM(8) GPIO(57)
PE9 TIM1_CH1 TIM1 GPIO(58) ALARM

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry its really the hwdef.h file which is only visible after you have bootloaders, which you didnt at this point


## Pinout

Pins and connector values are labeled on the flight controller PCB.
Copy link
Collaborator

Choose a reason for hiding this comment

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

should include images and link in this readme....and all pins are not labeled on the PCB..where is TX2 and RX2 (DJI connector)...same for ESC connector telem pin (RX3)..

Copy link
Contributor Author

@David-OConnor David-OConnor Jan 18, 2024

Choose a reason for hiding this comment

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

I added clarification text to the readme; LMK how you'd like to proceed. I can draft up some images if you'd like, but I think now after the updates, they are probably not required in conjunction with the readme, datasheet, and silkscreen text. Your call.

Copy link
Collaborator

Choose a reason for hiding this comment

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

when I get a chance in the next few days...I will pull this down when you think you've done everything you can and make some changes and push back up

Copy link
Collaborator

Choose a reason for hiding this comment

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

just pushed readme changes....outputs need to be addressed by @andyp1per and other changes made to defaults

@David-OConnor
Copy link
Contributor Author

David-OConnor commented Jan 18, 2024

Hey, it sounds like the main things left are

#1: UART and Motor DMA
#2: That Status LED

For #1, here's the relevant info from a hardware and firmware-design perspective:

Motors are allocated to pins based on associations with these hardware timers:
Motors 1-4 (ESC connector): TIM3, CH1-4
Motors 5-6 (Bottom pads): TIM15, CH1-2
Motors 7-8 (Bottom pads): TIM1, CH3-4

These are all general purpose timers, and support Burst DMA. Does this help?

All the UART ports are STM32H7-standard UARTS (Some support synchronous; others don't; all support DMA).

For #2, it's likely a syntax error in the relevant line in hwdef.dat.

@Hwurzburg
Copy link
Collaborator

some review comments still need addressing....need bootloaders and final commit squash and subsystems split of commits

@David-OConnor
Copy link
Contributor Author

David-OConnor commented Jan 20, 2024

I'm at the point now where I will likely need an assist. The board works with the latest config (other than the LED). Need to do flight tests with the latest updates to config, but other than that, I'm happy on my end. LMK how I can assist re the comments above (motors, serial etc).

Of note, I also run custom FC firmware on this board, so can help with hardware details like timer config, DMA etc.

@David-OConnor
Copy link
Contributor Author

Diagrams added. LED now working (thanks @IamPete1!)

# Onboard ELRS
SERIAL5_PROTOCOL 23 # RCIN
# RC_OPTIONS 512 # Suppress ELRS errors
RC5_OPTION 154 # Set up arm switch to `ArmDisarm with AirMode`
Copy link
Collaborator

Choose a reason for hiding this comment

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

and AirMode is potentially dangerous and unexpected, not having it active on arm is not...and many would want a different kind of arm switch...for example ARM/Emergency stop....I will note in the README that I am modifying now and will push shortly, about ELRS arming, but please remove this

PD1 CAN1_TX CAN1

# Motors
PC6 TIM3_CH1 TIM3 PWM(1) GPIO(50) BIDIR
Copy link
Collaborator

Choose a reason for hiding this comment

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

@andyp1per should review the DMAs for these outputs...some are shared with UARTs....and its possible that outputs 5-8 could also be enabled for BIDIR

Copy link
Collaborator

Choose a reason for hiding this comment

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

You only need to set it once for a 1-2 or 3-4 channel pair. So for example:

PC6  TIM3_CH1 TIM3  PWM(1)  GPIO(50)  BIDIR
PC7  TIM3_CH2 TIM3  PWM(2)  GPIO(51)
PC8  TIM3_CH3  TIM3  PWM(3)  GPIO(52)  BIDIR
PC9  TIM3_CH4  TIM3  PWM(4)  GPIO(53)
PE5  TIM15_CH1  TIM15  PWM(5)  GPIO(54) BIDIR
PE6  TIM15_CH2  TIM15  PWM(6)  GPIO(55)
PE13 TIM1_CH3 TIM1 PWM(7) GPIO(56) BIDIR
PE14 TIM1_CH4 TIM1 PWM(8) GPIO(57)

Copy link
Collaborator

Choose a reason for hiding this comment

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

need to update in readme which are now bidir also when you make changes like this

Copy link
Collaborator

@Hwurzburg Hwurzburg left a comment

Choose a reason for hiding this comment

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

these defaults should probably be left at default since they are highly personalized for a given persons setup:
RC2_REVERSED
ARMING_RUDDER

@Hwurzburg
Copy link
Collaborator

@David-OConnor I have made a few changes to avoid DMA sharing (Andy sugggested) and re-instated the alarm buzzer...I have built and loaded on the board you sent me, but you need to confirm dshot operation using your setup....I also squashed, rebased, and put the correct commit messages....once you test and approve, I will tag it for devcall and hopefully merge

@David-OConnor
Copy link
Contributor Author

Sounds great. I flight-tested DSHOT on motors 1-4 in Betaflight yesterday (Valid RPM readings x4), but haven't flight-tested in AP. Will load up the latest and try over the next few days. I appreciate it!

@David-OConnor
Copy link
Contributor Author

David-OConnor commented Jan 28, 2024

Flight tested good today; I'm happy with the latest revision.

@peterbarker peterbarker merged commit eaec73c into ArduPilot:master Feb 1, 2024
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 4.5.0-beta2
Development

Successfully merging this pull request may close these issues.

7 participants