iNavFlight / inav

INAV: Navigation-enabled flight control software
https://inavflight.github.io
GNU General Public License v3.0
3.09k stars 1.46k forks source link

T-Motor F7 Pro V2 target missing internal 16MB flash blackbox #7953

Closed FPVMartin closed 2 years ago

FPVMartin commented 2 years ago

Current Behavior

target TMOTORF7V2 missing black box. Manufacturer states that this flight controller has 16MB flash blackbox. Betaflight picks up the flash blackbox but INAV does not

could it be possible to add the flash blackbox to this target?

Let me know if you need a "dump" or "diff" file.

Thank you.

P.S. I'm totally new to this.

image

image

FPVMartin commented 2 years ago

Here is some info on the FC

Specifications

Mounting Pattern: 30.5x30.5mm/M3 Dimensions: 37x37x7.5mm MCU: STM32F722 RET6 Target: TMOTOR F7 V2 Blackbox: 16MB Flash Built-in OSD: AT7456 ESC Signal: M1-M8 BEC: 10V/2A, 5V/3A Barometer: BMP280 Input Voltage: 3-8S Motor Outputs: 8 IMU: MPU6000 USB: Type-C Weight: 8.1g UARTS: 6 WiFi: Yes

OptimusTi commented 2 years ago

Are you sure you are using the right target?

FPVMartin commented 2 years ago

I've been using the TMOTOR F7 V2 target. That's the e only TMotor target I saw in INAV.

FPVMartin commented 2 years ago

I did re-flash it just in case there was an issue with the first flash but still no blackbox login.

OptimusTi commented 2 years ago

I've been using the TMOTOR F7 V2 target. That's the e only TMotor target I saw in INAV.

That doesn't mean it's the correct target. There was another target that was removed on 4.1.

Does it work with Betaflight? Check if it works in EmuFlight.

FPVMartin commented 2 years ago

I check on BF and it worked. Do I need to download INAV 4.0?

The manufacturer mentions that the target is TMOTORF7V2.

I'm new to INAV. I'm not familiar with finding proper targets for FC except for what the manufacturer says.

FPVMartin commented 2 years ago

It was the same target for BF

erstec commented 2 years ago

@FPVMartin I see TMOTOR F7 V2 differs from TMOTOR F7, mentioned by @OptimusTi, by SPI3 pins used But in this case you should lose UART3 TX/RX and ADC2 (Current meter)... as mentioned pins are mapped to those peripherals.

You can build custom FW for "removed" TMOTOR F7 target to test, if you want, by enabling it in CMakeList.txt, in same target forder...

NOTE: In BF code SPI3 related part are totally same to INAV, for both V1 and V2 accordingly

FPVMartin commented 2 years ago

Ok, this jargon is a bit out of my understanding.

I can try the TMOTORF7 instead of V2

I have GPS on UART 3. I'll have to move it to another UART

erstec commented 2 years ago

Ok, this jargon is a bit out of my understanding.

I can try the TMOTORF7 instead of V2

I have GPS on UART 3. I'll have to move it to another UART

Ok :) In simple words, if you have working UART3, in your case it is GPS with TMOTOR F7 V2 target flahed, it seems you have correct target selected. Can you show photo of your FC?

FPVMartin commented 2 years ago

Ok, I'll send you a pic as soon as I'm home later today.

Here is a generic idea of what it looks like

FPVMartin commented 2 years ago

image

image

FPVMartin commented 2 years ago

image

FPVMartin commented 2 years ago

Here is a pic of my set up I took when I completed the build last weekend. I'll send you more when I'm home.

erstec commented 2 years ago

Here is a pic of my set up I took when I completed the build last weekend. I'll send you more when I'm home.

Thank you. It is more than enough :) I will take a look to code tomorrow

Just to clarify, you are using TMOTORF7V2 on BF and BlackBox works ok? And few more points: during flashing INAV Full chip erase are turned on? and BlackBox not working without any configuration, just after flashing INAV too?

FPVMartin commented 2 years ago

Yes, I put on BF and blackbox worked then I flashed INAV with full chip erase and blackbox does not work.

FPVMartin commented 2 years ago

With TMOTORF7V2 as target

FPVMartin commented 2 years ago

