cancel
Showing results for 
Search instead for 
Did you mean: 

Why SPI3 not working on STM32H7 to acquire MEMS microphones

AAMAN.1
Associate II

Hi, I'm trying to port the SMARTMIC1 package (based on STM32F446) to the STM32H743 board with the CCAO2M2 board and MEMS microphones.

To acquire the audio I use 2 SPI : the SPI2 in Receive Only Master (SPI2_SCK on PD3 and SPI2_MISO on PC2) and the SPI3 in Receive Only Slave (SPI3_SCK on PC10 and SPI3_MOSI on PC12). Both of them have a DMA configuration : DMA1_stream3 for the SPI2 and DMA1_stream0 for the SPI3.

My problem is that my SPI2 is working perfectly but this is not the case with SPI3 and I don't know why.

So instead of SPI3, I tried with the SPI1 in Receive Only Slave with the same configuration of SPI3 on CubeMx and it works.

I would like to know what i can do to use the SPI3 in Receive Only Slave ?

Is there any limitation on the use of both SPI2 and SPI3 simultaneously ?

It is a urgent matter, so, your help will be really appreciated.

Thank you

7 REPLIES 7

How is the clock supplied to PC10?

JW

AAMAN.1
Associate II

@Community member​ All my clocks are working properly. My SPI devices work well at 2 times the frequency of microphones. A timer TIM3 is used to divide the frequency by 2 for microphones.

> All my clocks are working properly. My SPI devices work well

So what is the problem, then?

JW 

AAMAN.1
Associate II

@Community member​ The problem is that the data received on the SPI 3 are not the good ones (not those expected) and are not consistent with those of the SPI2.

Well, I don't think this is enough information to find out what is the root of the problem.

JW

AAMAN.1
Associate II

@Community member​ The 2 SPIs receive data and the SPI2 sends only the clock to the SPI3. So this is why we have the SPI2 in Receive Only Master with SCK and MISO pins, and the SPI3 in Receive Only Slave with SCK and MOSI pins.

Below is the configuration of the 2 SPIs :

0693W00000APVZWQA5.pngAnd if I do the same configuration as the SPI3 for SPI1, the data received is consistent for SPI2 and SPI1 but this is not the case for SPI2 and SPI3.

I also tried to test in IT mode but I failed to get it works. But in polling mode, we seem to be receiving data.

I think the problem the problem comes from the DMA but I don't know why it doesn't work with the SPI3 while it works very well with the SPI1 with the same configuration as the SPI3 (as well as for the DMA).

Thank you for your help.

What do you mean by "consistent", what's wrong with the data from SPI3? Are they shifted by one or more bits, are complete bytes missing?

Observe clocks and data on the pins using oscilloscope. Try lowering or increasing the SCK's GPIO_OSPEEDR setting. How is the slave's NSS controlled?

JW