iNavFlight / inav

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

Support JHEMCU f4 NOXE V3 #8044

Closed MoesMo closed 1 year ago

MoesMo commented 2 years ago

Hello, maybe I missed something. I would like to see support for this flight controller. At the moment I have a suitable firmware from Betaflight but it is for a quadcopter. And I'm building a plane .FLYWOOF411 is not suitable, FC does not see the gyroscope and accelerometer I provide a dump from a working betafly with a config, as well as from the inav firmware that I uploaded FLYWOOF411V2 on this firmware, the flight controller starts but there is no gyro and you need to reassign the conclusions regarding the betafly, that is, do remapping https://disk.yandex.ru/d/QHE_6rg9c1F5eA

MoesMo commented 1 year ago

@DzikuVx Ok no problem, How can we easily solve the problem with the official support of the goal?

DzikuVx commented 1 year ago

The rules are the same for every target and described here https://github.com/iNavFlight/inav/blob/master/docs/policies/NEW_HARDWARE_POLICY.md

odddollar commented 1 year ago

Now that INAV 6 is out on full release, I have managed to compile it for this target using instructions from @p-fpv

JHEMCUF411NOXEv3_INAV6.zip

Viga7474 commented 1 year ago

Теперь, когда INAV 6 выпущен в полной версии, мне удалось скомпилировать его для этой цели, используя инструкции из@p-fpv

JHEMCUF411NOXEv3_INAV6.zip

Have you tried this on a copter? I have only 1 and 4 motors running.

Viga7474 commented 1 year ago

It is possible that the problem is in these parameters, but I could not change them through the interface and the CLI. Maybe I'm doing something wrong.

resources

Mixer: motor mixer

mmix reset

mmix 0 1.000 -1.000 1.000 -1.000 mmix 1 1.000 -1.000 -1.000 1.000 mmix 2 1.000 1.000 1.000 1.000 mmix 3 1.000 1.000 -1.000 -1.000

Mixer: servo mixer

Outputs [servo]

odddollar commented 1 year ago

Теперь, когда INAV 6 выпущен в полной версии, мне удалось скомпилировать его для этой цели, используя инструкции из@p-fpv

JHEMCUF411NOXEv3_INAV6.zip

Have you tried this on a copter? I have only 1 and 4 motors running.

This is for a fixed wing. The target files were provided by @p-fpv, I just compiled it. It appears as though the outputs are fixed as one motor and 3 servos.

It might be possible to edit the target.c file to change them all to motor outputs, but that's probably beyond my field of knowledge.

odddollar commented 1 year ago

I've just checked the target files, and it appears that all s1, s2, s3 and s4 should all be configured at motor outputs when a multicopter mixer/platform is selected. So this target should also work for quadcopters.

It is possible that the problem is in these parameters, but I could not change them through the interface and the CLI. Maybe I'm doing something wrong.

resources

Mixer: motor mixer

mmix reset

mmix 0 1.000 -1.000 1.000 -1.000 mmix 1 1.000 -1.000 -1.000 1.000 mmix 2 1.000 1.000 1.000 1.000 mmix 3 1.000 1.000 -1.000 -1.000

Mixer: servo mixer

Outputs [servo]

Check if you've got an airplane or quad mixer selected.

Viga7474 commented 1 year ago

Yes, everything is chosen correctly. It looks like you are right and need to edit the target.

odddollar commented 1 year ago

I checked the target and all the outputs are set as motor outputs for a quadcopter. I don't know what the problem is then. I only have this flight controller in a plane and it works fine.

Viga7474 commented 1 year ago

I checked the target and all the outputs are set as motor outputs for a quadcopter. I don't know what the problem is then. I only have this flight controller in a plane and it works fine.

Thanks for the reply. So I'll wait, maybe someone will test it on a copter or adapt the firmware for a copter.

nbertram commented 1 year ago

I built this for the 6.0.0 stable and it appears to work properly, though I had an error "Not enough servo outputs/timers" in the CLI status that was preventing any PWM output from the servos.

Turned out the plane preset had configured four servo outputs (in addition to the motor), so deleting the fourth from the mixer and configuring the others correctly made the error go away and I had output.

Just thought I'd put that here for anyone else trying on 6.0.0 and having an out of the box issue.

I'm also interested in having an actual fourth servo output so I can have separate aileron servos, and thought I should be able to repurpose the PA1 current sense pin on to TIM1 to achieve it? I'll report back if it works...

constantin24rus commented 1 year ago

