2018-10-18 02:32 AM
Hi guys,
I'm looking at a number of ways to interface 8xPDM microphones and one of the ways is using an STM32H7 with it's SAI/PDM interface. According to the documentation (AN5027, 4.3.1), I should be able to select up to 8 microphones in the H7 SAI1_A block once I set the mode to "Pulse Density Modulation" (see image below).
When I create an STM32CubeMX project however (STM32H743ZI MCU), it only lets me select up to 6! I've tried others in the H7 family and get the same result.
Is this a bug in CubeMX or have I missed something? Are there any code examples of configuring the SAI peripheral in this way?
Thanks
2018-10-18 08:53 AM
Hi @sully ,
Referring to the datasheet, I don't think that it is possible to configure 4 microphone pairs for the same SAI instance.
However, if you use the instances SAI1_A and SAI4_A, you will reach a total of 8 microphones configured.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2018-10-18 09:45 AM
Thanks for the quick response Amel, I'll have a look at that. Could you let me know where in the datasheet you're referring to so I can read over it? I've been going by AN5027, which has:
Reading this suggested to me that it's all driven from a single SAI peripheral (especially because of the option of 1 clock for all 2x4 pairs).
Also looking at the generated code, if I select NumberofMicrophones to '5-6' then it generates 'SAI_PdmInitTypeDef.MicPairsNbr = 3' and the comment for that field is 'Specifies the number of microphone pairs used. This parameter must be a number between Min_Data = 1 and Max_Data = 4.'
Thanks again for looking into it.
[EDIT: I just realised when I copy-paste an image into the post, it appears in the post but doesn't save]
2018-10-18 09:53 AM
One of the repeated weaknesses of the STM32 documentation is the link between the individual IP modules and their particular implementation in a given chip.
While SAI module supports up to 4 PDM data pins, in 'H743 (and kin) simply not all of them are brought out to external pins (through the GPIO AF matrix). Maybe in future 'H7 or other STM32 products they will be... If you look into the datasheet, you'll see that there are only SAI1_D1, SAI1_D2, SAI1_D3, and SAI4_D1, SAI4_D2, SAI4_D3. SAI2 and SAI3 have no PDM data pins brought out. So that's 3 data pins per SAI, 2 mics per data pin (stereo) and 2 SAIs, so you can connect altogether 3x2x2 =12 PDM mics to the 'H743 (unless you have a small-pin-count package where not all these are brought out), but only 6 per SAI.
JW
2018-10-18 01:14 PM
So just looking at STM32CubeMX, if I set SAI1_A to 5-6 mics then SAI4_A is restricted to 1-2 mics. So it looks like the restriction of 8 is built in there. Maybe that means the different SAI peripeherals internally map to 8 common PDM sub-units? Between the documentation, STM32CubeMX, the PDM application note and the source code comments it's extremely confusing, but at least it's looking workable.
2018-10-18 01:44 PM
A closer look reveals, that the data pins of the two different SAIs are mapped to the SAME physical pins, i.e.
SAI1_D1 and SAI4_D1 is on PB2, PC1, PD6, PE6
SAI1_D2 and SAI4_D2 is on PE4
SAI1_D3 and SAI4_D3 is on PC5 and PF10.
This restricts usability of this mode further. Good job, ST!
Nevertheless, while indeed SAI1_D2 and SAI4_D2 can't be used simultaneously, as they occupy the same single pin, I don't see reason why couldn't all remaining data pins be used; that would cut the mic's number to 10. Still more than what CubeMX allows, but I don't really care about CubeMX, I do care about real doucmentation. Maybe I'm overlooking something.
Amel, can you please comment?
JW
2018-10-19 07:03 AM
Hi @Community member ,
I agree with you that it should be possible to configure 5 microphone pairs using SAI1 and SAI4.
I am checking if there is any constraint that doesn't allow it on CubeMX. Otherwise, this later should be updated.
@sully , AN5027 is generic, not dedicated to STM32H7.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2019-01-28 12:02 AM
Hi @sully
Thank you for your feedback
Issue reproduced and it will be fixed in the next CubeMX release.
regards,
Khouloud.