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

Add SPRO-SPRACINGH7NANO.config #12575

Merged
merged 13 commits into from Apr 6, 2023

Conversation

theojalba
Copy link
Contributor

@theojalba theojalba commented Mar 26, 2023

  • Adds back SPRACING H7NANO board which was removed in Betaflight 4.4.

Based on SPRACING H7EXTREME config with hardware settings from BF 4.3 H7NANO config.

Unified config:
betaflight/unified-targets#963

@haslinghuis
Copy link
Member

@theojalba you can test flash this build using cloud API by adding #12575 in commit field in configurator.

@blckmn
Copy link
Member

blckmn commented Mar 26, 2023

AUTOMERGE: (FAIL)

  • github identifies PR as mergeable -> FAIL
  • assigned to a milestone -> PASS
  • cooling off period lapsed -> PASS
  • commit count less or equal to three -> FAIL
  • Don't merge label NOT found -> PASS
  • at least one RN: label found -> PASS
  • Tested label found -> PASS
  • assigned to an approver -> FAIL
  • approver count at least three -> FAIL

@theojalba
Copy link
Contributor Author

@theojalba you can test flash this build using cloud API by adding #12575 in commit field in configurator.

Not sure how. Using the latest Configurator from nightlies I cannot see the new H7NANO target.

@haslinghuis
Copy link
Member

Yes sorry needs local testing until merged.

@haslinghuis
Copy link
Member

@theojalba Can you test confirm locally as I only have the H7EXTREME

@github-actions

This comment has been minimized.

@theojalba
Copy link
Contributor Author

@haslinghuis: I confirmed that 4.4-maintenance with my changes works fine and made a note on that PR.

I am looking into one issue with this master branch PR. I can build successfully and it flashes successfully. Then I calibrate the accelerometer and apply CLI options (optional). At this point when I unplug from USB and reconnect, the board goes back into DFU mode. It's as if disconnecting from USB power makes it lose its flash contents.

@haslinghuis
Copy link
Member

Yes had same experience with H7EXTREME. Flashing, connects all is okay. After computer reboot found out the board is in DFU mode. Did not investigate further.

@hydra should have a look at it.

@theojalba
Copy link
Contributor Author

theojalba commented Mar 27, 2023

@hydra: I tracked down the issue to this commit: c1c1f95

Before this commit no DFU is triggered on USB disconnect, on and following this commit DFU is triggered.

It seems the USE_FIRMWARE_PARTITION is at fault. Not sure where the NANO config should be stored... CONFIG_IN_EXTERNAL_FLASH is enabled, should CONFIG_IN_MEMORY_MAPPED_FLASH and USE_FIRMWARE_PARTITION also be enabled for the NANO?

@theojalba
Copy link
Contributor Author

Opted for the simplest fix which is CONFIG_IN_EXTERNAL_FLASH + USE_FIRMWARE_PARTITION.

Not sure if this was the intended use in c1c1f95

@theojalba
Copy link
Contributor Author

I tested this branch locally by adding the options below into common_pre.h. I confirmed that all the components on my build (CRSF Nano, Vista, GPS, motors) are working. I also did a quick indoors hover test.

#define CLOUD_BUILD
#define USE_SERIALRX
#define USE_SERIALRX_CRSF
#define USE_SERIALRX_GHST
#define USE_SERIALRX_SBUS
#define USE_SERIALRX_SRXL2
#define USE_SERIALRX_SPEKTRUM
#define USE_TELEMETRY_CRSF
#define USE_TELEMETRY_GHST
#define USE_TELEMETRY_HOTT
#define USE_TELEMETRY_MAVLINK
#define USE_TELEMETRY_SMARTPORT
#define USE_BARO
#define USE_GPS
#define USE_GPS_UBLOX
#define USE_GPS_NMEA
#define USE_GPS_RESCUE
#define USE_SERVOS
#define USE_LED_STRIP
#define USE_OSD
#define USE_OSD_SD
#define USE_OSD_HD
#define USE_PINIO
#define USE_PINIOBOX
#define USE_VTX
#define USE_DSHOT
#define USE_DSHOT_TELEMETRY
#define USE_ESC_SENSOR
#define USE_PWM
#define USE_PWM_OUTPUT
#define USE_RX_PPM
#define USE_RX_PWM
#define USE_TRANSPONDER
#define USE_MAG
#define USE_DASHBOARD
#define USE_BATTERY_CONTINUE
#define USE_CAMERA_CONTROL
#define USE_ACRO_TRAINER
#define USE_AKK_SMARTAUDIO

@github-actions

This comment has been minimized.

@haslinghuis
Copy link
Member

haslinghuis commented Mar 28, 2023

Better use something like

 make SPRACINGH7NANO EXTRA_FLAGS="-D'BUILD_KEY=afb536a7b9178b11617c47f161899c93' -D'RELEASE_NAME=4.5.0-zulu' -DCLOUD_BUILD -DUSE_DSHOT -DUSE_GPS -DUSE_GPS_PLUS_CODES -DUSE_LED_STRIP -DUSE_OSD -DUSE_OSD_HD -DUSE_OSD_SD -DUSE_PINIO -DUSE_SERIALRX -DUSE_SERIALRX_CRSF -DUSE_TELEMETRY -DUSE_TELEMETRY_CRSF -DUSE_VTX"

