Page 11 of 24
Re: Where to start STM32H7 support
Posted: Tue Feb 19, 2019 10:48 am
by tridge
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?
Re: Where to start STM32H7 support
Posted: Tue Feb 19, 2019 11:20 am
by Giovanni
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
Re: Where to start STM32H7 support
Posted: Tue Feb 19, 2019 11:32 am
by FXCoder
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
Re: Where to start STM32H7 support
Posted: Tue Feb 19, 2019 11:47 am
by tridge
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 ?
Re: Where to start STM32H7 support
Posted: Tue Feb 19, 2019 11:51 am
by Giovanni
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
Re: Where to start STM32H7 support
Posted: Tue Feb 19, 2019 12:21 pm
by tridge
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
Re: Where to start STM32H7 support
Posted: Tue Feb 19, 2019 12:27 pm
by tridge
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

Re: Where to start STM32H7 support
Posted: Wed Feb 20, 2019 9:20 am
by alex31
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
Re: Where to start STM32H7 support
Posted: Wed Feb 20, 2019 9:26 am
by tridge
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-v19I 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
Re: Where to start STM32H7 support
Posted: Wed Feb 20, 2019 9:44 am
by Giovanni
Hi,
Ethernet requires a new driver, the peripheral looks different.
Giovanni