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 new board "MatekH743-slim" #18544

Merged
merged 10 commits into from
Nov 7, 2021
Merged

Added new board "MatekH743-slim" #18544

merged 10 commits into from
Nov 7, 2021

Conversation

vvladic
Copy link
Contributor

@vvladic vvladic commented Oct 31, 2021

Hi guys,

I just wanted to add support for this "MatekH743-slim" board.
The board is standard 30.5x30.5 size, has a pretty good layout with CAN port and faster 480MHz H743 MCU with 2MB flash.
Perfect for running advanced flight control like PX4 or AP on smaller aircraft.
Official vendor site is:
http://www.mateksys.com/?portfolio=h743-slim#tab-id-1
and can be bought for example here:
https://www.premium-modellbau.de/matek-h743-slim-stm32h7-slim-flightcontroller-480mhz-ardupilot
or here:
https://www.banggood.com/30_5x30_5mm-Matek-Systems-H743-SLIM-Flight-Controller-5V-BEC-MPU6000-7x-UARTs-OSD-for-RC-Drone-FPV-Racing-Multirotor-Multicopter-p-1755036.html?cur_warehouse=CN&rmmds=search

I did a first test flight today:
https://review.px4.io/plot_app?log=b6a595a1-9580-4676-8bcd-132a78817dc9

This is my first pull request, so any comments and suggestions are welcome.

quad_matek_px4

*.cmake are not used any more
svd relocated
@dagar
Copy link
Member

dagar commented Oct 31, 2021

Thanks @vvladic, this is a very nice little flight controller for ~ $70.

Screenshot from 2021-10-31 15-17-43

@dagar
Copy link
Member

dagar commented Oct 31, 2021

Can you check the icm20602 data ready pin?
Screenshot from 2021-10-31 15-18-59

initIOTimerChannel(io_timers, {Timer::Timer5, Timer::Channel4}, {GPIO::PortA, GPIO::Pin3}),
initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel1}, {GPIO::PortD, GPIO::Pin12}),
initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel2}, {GPIO::PortD, GPIO::Pin13}),
// initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel3}, {GPIO::PortD, GPIO::Pin14}),
Copy link
Member

Choose a reason for hiding this comment

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

Why are these channels commented?

Copy link
Contributor Author

@vvladic vvladic Nov 1, 2021

Choose a reason for hiding this comment

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

The board normally has 12 PWM outputs, but after configuring all of them, system was unable to boot due to src/drivers/pwm_out/PWMOut.cpp not doing anything for DIRECT_PWM_OUTPUT_CHANNELS values between 9 and 13.
So I decided for getting the board to work properly with 8 channels first, and adding 4 more channels later if everything goes well and when I understand the architecture better. I was not feeling comfortable with changing too much in my first pull request :-)

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense, we'll come back to it.

@dagar
Copy link
Member

dagar commented Oct 31, 2021

Do you find the board temperature acceptable on the bench? I was thinking about lowering the default cpu frequency on these h7 boards to reduce the temperature. #18198

Screenshot from 2021-10-31 15-26-11

vvladic and others added 2 commits November 1, 2021 11:29
Co-authored-by: Daniel Agar <daniel@agar.ca>
Co-authored-by: Daniel Agar <daniel@agar.ca>
@vvladic
Copy link
Contributor Author

vvladic commented Nov 1, 2021

Can you check the icm20602 data ready pin? Screenshot from 2021-10-31 15-18-59

After some googling, and looking at how others configured this pin for this board, it looks like there are 3 versions of this board.
Original one with ICM20602, second one with MPU6500 instead of ICM20602 (which should have DRDY routed to PE15), and the latest one being shipped with ICM42605 instead of ICM20602.

After removing SPI::DRDY{GPIO::PortE, GPIO::Pin15}) from src/spi.cpp, I get:

nsh> icm20602 status
INFO  [SPI_I2C] Running on SPI Bus 4
INFO  [icm20602] FIFO empty interval: 1000 us (1000.0 Hz)
icm20602: bad register: 0 events
icm20602: bad transfer: 0 events
icm20602: FIFO empty: 1 events
icm20602: FIFO overflow: 1 events
icm20602: FIFO reset: 2 events

@vvladic
Copy link
Contributor Author

vvladic commented Nov 1, 2021

Do you find the board temperature acceptable on the bench? I was thinking about lowering the default cpu frequency on these h7 boards to reduce the temperature. #18198

Screenshot from 2021-10-31 15-26-11

I think the temperature is around 45..55°C, depending on room temperature. I guess that's not that bad. But lowering the temperature sure won't hurt.

@dagar
Copy link
Member

dagar commented Nov 2, 2021

I haven't reviewed this pin for pin, but overall it looks good. The one important omission I noticed is the lack of non-volatile parameter storage (eg FLASH_BASED_PARAMS in board_config.h).

To use flash based parameter storage

  1. add #define FLASH_BASED_PARAMS in board_config.h
  2. update the linker script (nuttx-config/scripts/script.ld) to push the app back by 2 sectors
  3. create the sector map in init.c (eg
    #if defined(FLASH_BASED_PARAMS)
    static sector_descriptor_t params_sector_map[] = {
    {1, 32 * 1024, 0x08008000},
    {2, 32 * 1024, 0x08010000},
    {0, 0, 0},
    };
    /* Initialize the flashfs layer to use heap allocated memory */
    result = parameter_flashfs_init(params_sector_map, NULL, 0);
    if (result != OK) {
    syslog(LOG_ERR, "[boot] FAILED to init params in FLASH %d\n", result);
    led_on(LED_AMBER);
    return -ENODEV;
    }
    #endif
    )

Once that's in place parameters should be persistent.

@vvladic vvladic closed this Nov 2, 2021
@vvladic vvladic reopened this Nov 2, 2021
@dagar
Copy link
Member

dagar commented Nov 5, 2021

@vvladic I'm evaluating disabling the SPI DMA threshold entirely for the H7 boards. This was a small optimization we put in place because setting up the DMA transaction took more time than the potential savings for very small transfers on older F4 boards.

#18571

Copy link
Member

@dagar dagar left a comment

Choose a reason for hiding this comment

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

This looks good to merge as is, we can continue working on it incrementally in master.

TODO:

  • mpu6000 issue
  • consider using flash based parameters

@nominator
Copy link

Hi @vvladic

Since its been a while there was any activity on this thread. I am interested in flashing this board with PX4 and wanted to know how was the overall experience running PX4 on this board. Any issues that I should be aware of? and if any particular revision of the board is more suitable. I am planning to use the following revision of the board

Matek H743 Slim, Rev = 3.22v
MCU H743 (Rev.V) Clock=480MHz, Vref=3.22V, Core temp=43degC
Stack size: 2048, Stack address: 0x2001fff8
Configuration: CONFIGURED, size: 3947, max available: 131072
Devices detected: SPI:2, I2C:1
Gyros detected: gyro 1, gyro 2 locked dma
GYRO=ICM42688P, ACC=ICM42688P, BARO=DPS310
OSD: MAX7456
System Uptime: 2101 seconds, Current Time: 2023-12-05T12:44:22.459+00:00
CPU:23%, cycle time: 124, GYRO rate: 8064, RX rate: 15, System rate: 9
Voltage: 0 * 0.01V (0S battery - NOT PRESENT)
I2C Errors: 5
SD card: Manufacturer 0x3, 247040kB, 01/2008, v8.0, 'SU256'
Filesystem: Ready
Arming disable flags: RXLOSS CLI MSP RPMFILTER

Any feedback on performance of this board running PX4 will be highly appreciated.

Thanks
Nouman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants