iNavFlight / inav

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

JHEMCU F7 - support ! #5002

Closed yo8aiv closed 4 years ago

yo8aiv commented 5 years ago

Hi . i don't know if this is the right way to ask for new FC to be supported.

its called JHEMCU F7 target in BF is JHEF7DUAL. this board could be of better use in iNav than BF since it has so many uart's. more info https://github.com/betaflight/betaflight/issues/8605 https://github.com/betaflight/betaflight/pull/7398

Thanks.

lavachemist commented 3 years ago

inav_2.5.2_JHEF7DUAL (USER1,2).zip

So far this seems to be working. Only thing that seems slightly off is that data is set for UART1. I believe this was supposed to be for Bluetooth, which is on UART 4. Easy enough to change, but worth noting.

lavachemist commented 3 years ago

inav_2.5.2_JHEF7DUAL (USER1,2).zip

@terminat25 can you share the uncompiled target files? I'd like to be able to remap some stuff, which we can't do via hex file.

UnchartedBull commented 3 years ago

Feel free to checkout this branch of my fork: https://github.com/UnchartedBull/inav/tree/jhemcu-f722. Builds just fine and the I/O pins are working for me as well.

Edit: I disabled the MPU6000 Gyro, since my board (the one with the PDB) doesn't have one. You're probably best of forking it again to your repo and then adjusting everything :)

terminat25 commented 3 years ago

For INAV 2.5.2 only.

target.h file:

define TARGET_BOARD_IDENTIFIER "JH7D"

define USBD_PRODUCT_STRING "JHEF722DUAL"

/ Indicators /

define LED0 PA15

define BEEPER PC15

define BEEPER_INVERTED

/ IMU sensors /

define USE_EXTI

define USE_TARGET_IMU_HARDWARE_DESCRIPTORS

define USE_MPU_DATA_READY_SIGNAL

define USE_DUAL_GYRO

define USE_IMU_MPU6000

define MPU6000_SPI_BUS BUS_SPI1

define MPU6000_CS_PIN PA4

define MPU6000_EXTI_PIN PC3

define MPU6000_ALIGN CW90_DEG

define USE_IMU_ICM20689

define ICM20689_SPI_BUS BUS_SPI1

define ICM20689_CS_PIN PB2

define ICM20689_EXTI_PIN PC4

define ICM20689_ALIGN CW90_DEG

/ SPI bus /

define USE_SPI

define USE_SPI_DEVICE_1 // Gyro 1/2

define SPI1_SCK_PIN PA5

define SPI1_MISO_PIN PA6

define SPI1_MOSI_PIN PA7

define USE_SPI_DEVICE_2 // OSD (MAX7456)

define SPI2_SCK_PIN PB13

define SPI2_MISO_PIN PB14

define SPI2_MOSI_PIN PB15

define USE_SPI_DEVICE_3 // FLASH

define SPI3_SCK_PIN PC10

define SPI3_MISO_PIN PC11

define SPI3_MOSI_PIN PB5

/ I2C bus /

define USE_I2C

define USE_I2C_DEVICE_1 // I2C pads

define I2C1_SCL PB6

define I2C1_SDA PB7

/ OSD /

define USE_OSD

define USE_MAX7456

define MAX7456_CS_PIN PB12

define MAX7456_SPI_BUS BUS_SPI2

/ Onboard flash /

define USE_FLASHFS

define USE_FLASH_M25P16

define M25P16_CS_PIN PC13

define M25P16_SPI_BUS BUS_SPI3

/ Serial ports /

define USE_VCP

define USE_UART1

define UART1_TX_PIN PA9

define UART1_RX_PIN PB10

define USE_UART2

define UART2_TX_PIN PA2

define UART2_RX_PIN PA3

define USE_UART3

define UART3_TX_PIN PB10

define UART3_RX_PIN PB11

define USE_UART4

define UART4_TX_PIN PA0

define UART4_RX_PIN PA1

define USE_UART5

define UART5_TX_PIN PC12

define UART5_RX_PIN PD2

define USE_UART6

define UART6_TX_PIN PC6

define UART6_RX_PIN PC7

define SERIAL_PORT_COUNT 7

/ BARO & MAG /

define USE_BARO

define BARO_I2C_BUS BUS_I2C1

define USE_BARO_BMP280

define USE_MAG

define MAG_I2C_BUS BUS_I2C1

define USE_MAG_HMC5883

define USE_MAG_QMC5883

/ ADC /

define USE_ADC

define ADC_CHANNEL_1_PIN PC2

define ADC_CHANNEL_2_PIN PC1