Please tell me, I used all the firmware that are presented here, and the gyroscope and accelerometer do not work on any of them, but it works on betaflight 4.3, what needs to be done? Thanks. ![Uploading IMG_20230413_090256_474.jpg…]()

MoesMo commented 1 year ago

https://github.com/iNavFlight/inav/files/10995136/JHEMCUF411NOXEv3_INAV6RC3.zip @constantin24rus
latest firmware made by @p-fpv

Try to flash from under the beta. In the archive 5 and 6 inav there are also targets for self-picking the firmware. Everything should work if the firmware is correct in the programmer, select the inav_6.0.0_JHEMCUF411NOXEv3.hex Or other version file locally and try to flash it. also need DFU drivers

constantin24rus commented 1 year ago

https://github.com/iNavFlight/inav/files/10995136/JHEMCUF411NOXEv3_INAV6RC3.zip @constantin24rus latest firmware made by @p-fpv

Try to flash from under the beta. In the archive 5 and 6 inav there are also targets for self-picking the firmware. Everything should work if the firmware is correct in the programmer, select the inav_6.0.0_JHEMCUF411NOXEv3.hex Or other version file locally and try to flash it. also need DFU drivers

I asked the manufacturer for a normal firmware for inav, he sent me this archive, I flashed inav and everything started working for me, but there was a problem, servos and motors could not work at the same time, I tried to sew betaflight and reassign outputs to the CLI, by trial, went through all the outputs and eventually the same thing works either servos or motors. https://share.weiyun.com/h4Z2va2f

IvanBiv commented 1 year ago

@MoesMo I confirm the problem from @constantin24rus

On the board with BMI270 it works, but on the board with ICM42688p it does not work. It just does not detect the accelerometer and gyroscope. The situation is similar with the latest betaflight 4.4.1 firmware, but these sensors work fine on 4.3.1. photo_5325840600903305366_y photo_5325840600903305367_y

Update On betaflight 4.5.0 it work fine. https://github.com/betaflight/betaflight/issues/12686

p-fpv commented 1 year ago

@Viga7474 try to change the set output_mode = MOTORS or change the esc protocol, also try the manufacturer's firmware , by date it looks like it has finally been updated to the latest version, but it seems that the problem of simultaneous operation of servos and motors has not been eliminated.
@constantin24rus the solution for the manufacturer's firmware has already been written by @MartinGiersberg, set output_mode=SERVOS.
@constantin24rus @IvanBiv try this firmware, tried adding ICM42688p.

JHEMCUF411NOXEv3.zip
I'm not sure that it's worth continuing to build the firmware yourself, since the manufacturer has updated his own. If someone decides to fix something or build their firmware, then my target is also in the archive

IvanBiv commented 1 year ago

JHEMCUF411NOXEv3.zip I'm not sure that it's worth continuing to build the firmware yourself, since the manufacturer has updated his own. If someone decides to fix something or build their firmware, then my target is also in the archive

It works! Manufacturer firmware have a problem - not work with version ICM42688p https://github.com/jhemcu/FC-ESC-Firmware/blob/main/F4%20NOXE%20V3/inav_6.0.0_JHEMCUF411.rar

MoesMo commented 1 year ago