Thank You for looking into it

eksperts commented 2 years ago

Just to add to the points raised above. TMOTORF7V2 is the right target for this board (T-Motor F7 Pro) according to manufacturer. I experience the same issue - of not being able to use Blackbox - on two different units, same board, flashed 4.1 with full chip erase.

I do not have anything on TX3/RX3. As a test, turned off Current monitoring. Still no Blackbox.

Screenshot 2022-04-07 at 13 38 24

Looking at the same target on Emuflight, we see this, related to SPI3:

#define USE_FLASHFS
#define USE_FLASH_M25P16
#define FLASH_SPI_INSTANCE SPI3
#define FLASH_CS_PIN PA15
#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
...
#define USE_SPI_DEVICE_3
#define SPI3_SCK_PIN PC10
#define SPI3_MISO_PIN PC11
#define SPI3_MOSI_PIN PB2

whereas in INAV, this is what we have:

#define USE_SPI_DEVICE_3
#define SPI3_SCK_PIN            PC10
#define SPI3_MISO_PIN           PC11
#define SPI3_MOSI_PIN           PB2

#define USE_FLASHFS
#define USE_FLASH_M25P16
#define M25P16_SPI_BUS          BUS_SPI3
#define M25P16_CS_PIN           PA15
#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT

If we look at the unified target on BF, we can see the following of our interest:

resource SPI_SCK 3 C10
resource SPI_MISO 3 C11
resource SPI_MOSI 3 B02
...
resource FLASH_CS 1 A15
...
set blackbox_device = SPIFLASH
...
set flash_spi_bus = 3

So I guess it indeed means that the pins must be right and something else is interfering with the Blackbox functionality on INAV. Hope this helps.

FPVMartin commented 2 years ago

I see. I guess I'll add a micro SD card reader to record the blackbox.

Thank you for looking into it.

I was hoping to copy/paste the blackbox pin out from BF to INAV but that won't do anything.

erstec commented 2 years ago

@eksperts do it work with EmuFlight? Or @FPVMartin can check that too?

FPVMartin commented 2 years ago

I didn't try emuflight. I don't have the configurator. I have BF and INAV. I'm looking to use poshold and RTH so I can got through the drone declaration thing here in Canada amd be able to fly in controlled airspace (where our local racetrack is located)

I just assume BF and emuflight are similar that way.

I can always try it if you need more data on this.

Let me know.

FPVMartin commented 2 years ago

Is the issue with the code in INAV or it's a thing strictly with that board?

erstec commented 2 years ago

@FPVMartin BetaFlight don't use targets, but use defaults, applied after flashing unified targets FW. EmuFlight uses targets, same as INAV, that why I asking you to try EF.

There is no answer to your second question rn, whithout having exact same FC it is hard to find what wrong and took time ;) I will get same FC in 7-9 workdays, but till that you can assist. You know, getting board doesn't mean having freetime to debug, dig code and etc.

FPVMartin commented 2 years ago

Of course. I'll install emuflight and see it blackbox works.

eksperts commented 2 years ago

I checked. Installed Emu

Screenshot 2022-04-07 at 16 56 31

and BB is there

Screenshot 2022-04-07 at 16 57 51

cc: @erstec

FPVMartin commented 2 years ago

Oh wow. So it's strictly an INAV thing

erstec commented 2 years ago

I just found FC with same behaviour, IFlight F4 SuceX-D AIO, with 8MB onboard flash, but it don't show it in Configurator. I'll can go deep now

erstec commented 2 years ago

@eksperts @FPVMartin I need some assist, can you check FW attached. flash it, and show me CLI 'status' output, please.

inav_4.1.0_TMOTORF7V2.hex.zip

eksperts commented 2 years ago

roger @erstec:

# status
System Uptime: 13 seconds
Current Time: 2041-06-28T01:04:00.000+00:00
Voltage: 0.00V (1S battery - NOT PRESENT)
CPU Clock=216MHz, GYRO=MPU6000, ACC=MPU6000, BARO=BMP280
STM32 system clocks:
  SYSCLK = 216 MHz
  HCLK   = 216 MHz
  PCLK1  = 54 MHz
  PCLK2  = 108 MHz