or for testing and support use

 make SPRACINGH7NANO EXTRA_FLAGS="-DCORE_BUILD"

@theojalba
Copy link
Contributor Author

Used the command line options as indicated. All good, everything passes. 🎉

@hydra
Copy link
Contributor

hydra commented Mar 28, 2023

Yes sorry needs local testing until merged.

@blckmn @haslinghuis @McGiverGim this is the catch-22 situation again where you can't fully create a new target and test cloud build end-to-end until a, potentially broken, target is published.

How about letting the user enter a 'custom' target for the situation where the target has never been published?

@hydra
Copy link
Contributor

hydra commented Mar 28, 2023

Opted for the simplest fix which is CONFIG_IN_EXTERNAL_FLASH + USE_FIRMWARE_PARTITION.

Not sure if this was the intended use in c1c1f95

that is correct.

Without the 'USE_FIRMWARE_PARTITION' the offsets for the flash chip's partitions will not match what the bootloader expects, so writing the config might overwrite the firmware on the flash chip causing the firmware to be corrupted.

However, you'd only notice this after a power cycle because the firmware is held in RAM and the bootloader will boot from RAM if valid firmware is found - this speeds up boot times. if power is removed then the next boot up will cause the bootloader to try loading the now-corrupted firmware from flash, it will detect that it's corrupted and enter DFU mode.

Also the flash chip on the NANO does not support memory mapped mode, only the flash chips on the H7RF and H7 EXTREME PX4 Edition support memory mapped flash.

@theojalba
Copy link
Contributor Author

@hydra: As requested, here are the resource show, timer show, dma show, dump and diff outputs for this build post flashing.
bf 4.5 resources.txt
bf 4.5 timers.txt
bf 4.5 dmas.txt
bf 4.5 dump.txt
bf 4.5 diff.txt

@theojalba
Copy link
Contributor Author

theojalba commented Mar 31, 2023

I jam packed as much as I could in this configuration, trying to match BF 4.3.

A couple of issues:

  1. There are multiple H7 configurations (such as KAKUTEH7) in the betaflight repo with #define TIMUP1_DMA_OPT, etc but can't find anywhere in the codebase where those options are actually applied. I followed the same pattern, and the #define TIMUP don't seem to be applied. Perhaps a bug.

  2. I also couldn't figure out how to enable serial comm on UART1 and UART2 in this legacy target, although I have that in the separate unified target. Overall not a big deal, as the end user needs to review their UART options based on installed hardware anyway.

  3. I enabled the ADC_RSSI feature to match 4.3, although I have some doubts whether this should be on by default.

Attached are the latest outputs for BF 4.5.

bf 4.5 resources.txt
bf 4.5 timers.txt
bf 4.5 dmas.txt
bf 4.5 dump.txt
bf 4.5 diff.txt

Latest command line to match 4.3 features and pins is:
make SPRACINGH7NANO EXTRA_FLAGS="-D'BUILD_KEY=afb536a7b9178b11617c47f161899c93' -D'RELEASE_NAME=4.5.0-zulu' -DCLOUD_BUILD -DUSE_DSHOT -DUSE_GPS -DUSE_GPS_PLUS_CODES -DUSE_LED_STRIP -DUSE_OSD -DUSE_OSD_HD -DUSE_OSD_SD -DUSE_PINIO -DUSE_SERIALRX -DUSE_SERIALRX_CRSF -DUSE_TELEMETRY -DUSE_TELEMETRY_CRSF -DUSE_VTX -DUSE_TRANSPONDER -DUSE_RX_PPM -DUSE_TELEMETRY_HOTT"

@github-actions

This comment has been minimized.

@theojalba
Copy link
Contributor Author

theojalba commented Apr 4, 2023

Added TIMUPx_DMA_OPT entries to match H7EXTREME.

@github-actions
Copy link

github-actions bot commented Apr 5, 2023

Do you want to test this code? Here you have an automated build:
Assets
WARNING: It may be unstable. Use only for testing! See: https://www.youtube.com/watch?v=I1uN9CN30gw for instructions for unified targets!

@blckmn blckmn merged commit 437b03e into betaflight:master Apr 6, 2023
19 checks passed
davidbitton pushed a commit to davidbitton/betaflight that referenced this pull request Feb 5, 2024
* Add SPRO-SPRACINGH7NANO.config
* Remove dupicate #define and add line return at end of file
* Add #pragma once
* Remove extra SDCARD pins
* Remove unnecessary SPI and I2C #defines
* Add USE_FIRMWARE_PARTITION_FLAG
* Remove SDCARD flag
* Add timer pin map
* Add ADC voltage and current
* Fix ADC_RSSI
* Add DMA TIMUP
* Enable serial on UART1
* Add TIMUP_DMA_OPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: COMPLETED
Development

Successfully merging this pull request may close these issues.

None yet

4 participants