Guys, are you serious? The manufacturer impudently takes firmware from this topic (does it bother you what HEX is there?, when Trogalko was the first to fix the gyroscope (registered the driver, gyroscope), then the manufacturer rolled out the firmware, now the situation is similar. Therefore, motors and servos do not work at the same time @p-fpv @IvanBiv

MoesMo commented 1 year ago

Well, now it will work with the manufacturer with ICM42688p @p-fpv

MoesMo commented 1 year ago

another gyroscope / accelerometer BMI270 V1\ ICM42688p V2

Can you tell me what first firmware you took as a basis? @p-fpv

DEF_TIM(TIM1, CH1, PA8, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0, 1), // S1_OUT 2,1 DEF_TIM(TIM1, CH2, PA9, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0, 1), // S2_OUT 2,2 DEF_TIM(TIM1, CH3, PA10, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0, 0), // S3_OUT 2,6 DEF_TIM(TIM3, CH3, PB0, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0, 0), // S4_OUT 1,7 This is with flywoof v2 i have a question , notice 0 , 1 near servos and motors . For what purpose are affixed 1

MoesMo commented 1 year ago

When I initially assembled it myself, with these parameters the engine did not start

p-fpv commented 1 year ago

@MoesMo I'm not sure that there is the same hex, I can't register for download using the link from @constantin24rus.

I don't remember which target I took as a basis. I think we need to put 0,1 in the same way as flywoo, it looks more correct there, and not as it is now with 0,0.

As I understood, 0 and 1 are dma settings, but since I don't understand it, it seems I didn't pay much attention to it. I think it is necessary to specify 0,1,... so that the timers and channels do not have the same values D(2, 6, 0), etc, this can be viewed in the files below. https://github.com/iNavFlight/inav/blob/master/src/main/drivers/timer_def_stm32f4xx.h Maybe these links will help too

In the picture under the spoiler, D(2, 6, 0) will correspond to the table dma2, stream 6, channel 0 [![DMA request mapping][1]][1] [1]: https://user-images.githubusercontent.com/103542588/232926526-5fe11b0c-9d56-4001-bfd4-3a8bc67ff92c.png

https://github.com/iNavFlight/inav/discussions/6465
https://github.com/iNavFlight/inav/blob/master/src/main/drivers/timer_def.h

Does the s3 motor not work with the parameters from here? https://github.com/iNavFlight/inav/issues/8044#issuecomment-1513840071
Try the firmware with such changes in target.c, perhaps the dma changes will make the plane and copter work correctly Test JHEMCUF411NOXEv3.zip @Viga7474

DEF_TIM(TIM1, CH1, PA8,  TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO,  0, 1), // S1_OUT 2,1 D(2, 1, 6)     
DEF_TIM(TIM1, CH2, PA9,  TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO,  0, 1), // S2_OUT 2,2 D(2, 2, 6)    
DEF_TIM(TIM1, CH3, PA10, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO,  0, 1), // S3_OUT 2,6 D(2, 6, 6)      
DEF_TIM(TIM3, CH3, PB0,  TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR,  0, 0), // S4_OUT 1,7 D(1, 7, 5)    
MoesMo commented 1 year ago

@p-fpv Throw a link to your youtube, and I congratulate you, everything works

VirusIII commented 1 year ago

@MoesMo I'm not sure that there is the same hex, I can't register for download using the link from @constantin24rus.

I don't remember which target I took as a basis. I think we need to put 0,1 in the same way as flywoo, it looks more correct there, and not as it is now with 0,0.

As I understood, 0 and 1 are dma settings, but since I don't understand it, it seems I didn't pay much attention to it. I think it is necessary to specify 0,1,... so that the timers and channels do not have the same values D(2, 6, 0), etc, this can be viewed in the files below. https://github.com/iNavFlight/inav/blob/master/src/main/drivers/timer_def_stm32f4xx.h Maybe these links will help too

In the picture under the spoiler, D(2, 6, 0) will correspond to the table dma2, stream 6, channel 0

6465 https://github.com/iNavFlight/inav/blob/master/src/main/drivers/timer_def.h

Does the s3 motor not work with the parameters from here? #8044 (comment) Try the firmware with such changes in target.c, perhaps the dma changes will make the plane and copter work correctly Test JHEMCUF411NOXEv3.zip @Viga7474

DEF_TIM(TIM1, CH1, PA8,  TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO,  0, 1), // S1_OUT 2,1 D(2, 1, 6)     
DEF_TIM(TIM1, CH2, PA9,  TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO,  0, 1), // S2_OUT 2,2 D(2, 2, 6)    
DEF_TIM(TIM1, CH3, PA10, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO,  0, 1), // S3_OUT 2,6 D(2, 6, 6)      
DEF_TIM(TIM3, CH3, PB0,  TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR,  0, 0), // S4_OUT 1,7 D(1, 7, 5)    

You changed assigment for tx1 and rx1. is this uart1 no longer available as a uart1? `

DEF_TIM(TIM2, CH1, PA15, TIM_USE_ANY, 0, 0), //softserial_tx1 - LED pin DEF_TIM(TIM2, CH3, PB10, TIM_USE_ANY, 0, 0), //softserial_rx1 - cam ctrl pin `

Raffda commented 1 year ago

@Viga7474 try to change the set output_mode = MOTORS or change the esc protocol, also try the manufacturer's firmware , by date it looks like it has finally been updated to the latest version, but it seems that the problem of simultaneous operation of servos and motors has not been eliminated. @constantin24rus the solution for the manufacturer's firmware has already been written by @MartinGiersberg, set output_mode=SERVOS. @constantin24rus @IvanBiv try this firmware, tried adding ICM42688p.

JHEMCUF411NOXEv3.zip I'm not sure that it's worth continuing to build the firmware yourself, since the manufacturer has updated his own. If someone decides to fix something or build their firmware, then my target is also in the archive

i used that target for a while an it worket perfekt for me. but i have one question. is ist possible to remap the led pad as smartaudio pad? and can some one help me with that?

odddollar commented 1 year ago

The LED pad should already be mapped to soft-serial, so you should be able to select SmartAudio on that port.

odddollar commented 1 year ago

@DzikuVx if this has been marked as "Closed/completed", does this mean this board is now officially supported?

Pelado-Mat commented 7 months ago

BTW, the board is still working with INAV 7.1RC1 You need to use the target files from the rar and change the file target.c

  timerHardware_t timerHardware[] = {                                                                                                   

      DEF_TIM(TIM1, CH1, PA8,   TIM_USE_SERVO, 0, 0), // S1                                                                             
      DEF_TIM(TIM1, CH2, PA9,   TIM_USE_SERVO, 0, 0), // S2                                                                             
      DEF_TIM(TIM1, CH3, PA10,  TIM_USE_SERVO, 0, 0), // S3                                                                             
      DEF_TIM(TIM3, CH3, PB0,   TIM_USE_MOTOR, 0, 0), // S4                                                                             

      DEF_TIM(TIM2, CH1, PA15,  TIM_USE_ANY,   0, 0), //softserial_tx1 - LED pin                                                        
      DEF_TIM(TIM2, CH3, PB10,  TIM_USE_ANY,   0, 0), //softserial_rx1 - cam ctrl pin                                                   

  };  

Im currently flying it on a wing without any issues so far.

odddollar commented 7 months ago

Yeah, I've had good luck with 7.0 using these:

target.c

#include <stdbool.h>
#include <platform.h>

#include "drivers/bus.h"
#include "drivers/io.h"
#include "drivers/pwm_mapping.h"
#include "drivers/timer.h"
#include "drivers/pinio.h"

timerHardware_t timerHardware[] = {
    DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 0),  // S1
    DEF_TIM(TIM1, CH2, PA9, TIM_USE_OUTPUT_AUTO, 0, 0),  // S2
    DEF_TIM(TIM1, CH3, PA10, TIM_USE_OUTPUT_AUTO, 0, 0), // S3
    DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0),  // S4

    DEF_TIM(TIM2, CH1, PA15, TIM_USE_ANY, 0, 0), // softserial_tx1 - LED pin
    DEF_TIM(TIM2, CH3, PB10, TIM_USE_ANY, 0, 0), // softserial_rx1 - cam ctrl pin
};

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