define ADC_CHANNEL_3_PIN PC0

define VBAT_ADC_CHANNEL ADC_CHN_1

define CURRENT_METER_ADC_CHANNEL ADC_CHN_2

define RSSI_ADC_CHANNEL ADC_CHN_3

/ PINIO /

define USE_PINIO

define USE_PINIOBOX

define PINIO1_PIN PC14

define PINIO2_PIN PB9

/ LED STRIP /

define USE_LED_STRIP

define WS2811_PIN PA8

/ Default settings /

define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT

define CURRENT_METER_SCALE_DEFAULT 170

define SERIALRX_UART SERIAL_PORT_USART2

define DEFAULT_RX_TYPE RX_TYPE_SERIAL

define SERIALRX_PROVIDER SERIALRX_SBUS

define DEFAULT_FEATURES (FEATURE_TELEMETRY | FEATURE_OSD | FEATURE_VBAT | FEATURE_CURRENT_METER | FEATURE_BLACKBOX)

/ Timer/PWM output /

define USE_SERIAL_4WAY_BLHELI_INTERFACE

define MAX_PWM_OUTPUT_PORTS 6

define USE_DSHOT

define USE_ESC_SENSOR

/ Used pins /

define TARGET_IO_PORTA 0xffff

define TARGET_IO_PORTB 0xffff

define TARGET_IO_PORTC 0xffff

define TARGET_IO_PORTD (BIT(2)) // ???

terminat25 commented 3 years ago

For INAV 2.5.2 only.

target.c file:

include

include

include

include "drivers/io.h"

include "drivers/bus.h"

include "drivers/timer.h"

include "drivers/sensor.h"

include "drivers/pwm_mapping.h"

include "io/piniobox.h"

// IMU 1/2 BUSDEV_REGISTER_SPI_TAG(busdev_mpu6000, DEVHW_MPU6000, MPU6000_SPI_BUS, MPU6000_CS_PIN, MPU6000_EXTI_PIN, 0, DEVFLAGS_NONE, MPU6000_ALIGN); BUSDEV_REGISTER_SPI_TAG(busdev_icm20689, DEVHW_ICM20689, ICM20689_SPI_BUS, ICM20689_CS_PIN, ICM20689_EXTI_PIN, 1, DEVFLAGS_NONE, ICM20689_ALIGN);

const timerHardware_t timerHardware[] = { DEF_TIM(TIM9, CH2, PA3, TIM_USE_PPM, 0, 0), // PPM&SBUS

DEF_TIM(TIM3,  CH3, PB0,  TIM_USE_MC_MOTOR, 0, 0),      // S1 - D(1,2)          
DEF_TIM(TIM3,  CH4, PB1,  TIM_USE_MC_MOTOR, 0, 0),      // S2 - D(1,4)          
DEF_TIM(TIM3,  CH1, PB4,  TIM_USE_MC_MOTOR, 0, 0),      // S3 - D(1,6)          
DEF_TIM(TIM2,  CH2, PB3,  TIM_USE_MC_MOTOR, 0, 0),      // S4 - D(1,5)          
DEF_TIM(TIM8,  CH4, PC9,  TIM_USE_MC_MOTOR, 0, 0),      // S5 - D(2,4)          
DEF_TIM(TIM8,  CH3, PC8,  TIM_USE_MC_MOTOR, 0, 0),      // S6 - D(2,1)          

DEF_TIM(TIM1,  CH1, PA8,  TIM_USE_LED,      0, 0),     // LED STRIP(1,5)        

// DEF_TIM(TIM4, CH3, PB8, TIM_USE_ANY, 0, 0), // ??? };

const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]);