Sensor status: GYRO=OK, ACC=OK, MAG=UNAVAILABLE, BARO=OK, RANGEFINDER=NONE, OPFLOW=NONE, GPS=NONE, IMU2=NONE
Stack size: 6144, Stack address: 0x20010000, Heap available: 2028
I2C Errors: 285, config size: 8830, max available config: 16384
ADC channel usage:
   BATTERY : configured = ADC 1, used = ADC 1
      RSSI : configured = ADC 3, used = none
   CURRENT : configured = ADC 2, used = ADC 2
  AIRSPEED : configured = none, used = none
System load: 6, cycle time: 1014, PID rate: 986, RX rate: 49, System rate: 10
Arming disabled flags: ACC HWFAIL RX CLI
VTX: not detected
SPI FLASH Status: 3 0 16777215 - 256 0 0 0 0
erstec commented 2 years ago

roger @erstec:

# status
System Uptime: 13 seconds
Current Time: 2041-06-28T01:04:00.000+00:00
Voltage: 0.00V (1S battery - NOT PRESENT)
CPU Clock=216MHz, GYRO=MPU6000, ACC=MPU6000, BARO=BMP280
STM32 system clocks:
  SYSCLK = 216 MHz
  HCLK   = 216 MHz
  PCLK1  = 54 MHz
  PCLK2  = 108 MHz
Sensor status: GYRO=OK, ACC=OK, MAG=UNAVAILABLE, BARO=OK, RANGEFINDER=NONE, OPFLOW=NONE, GPS=NONE, IMU2=NONE
Stack size: 6144, Stack address: 0x20010000, Heap available: 2028
I2C Errors: 285, config size: 8830, max available config: 16384
ADC channel usage:
   BATTERY : configured = ADC 1, used = ADC 1
      RSSI : configured = ADC 3, used = none
   CURRENT : configured = ADC 2, used = ADC 2
  AIRSPEED : configured = none, used = none
System load: 6, cycle time: 1014, PID rate: 986, RX rate: 49, System rate: 10
Arming disabled flags: ACC HWFAIL RX CLI
VTX: not detected
SPI FLASH Status: 3 0 16777215 - 256 0 0 0 0

Thank you!

Here is next one. Do the same if you can.

inav_4.1.0_TMOTORF7V2.hex.zip

FPVMartin commented 2 years ago

I don't know how to open this file. 😬

erstec commented 2 years ago

I don't know how to open this file. 😬

You don't need to open it, just run INAV configurator, go to Firmware Flasher tab (don't press Connect after start) and then press Load Firmware [Local] instead of you doing [Online] normally, select provided HEX (unzip it of course before) and then Flash Firmware. Simple :)

FPVMartin commented 2 years ago

here you go

status System Uptime: 14 seconds Current Time: 2041-06-28T02:04:00.000+01:00 Voltage: 0.00V (1S battery - NOT PRESENT) CPU Clock=216MHz, GYRO=MPU6000, ACC=MPU6000, RANGEFINDER=MSP, OPFLOW=MSP STM32 system clocks: SYSCLK = 216 MHz HCLK = 216 MHz PCLK1 = 54 MHz PCLK2 = 108 MHz Sensor status: GYRO=OK, ACC=OK, MAG=UNAVAILABLE, BARO=UNAVAILABLE, RANGEFINDER=FAILING, OPFLOW=FAILING, GPS=NONE, IMU2=NONE Stack size: 6144, Stack address: 0x20010000, Heap available: 1924 I2C Errors: 65, config size: 8830, max available config: 16384 ADC channel usage: BATTERY : configured = ADC 1, used = ADC 1 RSSI : configured = ADC 3, used = none CURRENT : configured = ADC 2, used = ADC 2 AIRSPEED : configured = none, used = none System load: 10, cycle time: 505, PID rate: 1980, RX rate: 49, System rate: 9 Arming disabled flags: NAV HWFAIL RX CLI VTX: not detected SPI FLASH Status: 3 0 0 16777215 - 1 1 2 - 256 0 0 0 0

erstec commented 2 years ago

Okay, it is fixed and tested.

For those who need 4.1.0 version with fix - HEX attached. inav_4.1.0_TMOTORF7V2.hex.zip

PR will follow