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 » Tue Feb 19, 2019 10:48 am

Giovanni wrote:Could you test another board of the same kind?

It happens on both boards that I have of the same type.

Regarding SPIv3, why don't we set TSIZE? When I tried setting TSIZE I get all zero data, which really doesn't make sense. The sthal/h7 code does set TSIZE, and I presume that works. Maybe that is a clue?

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 » Tue Feb 19, 2019 11:20 am

I don't understand why it should happen only on one board type. It must be the device type, we should assume that the BGA device is a different silicon and has an errata not present on other devices.

Giovanni

User avatar
FXCoder
Posts: 183
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 66 times
Been thanked: 52 times

Re: Where to start STM32H7 support

Postby FXCoder » Tue Feb 19, 2019 11:32 am

The language in the RM is a little challenging to read WRT the FIFO packing in the SPI controller.
I thought perhaps using DMA removes the requirement for setting TSIZE.
However, the RM does say the following which seems to suggest that TSIZE must be set regardless of packing, etc.

Data packing with DMA
If the transfers are managed by DMA (TXDMAEN and RXDMAEN set in the SPI_CFG1
register) the packing mode is enabled/disabled automatically depending on the PSIZE value
configured for SPI TX and the SPI RX DMA channel.
If the DMA channel PSIZE value is equal to 16-bit or 32-bit and SPI data size is less than or
equal to 8-bit, then packing mode is enabled. Similarly, If the DMA channel PSIZE value is
equal to 32-bit and SPI data size is less than or equal to 16-bit, then packing mode is
enabled.The DMA then automatically manages the write operations to the SPI2S_TXDR
register.
Regardless data packing mode is used and the number of data to transfer is not a multiple
of the DMA data size (16-bit or 32-bit) while the frame size is smaller, DMA completes the
transfer automatically in according with the TSIZE field setting.
Alternatively, last data frames may be written by software, in the single/unpacked mode.
To configure any DMA data access less than the configured data size is forbidden. One
complete data frame has to be always accessed at minimum.


It could be a silicon bug...

2.10.1 Spurious DMA Rx transaction after simplex Tx traffic

"Description

With empty RXFIFO, SPI/I2S can spuriously generate a DMA read request upon enabling DMA receive traffic (by setting RXDMAEN bit), provided that the preceding completed transaction is a simplex transmission.

Workaround

Before enabling DMA Rx transfer following a completed Tx simplex transfer, perform hardware reset of the SPI/I2S peripheral."

--
Bob

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 » Tue Feb 19, 2019 11:47 am

FXCoder wrote:The language in the RM is a little challenging to read WRT the FIFO packing in the SPI controller.
I thought perhaps using DMA removes the requirement for setting TSIZE.
However, the RM does say the following which seems to suggest that TSIZE must be set regardless of packing, etc.

yes, it should work with zero TSIZE, but I think the intended use is to set it. We may also need to set the fifo threshold however.

2.10.1 Spurious DMA Rx transaction after simplex Tx traffic

ahh, I'd forgotten that one!
Before enabling DMA Rx transfer following a completed Tx simplex transfer, perform hardware reset of the SPI/I2S peripheral."

perhaps a dumb question, but what exactly do they mean by "perform hardware reset" ? If its just unset and set SPE then we already do that (as the ArduPilot wrapper code does a spiStop after each transaction)
Is there something else thats needed for a "hardware reset" of SPI ?

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 » Tue Feb 19, 2019 11:51 am

I think the "HW reset" is what you do through RCC, there is an rccResetSPIx() macro for that in HAL.

What is the meaning of "simplex TX" anyway? the HAL driver always performs both RX and TX transfers so there should never be unread RX frames in the RX data register.

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 » Tue Feb 19, 2019 12:21 pm

Giovanni wrote:I think the "HW reset" is what you do through RCC, there is an rccResetSPIx() macro for that in HAL

thanks! I'll give that a go
What is the meaning of "simplex TX" anyway? the HAL driver always performs both RX and TX transfers so there should never be unread RX frames in the RX data register.

the ChibiOS hal always does that, but sthal doesn't seem to setup a RX DMA channel for transmit only.
btw, the dummyrx and dummytx bytes used in hal_spi_lld.c to do simplex caused me some issues when I setup main memory as DTCM (I thought it would be faster). The easy workaround was to always use spiExchange() and setup my own dummy buffers in DMA safe memory, but that is a bit of a trap on H7.
Cheers, Tridge

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 » Tue Feb 19, 2019 12:27 pm

Giovanni wrote:I think the "HW reset" is what you do through RCC, there is an rccResetSPIx() macro for that in HAL.

I just tried that on SPI5. It didn't fix the issue :(

User avatar
alex31
Posts: 268
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 16 times
Been thanked: 32 times
Contact:

Re: Where to start STM32H7 support

Postby alex31 » Wed Feb 20, 2019 9:20 am

Hi,

I am planning a new (open source) project, an high frequency digital and analog acquisition board, I initially planned to use a F7, but the users insist on having 16 bits ADC, and stm32h7 is one of the few stm32 MCU that offers 16 bits ADC.


I follow the quick pace of progress on the H7 side thanks to Tridge, and i wanted to know if the work that has been done for ardupilot is integrated in trunk, or if ardupilot maintains his own branch ?

Also, what is the state of Ethernet support for the H7 ?

Alexandre

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 20, 2019 9:26 am

alex31 wrote:I follow the quick pace of progress on the H7 side thanks to Tridge, and i wanted to know if the work that has been done for ardupilot is integrated in trunk, or if ardupilot maintains his own branch ?

ArduPilot does have it's own branch:

https://github.com/ArduPilot/ChibiOS/tr ... upport-v19

I don't think you will need it though. That branch is recently rebased on top of the current stable_19.1.x branch from ChibiOS svn. There are a few fixes there you may want to grab, but mostly it is things needed for ArduPilot (eg. adding fatfs support, bouncebuffers for DMA for some peripherals, paranoia for bad i2c peripherals with noisy cables etc).

Also, what is the state of Ethernet support for the H7 ?

don't know, sorry. I have never used ethernet on STM32.
Cheers, Tridge

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 » Wed Feb 20, 2019 9:44 am

Hi,

Ethernet requires a new driver, the peripheral looks different.

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 5 guests