Where to start STM32H7 support

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Where to start STM32H7 support

Postby Giovanni » Mon Jan 13, 2020 8:46 pm

I must have missed it... anyway, I will give it a look.

Giovanni

tridge
Posts: 141
Joined: Mon Sep 25, 2017 8:27 am
Location: Canberra, Australia
Has thanked: 10 times
Been thanked: 20 times
Contact:

Re: Where to start STM32H7 support

Postby tridge » Mon Jan 13, 2020 9:16 pm

One thing I didn't finish on SDMMCv2 is setting the clocks correctly. I just left a #warning in the code:
https://github.com/ArduPilot/ChibiOS/bl ... lld.c#L519
It works like this, but the transfer rate isn't as fast as it should be. We normally don't need really fast transfers to/from microSD in ArduPilot so I didn't put more time into it. That may change as we are looking at adding OTG_HS support, and users will want to take advantage of that for fast log downloads.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Where to start STM32H7 support

Postby Giovanni » Tue Jan 14, 2020 10:21 am

I committed an untested driver.

Tridge, there several things I don't understand in your implementation so I cannot use it as-is, in additions it refers some external code (bouncebuffer) which is not part of the driver.

I made the minimal changes to SDMMCv1 to use IDMA instead of DMA, I will test as soon I get a board with an SD connector.

Giovanni

tridge
Posts: 141
Joined: Mon Sep 25, 2017 8:27 am
Location: Canberra, Australia
Has thanked: 10 times
Been thanked: 20 times
Contact:

Re: Where to start STM32H7 support

Postby tridge » Thu Jan 16, 2020 2:17 am

Giovanni wrote:Tridge, there several things I don't understand in your implementation so I cannot use it as-is, in additions it refers some external code (bouncebuffer) which is not part of the driver.

yes, I have bouncebuffer hooks in SDIOv1 and SDMMCv1 too. I really don't understand how other ChibiOS users are surviving with complex code and FATFS without bouncebuffers and without driving themselves mad. There are so many memory regions on recent MCUs with restrictions on what regions can be used with what devices. Without the bouncebuffer hooks user code must be doing a bunch of extra work to ensure they use memory that works with each device.
For things like SPI and I2C we place the bouncebuffer hooks in the higher level ArduPilot code so the ChibiOS LLD can remain clean. For the SDIO and SDMMC we can't do that as FATFS is calling these functions without going via any ArduPilot code.
I really think ChibiOS should have an optional bouncebuffer abstraction. You can see the implementation we have for ArduPilot here:
https://github.com/ardupilot/ardupilot/ ... cebuffer.h
https://github.com/ardupilot/ardupilot/ ... cebuffer.c
I made the minimal changes to SDMMCv1 to use IDMA instead of DMA, I will test as soon I get a board with an SD connector.

I'm very happy to send you one of the ArduPilot supported boards that has an H743 if you like. I did offer this previously but never got an address to send it to.
Cheers, Tridge

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Where to start STM32H7 support

Postby Giovanni » Sat Jan 18, 2020 11:37 am

Hi Tridge,

I committed an SDMMCv2 driver, it is a bit different because it uses a new mode of starting the data state machine, setting DTEN is no more "valid" even if it still works apparently. It also includes some clock-related improvements. Timeouts handling is different too.

I tested it on STM32L4R9, it compiles on H7 but I have not tested it yet, it seems to be exactly the same IP.

I agree with you that H7 makes things unnecessarily complex when using SDC, the driver assumes that the stack is DMA-accessible and this is not necessarily the case. I will change the driver structure soon, this should make integration easier.

About the board, I will send you an address in PM, I imagine you already have board files done, right?

Giovanni

tridge
Posts: 141
Joined: Mon Sep 25, 2017 8:27 am
Location: Canberra, Australia
Has thanked: 10 times
Been thanked: 20 times
Contact:

Re: Where to start STM32H7 support

Postby tridge » Sat Jan 18, 2020 11:11 pm

Giovanni wrote:I committed an SDMMCv2 driver, it is a bit different because it uses a new mode of starting the data state machine, setting DTEN is no more "valid" even if it still works apparently. It also includes some clock-related improvements. Timeouts handling is different too.

Thanks! I'll take a look
I agree with you that H7 makes things unnecessarily complex when using SDC, the driver assumes that the stack is DMA-accessible and this is not necessarily the case. I will change the driver structure soon, this should make integration easier.

yes, this problem is also on F7, it hits for example the dummytx, dummyrx words in SPIv1/SPIv2. That really restricts what memory layout you can use. I added dummy words in the config structure to fix that, so the caller can give dummy words to the lld.
About the board, I will send you an address in PM, I imagine you already have board files done, right?

we auto-generate board files for ArduPilot. I can do a patch for you that adds board files for the board I'll send you for ChibiOS master.
Cheers, Tridge

JSStabl
Posts: 78
Joined: Tue Feb 25, 2020 4:06 pm
Has thanked: 3 times
Been thanked: 2 times

Re: Where to start STM32H7 support

Postby JSStabl » Wed Feb 26, 2020 3:20 pm

How is the timeline of the CAN support for the h7? Anything I can do to help?

Also has anybody tested the h7 dualcores with chibios?

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Where to start STM32H7 support

Postby Giovanni » Wed Feb 26, 2020 4:35 pm

JSStabl wrote:How is the timeline of the CAN support for the h7? Anything I can do to help?

Also has anybody tested the h7 dualcores with chibios?


CAN support will start soon, it is the next thing in the list.

I tried just the M7, anybody knows how to debug the M4 using OpenOCD and ST-Link? that is the blocking point right now.

Giovanni

JSStabl
Posts: 78
Joined: Tue Feb 25, 2020 4:06 pm
Has thanked: 3 times
Been thanked: 2 times

Re: Where to start STM32H7 support

Postby JSStabl » Thu Feb 27, 2020 8:58 am

I managed to flash the M4 Core on the STM32MP1, unsure if its similar for the H7. Needed to put the Board into "engineering mode" for that.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Where to start STM32H7 support

Postby Giovanni » Sat Mar 14, 2020 11:01 am

SDMMCv2 driver is working on an L4+, could somebody confirm it is working on the H7? Tridge?

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: Bing [Bot] and 9 guests