target.h

#pragma once

#define TARGET_BOARD_IDENTIFIER "JHEF"
#define USBD_PRODUCT_STRING "JHEMCU_F411_NOXE_v3"

#define LED0 PC13

#define BEEPER PC14
#define BEEPER_INVERTED

// *************** SPI **********************
#define USE_SPI

#define USE_SPI_DEVICE_1
#define SPI1_SCK_PIN PA5
#define SPI1_MISO_PIN PA6
#define SPI1_MOSI_PIN PA7

#define USE_SPI_DEVICE_2
#define SPI2_SCK_PIN PB13
#define SPI2_MISO_PIN PB14
#define SPI2_MOSI_PIN PB15

// *************** SPI Gyro & ACC **********************

#define IMU_CS_PIN PA4

// BMI270
#define USE_IMU_BMI270
#define IMU_BMI270_ALIGN CW270_DEG_FLIP
#define BMI270_CS_PIN IMU_CS_PIN
#define BMI270_SPI_BUS BUS_SPI1

// ICM42688P
#define USE_IMU_ICM42605
#define IMU_ICM42605_ALIGN CW0_DEG
#define ICM42605_CS_PIN IMU_CS_PIN
#define ICM42605_SPI_BUS BUS_SPI1

// MPU6000
#define USE_IMU_MPU6000
#define IMU_MPU6000_ALIGN CW180_DEG
#define MPU6000_CS_PIN IMU_CS_PIN
#define MPU6000_SPI_BUS BUS_SPI1

// *************** SPI OSD *****************************
#define USE_MAX7456
#define MAX7456_SPI_BUS BUS_SPI2
#define MAX7456_CS_PIN PB12

// *************** SPI FLASH **************************
#define USE_FLASHFS
#define USE_FLASH_M25P16
#define M25P16_CS_PIN PB2
#define M25P16_SPI_BUS BUS_SPI2
#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT

// *************** UART *****************************
#define USE_VCP

#define USE_UART1
#define UART1_TX_PIN PB6
#define UART1_RX_PIN PB7

#define USE_UART2
#define UART2_TX_PIN PA2
#define UART2_RX_PIN PA3

#define USE_SOFTSERIAL1
#define SOFTSERIAL_1_TX_PIN PA15 // pin led
#define SOFTSERIAL_1_RX_PIN PB10 // pin cam ctrl

#define SERIAL_PORT_COUNT 4 // VCP, USART1, USART2, ss1

#define DEFAULT_RX_TYPE RX_TYPE_NONE

// *************** Baro *****************************

#define USE_I2C
#define USE_I2C_DEVICE_1
#define I2C1_SCL PB8
#define I2C1_SDA PB9

#define USE_BARO
#define BARO_I2C_BUS BUS_I2C1
#define USE_BARO_BMP280
#define USE_BARO_MS5611
#define USE_BARO_BMP085
#define USE_BARO_DPS310
#define USE_BARO_SPL06

#define USE_MAG
#define MAG_I2C_BUS BUS_I2C1
#define USE_MAG_HMC5883
#define USE_MAG_QMC5883
#define USE_MAG_IST8310
#define USE_MAG_IST8308
#define USE_MAG_MAG3110
#define USE_MAG_LIS3MDL
#define USE_MAG_AK8975

// *************** ADC *****************************
#define USE_ADC
#define ADC_INSTANCE ADC1
#define ADC_CHANNEL_1_PIN PA1 // ADC_CURR
#define ADC_CHANNEL_2_PIN PA0 // ADC_BATT

#define CURRENT_METER_ADC_CHANNEL ADC_CHN_1
#define VBAT_ADC_CHANNEL ADC_CHN_2

// *************** OTHERS *************************
#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_VBAT)

#define USE_DSHOT
#define USE_ESC_SENSOR
#define USE_SERIAL_4WAY_BLHELI_INTERFACE

#define TARGET_IO_PORTA 0xffff
#define TARGET_IO_PORTB 0xffff
#define TARGET_IO_PORTC 0xffff
#define TARGET_IO_PORTD (BIT(2))

#define MAX_PWM_OUTPUT_PORTS 4

I've used these files to build a target for ages, and have had no problems.

odddollar commented 7 months ago

Someone on the INAV Discord server was looking for someone to build this target for them, so I thought it would be a good idea to upload all the versions I'd compiled myself. In this zip there's INAV 6.1, 6.1.1, 7.0 and 7.1, all full release versions (no pre-releases).

JHEMCUF411NOXEv3 INAV.zip

Disclaimer: These files have worked for the board I have. I think there might be some other variations with different IMU chips, but from what I can tell they should work too. Make sure you test your exact setup before taking off.

armaginus commented 7 months ago

Thanks man! You're a boss!!!

odddollar commented 6 months ago

I just compiled INAV 7.1.1 and included it in this new zip. I think this is the last version that will work with F411 flight controllers at all.

JHEMCUF411NOXEv3 INAV.zip

odddollar commented 5 months ago

Updated with INAV 7.1.2

JHEMCUF411NOXEv3.zip

mxchinist commented 3 months ago

Thanks ! Target.c and target.h from @VirusIII works also with the JHEMCU Ruibet F4AIO 12A 1-2S board and INAV 7.1.2 almost out of the box, just to make all four motors work, I had to change two values in target.c for motor 2 and 3:

timerHardware_t timerHardware[] = {

DEF_TIM(TIM1, CH1, PA8,  TIM_USE_MOTOR | TIM_USE_SERVO,  0, 1), // S1_OUT 2,1 D(2, 1, 6)
DEF_TIM(TIM1, CH2, PA9,  TIM_USE_MOTOR | TIM_USE_SERVO,  1, 1), // S2_OUT 2,2 D(2, 2, 6)
DEF_TIM(TIM1, CH3, PA10, TIM_USE_MOTOR | TIM_USE_SERVO,  1, 1), // S3_OUT 2,6 D(2, 6, 6)
DEF_TIM(TIM3, CH3, PB0,  TIM_USE_MOTOR | TIM_USE_MOTOR,  0, 0), // S4_OUT 1,7 D(1, 7, 5)

DEF_TIM(TIM2, CH1, PA15,  TIM_USE_ANY,   0, 0), //softserial_tx1 - LED pin
DEF_TIM(TIM2, CH3, PB10,  TIM_USE_ANY,   0, 0), //softserial_rx1 - cam ctrl pin

};

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