void targetConfiguration(void)
{ pinioBoxConfigMutable()->permanentId[0] = 39; // CAMERA CONTROL 1 pinioBoxConfigMutable()->permanentId[1] = 40; // CAMERA CONTROL 2 }

terminat25 commented 3 years ago

For INAV 2.5.2 only.

JHEF7DUAL.zip

lavachemist commented 3 years ago

Attached is my version of the JHEMCU F7 DUAL target (hex file and also target files in the zip file).

This will allow you to run INAV on the JHEMCU F7 DUAL in 2.5.2 as both a multicopter (up to hexacopter or quadcopter with two servos) and wing (up to 4 servos and two motors) without running into issues with incorrect timer settings.

All I did was rearrange the variables for S1 - S6. Now, if you are building a single motor flying wing, for example, it will map the motor to S4, and map the two servos to S1 and S2. The other versions above do not have FW motors and servos mapped, so it would have tried to put the servos and motors on S1-S3, which did not work since those outputs are all on the same timer.

JHEF7DUAL_LC.zip

chapimp commented 3 years ago

@lavachemist, I tried your hex on Inav, everything seems to work but the motor does not work. I tried other versions from the above posts where the motor is on s1 and it works except that servo 3 does not work. This board is a pain on the neck.

krizw commented 3 years ago

It would be great if adopted by an INAV dev, but doubtful. I will try the build on the HIFIONRC F722 (very similar).

redeyejoe commented 3 years ago

I cant get the cli to work on most of these.. Anyone else having this problem.

Narnasqueneth commented 3 years ago

Have you used impluseRC driver fixer? Ensure you don't have Chrome open either and nothing else plugged into your pc/laptop. Also it never hurts to restart your computer before re-trying the above

Get Outlook for Androidhttps://aka.ms/ghei36


From: redeyejoe notifications@github.com Sent: Sunday, January 3, 2021 6:01:41 AM To: iNavFlight/inav inav@noreply.github.com Cc: Narnasqueneth jcanbilen@hotmail.com; Comment comment@noreply.github.com Subject: Re: [iNavFlight/inav] JHEMCU F7 - support ! (#5002)

I cant get into the cli on most of these.. Anyone else having this problem.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/iNavFlight/inav/issues/5002#issuecomment-753573225, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APMP3NPP2B6HW2K3UAAPPOTSYAB4LANCNFSM4IK2E5NA.

mubispilvas commented 3 years ago

Can anyone share iNav 2.6 for JHEMCU F7 DUAL? Please.

redeyejoe commented 3 years ago

I got cli to work by doing a full chip erase,

redeyejoe commented 3 years ago

@lavachemist

Attached is my version of the JHEMCU F7 DUAL target (hex file and also target files in the zip file).

This will allow you to run INAV on the JHEMCU F7 DUAL in 2.5.2 as both a multicopter (up to hexacopter or quadcopter with two servos) and wing (up to 4 servos and two motors) without running into issues with incorrect timer settings.

All I did was rearrange the variables for S1 - S6. Now, if you are building a single motor flying wing, for example, it will map the motor to S4, and map the two servos to S1 and S2. The other versions above do not have FW motors and servos mapped, so it would have tried to put the servos and motors on S1-S3, which did not work since those outputs are all on the same timer.

JHEF7DUAL_LC.zip

I am trying to use this on a wing, and I can not get the FC to see the esc or motor on s4, On my other jhemcu's running betaflight the s3 and s4 are resourced to B04 and B03 respectively, and in the cli both are free and unused. Can I change them in the cli of Inav like you can with betafligtht?

lavachemist commented 3 years ago

@lavachemist

Attached is my version of the JHEMCU F7 DUAL target (hex file and also target files in the zip file). This will allow you to run INAV on the JHEMCU F7 DUAL in 2.5.2 as both a multicopter (up to hexacopter or quadcopter with two servos) and wing (up to 4 servos and two motors) without running into issues with incorrect timer settings. All I did was rearrange the variables for S1 - S6. Now, if you are building a single motor flying wing, for example, it will map the motor to S4, and map the two servos to S1 and S2. The other versions above do not have FW motors and servos mapped, so it would have tried to put the servos and motors on S1-S3, which did not work since those outputs are all on the same timer. JHEF7DUAL_LC.zip

I am trying to use this on a wing, and I can not get the FC to see the esc or motor on s4, On my other jhemcu's running betaflight the s3 and s4 are resourced to B04 and B03 respectively, and in the cli both are free and unused. Can I change them in the cli of Inav like you can with betafligtht?

Did you enable motor output? I just double checked the target and I had fixed wing motor mapped to S4. What ESC are you using, and what protocol (DSHOT? PWM? Oneshot?). I don't have this FC in an aircraft at the moment, unfortunately, or I would check it.

redeyejoe commented 3 years ago

Yes, I did enable the motor output, for both motors. I am thinking that maybe the motors are not resource correctly for this FC, there seems to be someone else above that has tried it and is getting the same problem, From the other working hex files on here, they are all resourced to B04 for s3 and B03 for s4, and both of these are unused in the cli/resource list? As for esc, I have tried a couple one was oneshot125.

lavachemist commented 3 years ago

Yes, I did enable the motor output, for both motors. I am thinking that maybe the motors are not resource correctly for this FC, there seems to be someone else above that has tried it and is getting the same problem, From the other working hex files on here, they are all resourced to B04 for s3 and B03 for s4, and both of these are unused in the cli/resource list? As for esc, I have tried a couple one was oneshot125.

PB4 is S3 and PB3 is S4...

image

lavachemist commented 3 years ago

Maybe I uploaded the wrong hex file? I will recompile and see what happens.

lavachemist commented 3 years ago

You don't want to put your FW motor on S3, because S3 is on the same timer as your servos on S1 and S2.

redeyejoe commented 3 years ago

Yes, I see that, , I am was just stating how it was resourced on betaflight and other inav hex, I am wanting it use motor on S4.

lavachemist commented 3 years ago

Yes, I see that, , I am was just stating how it was resourced on betaflight and other inav hex, I am wanting it use motor on S4.

To answer your earlier question, no you cannot remap resources like you can in Betaflight.

I think I found the problem though. INAV did not seem to like having the two motors on different timers at all. I ended up putting motors on S5 and S6 instead, and it seems to be correct although I do not have motors, Servos and ESCs set up to test.

I made an INAV version 2.6 target, since 2.6 has been released and it is easier for me to make targets for the current version (make sure you also install INAV Configurator 2.6) : JHEMCU_F7Dual_011720_LC.zip

Here is what the output of the resource command looks like for me now. As you can see, Motor 1 is on S5 and Motor 2 is on S6:

image

redeyejoe commented 3 years ago

thank you, but that will not work with FC I am using as they do not have the s5 or s6 pads broke out. it is the JHEMCU F722 with built in PDB.

lavachemist commented 3 years ago

thank you, but that will not work with FC I am using as they do not have the s5 or s6 pads broke out. it is the JHEMCU F722 with built in PDB.

If you just need one motor, I can make a target that has servos on S1-S3, and a motor on S4. Unfortunately, because S1-S3 share a timer, you won't be able to have two motors and two servos with your board. See if attached works for you.

You will need to load the mixer for a flying wing (not Load and Apply), then delete Motor 2 before Save and Reboot.

inav_2.6.0_JHEF7_PDB.zip

lavachemist commented 3 years ago

For anyone who looks for this in the future, this is the final version of the firmware that I have come up with. INAV did not like it when I set S4 to be either a FW_servo or a FW_motor, so I just set it to only ever be FW_Motor.

So, you can have three servos and up to three motors on a wing. It's the best I can do. It can also support up to a hexacopter for multirotor. All of this is assuming that you have the version of the board that has 6 outputs. If your board only has four outputs, it can be a Wing with three servos + 1 motor, or it can be a quadcopter.

JHEF7D_INAV_2_6_011721_LC.zip

redeyejoe commented 3 years ago

thank you, but that will not work with FC I am using as they do not have the s5 or s6 pads broke out. it is the JHEMCU F722 with built in PDB.

If you just need one motor, I can make a target that has servos on S1-S3, and a motor on S4. Unfortunately, because S1-S3 share a timer, you won't be able to have two motors and two servos with your board. See if attached works for you.

You will need to load the mixer for a flying wing (not Load and Apply), then delete Motor 2 before Save and Reboot.

inav_2.6.0_JHEF7_PDB.zip

Thank you, this fixed motor issue, and works so far for me. I did have to set gyro_to_use = 1 in cli to get gyro to show. I hope to test this on this wing in next couple of days.

lavachemist commented 3 years ago

thank you, but that will not work with FC I am using as they do not have the s5 or s6 pads broke out. it is the JHEMCU F722 with built in PDB.

If you just need one motor, I can make a target that has servos on S1-S3, and a motor on S4. Unfortunately, because S1-S3 share a timer, you won't be able to have two motors and two servos with your board. See if attached works for you. You will need to load the mixer for a flying wing (not Load and Apply), then delete Motor 2 before Save and Reboot. inav_2.6.0_JHEF7_PDB.zip

Thank you, this fixed motor issue, and works so far for me. I did have to set gyro_to_use = 1 in cli to get gyro to show. I hope to test this on this wing in next couple of days.

Interesting. Does that board not have dual gyros? Mine works without that command. Good luck with your flight! I hope it works out for you.

redeyejoe commented 3 years ago

It does not have the dual gyro, it has the ICM20689, it also does not have the 2 camera inputs, or vtx power control, but it does have built in PDB, which is nice for servos and single esc for a wing set up it is looking like a good setup. thanks

wrevenaugh commented 3 years ago

Guys thanks so much for doing all this work on the Jhemcu. I have the board without the dual gyros (it's still called JHEF7DUAL in Betaflight) and I loaded your hex. The problem I am having is it seems as though the one gyro I DO have has been disabled (Can't do accel calib and the vehicle doesn't rotate in the setup screen). Am I doing something wrong or can I not use this firmware if I have the JHEMF7 without the 2nd gyro? Thanks again for all you hard work guys!

krizw commented 3 years ago

Try this....CLIset gyro_to_use = firstSaveOn 2 Feb 2021 13:59, wrevenaugh notifications@github.com wrote: Guys thanks so much for doing all this work on the Jhemcu. I have the board without the dual gyros (it's still called JHEF7DUAL in Betaflight) and I loaded your hex. The problem I am having is it seems as though the one gyro I DO have has been disabled (Can't do accel calib and the vehicle doesn't rotate in the setup screen). Am I doing something wrong or can I not use this firmware if I have the JHEMF7 without the 2nd gyro? Thanks again for all you hard work guys!

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.

wrevenaugh commented 3 years ago

Thanks @krizw tried that (btw it's set gyro to use = "1" in Inav) and that didn't quite do the trick until i went into the config tab and set the accelerometer box to "auto" - (Really Inav? I have to turn the accelerometer ON? LOL). Now Inav recognizes the gyro. Before that , it didn't. Thanks again!

tom9un commented 3 years ago

For anyone who looks for this in the future, this is the final version of the firmware that I have come up with. INAV did not like it when I set S4 to be either a FW_servo or a FW_motor, so I just set it to only ever be FW_Motor.

So, you can have three servos and up to three motors on a wing. It's the best I can do. It can also support up to a hexacopter for multirotor. All of this is assuming that you have the version of the board that has 6 outputs. If your board only has four outputs, it can be a Wing with three servos + 1 motor, or it can be a quadcopter.

JHEF7D_INAV_2_6_011721_LC.zip

Compas...user1 n 2...not work...

tom9un commented 3 years ago

smaller09 , you''re the man ! :)

i can confirm user-modes are working. can't confirm yet, that it will fly. inav_2.4.0_JHEF7DUAL_smaller09_menu_patch.zip

can you add for sonar broo?...

terminat25 commented 3 years ago

inav_2.6.1_JHEF7DUAL.zip

s2kaka commented 3 years ago

can JHEMCU F745 SE use inav?

victorangell commented 3 years ago

Wenas tengo un problema con está placa le e instalado la 2.6.1 la e configurado para un ala y el servo N 3 se va al límite superior y para qué no se queme el servo lo tengo que poner así IMG_20210519_180151_418

WMage commented 3 years ago

inav_2.6.1_JHEF7DUAL.zip

thanks, almost perfect, but found some issue at rhh, can u help me how to fix that? when i activate RTH mode, airfract starts crazy movements, blackbox data shows: CAMSTAB similar issue on ATTI HOLD mode , crazy moves and blackbox indicates CAMTRING (searched, and not found, looks this mode not actually exists, so total confused)

KrackJack1 commented 3 years ago

inav_2.6.1_JHEF7DUAL.zip

3.0 please 😊 thank you for you efforts 🙏

terminat25 commented 3 years ago

inav_3.0.0_JHEF7DUAL.zip

KrackJack1 commented 3 years ago

inav_3.0.0_JHEF7DUAL.zip

You are Awesome thanks mate...🥳🥳🥳

s2kaka commented 3 years ago

can it use for Wing setup?

terminat25 commented 3 years ago

I only have a copter. But in theory it should.

Снимок
boygenius18 commented 3 years ago

Anyone know if inav_3.0.0_JHEF7DUAL.zip works with JHEMCU F722 AIO 40A? Planning to use this for quadcopter setup.

boygenius18 commented 3 years ago

The specs for JHEMCU F722 AIO 40A says the BF firmware is JHEF7DUAL. Is it really that different for the INAV version?

terminat25 commented 3 years ago

If JHEF7DUAL firmware for BF is suitable, then this firmware for INAV should also work. Need to try.

snaewe commented 3 years ago

inav_3.0.0_JHEF7DUAL.zip

@terminat25 Would you mind sharing the sources for this? Thx.

Morphin22 commented 3 years ago

Somebody has inav 3.0.1 for this FC?

kaiopaulinobr commented 3 years ago

Is this inav 3.0 fully working on this fc? someone tested ?

GavFPV commented 3 years ago

Hi all,

Looking to put this in a racewhoop build, but also want alt hold for extreme proximity flying at times, happy to test the latest fw builds, will let you know if i find anything

redeyejoe commented 2 years ago

@terminat25 I would like to also be able to use the JHEMCU F745 se board with INav, It uses the KAKUTEF7mini target in Betaflight, so should it not work with the INAV KAKUTEF7MINI target??

terminat25 commented 2 years ago

inav_4.0.0_JHEF7DUAL.zip