Where to start STM32H7 support

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

Moderators: barthess, RoccoMarco

tridge
Posts: 81
Joined: Mon Sep 25, 2017 8:27 am
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Where to start STM32H7 support

Postby tridge » Wed Feb 13, 2019 9:25 am

Giovanni wrote:One of those "feel stupid" moments...

I feel pretty silly too - I was staring at that line hard for a while before I finally noticed.

The good news is this has fixed a lot of stuff for the ArduPilot port on the H743

- OTG1 USB
- SPI works (3 buses in parallel, 3 IMUs, 2 baros, compass and FRAM)
- I2C works, with DMA (2 buses)
- 5 UARTs (but without DMA, using the ArduPIlot driver that makes DMA optional)
- PWM out works (6 outputs on main MCU)
- DCache and bouncebuffers all working (only on AXI SRAM for now)
- clock tree seems good, though I've only managed 384MHz with 8, 16 and 24 MHz crystals. Maybe we'd need 25MHz crystal to get 400?
- PWM buzzer
- LEDs (both I2C and GPIO)

things that don't work:
- ADC inputs (I haven't yet looked into that)
- UART DMA
- CAN
- SDMMC
- DShot PWM (needs a DMAR trick that will need some work)

The one I'll probably look at first is UART DMA, as that is the only one standing in the way of a first flight test. We have to use DMA on the UART going to the IOMCU (a STM32F103) as it runs as 1.5MBit and is timing critical.
It's getting close!

tridge
Posts: 81
Joined: Mon Sep 25, 2017 8:27 am
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Where to start STM32H7 support

Postby tridge » Thu Feb 14, 2019 9:55 pm

I've got ADCs and DMA on UARTs working now, so we're ready for an initial flight test.

I've started looking at SDMMC. At first glance it looks fairly similar to the F7 device, with some extra FIFO DMA registers and new features like polarity control. Some of the control bits in registers have moved around (eg. CLKDIV is wider). Do you think I should create a SDMMCv2, or try to work within SDMMCv1?

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

Re: Where to start STM32H7 support

Postby Giovanni » Thu Feb 14, 2019 10:09 pm

Hi,

It depends, if it is going to clutter the code with conditionals all over the place then better make a v2. If it is limited to a little different configuration then it could stay in v1. Usually the STM32 designers try hard to stay backward compatible.

You could add a key in the registry to differentiate, better to not put direct checks on the platform in the code.

Giovanni

tridge
Posts: 81
Joined: Mon Sep 25, 2017 8:27 am
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Where to start STM32H7 support

Postby tridge » Fri Feb 15, 2019 11:36 am

Giovanni wrote:It depends, if it is going to clutter the code with conditionals all over the place then better make a v2. If it is limited to a little different configuration then it could stay in v1.

It looks like the biggest difference is going to be the DMA. For the SPI conversion you made a nice new abstraction for handling the DMAMUX, but the SDMMC on the H7 doesn't use the DMAMUX, instead it has its own dedicated "Internal DMA" (IDMA) controller on the AHB.
So we'd have a bunch of compilation conditionals around the DMA code, plus some helper functions for setting up and handling the IDMA.
The non-DMA parts of the driver will be pretty close to the F7 version I think.
Still reading the reference manual ...

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

Re: Where to start STM32H7 support

Postby Giovanni » Fri Feb 15, 2019 11:55 am

Let me give it a try then, I will add mux support to the existing driver. You could help with tests, I don't have HW for that right now.

Giovanni

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

Re: Where to start STM32H7 support

Postby Giovanni » Sat Feb 16, 2019 6:43 pm

I committed a fix for that AXI errata problem, bug #1014.

Giovanni

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

Re: Where to start STM32H7 support

Postby Giovanni » Sun Feb 17, 2019 8:39 am

About SDMMC, it is different enough to deserve a "v2" driver.

Just porting the current driver should not be a huge problem but implementing the new supported features (higher speed modes, DDR mode, low voltage modes etc) would require changes to card detection/initialization code and lots of cards to test.

The new controller is the same on H7 and L4+.

Giovanni

tridge
Posts: 81
Joined: Mon Sep 25, 2017 8:27 am
Has thanked: 8 times
Been thanked: 9 times
Contact:

weird SPI memory striding bug on H743

Postby tridge » Mon Feb 18, 2019 11:23 am

I've got a really weird issue with SPI transfers. I'm hoping someone might have some suggestions on how to track it down.
I'm bringing up a 2nd H743 board, this one with a 16MHz HSE. When I do SPI transfers I get an extra 0 byte between every received byte. For example if I read 2 bytes from an SPI device and expect to get 0x12 0x13 then it will instead get 0x00 0x12. If I extend the read and ask for 4 bytes then I get 0x00 0x12 0x00 0x13. The same thing happens on SPI1, SPI2 and SPI4 with 3 different SPI devices (a baro, a ramtron memory and a IMU).

I've checked the obvious things:
- DSIZE in cfg1 is indeed 0x7, for 8 bit transfers.
- rxdmamode and txdmamode both specify byte transfers

As the main difference with this board from the other one is the HSE of 16MHz (as opposed to 24MHz for the first board, and 8MHz for the Nucleo) I thought it may be something bad in the clock tree, so I've been trying lots of different clock setups with no luck. It is really driving me nuts.
Any suggestions? Anyone seen anything like this before?

bluuu
Posts: 5
Joined: Sun Dec 30, 2018 9:27 pm
Been thanked: 1 time

Re: Where to start STM32H7 support

Postby bluuu » Mon Feb 18, 2019 12:22 pm

are you using DMA for SPI ? maybe try to disable it just for test

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

Re: Where to start STM32H7 support

Postby Giovanni » Mon Feb 18, 2019 1:29 pm

It is like the DMA is setup for 16bits destination, so you will get 2 bytes for each byte. Strange, the SPI driver should select 16 bits destinations only if the selected frame size is greater than 8. Verify your SPI configuration.

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 3 guests