2018-04-12 12:08 PM
I want to use I2S for single MP45DT02 MEMS microphone, for which I2S WS pin is not needed. CubeMX forces WS pin when enabling I2S peripherial, but I need to use this pin as GPIO for something else. Is this a bug in CubeMX and can I reassign this pin as GPIO in project, or is it not possible and it has to be WS pin even when it is not used?
#cubemx-v4.25.0 #stm32-f72018-04-12 03:28 PM
I don't Cube/CubeMX so don't know if this can be circumvented somehow, but wouldn't be surprised if not.
As with any such automation tool and 'library', it inevitably can't support all possible usage variants, so unless you strictly stick to the 'usual stuff' you quickly run into limitation like this.
Speaking of the 'usual stuff', why don't you use an STM32 model which has DFSDM?
JW
2018-04-12 11:35 PM
I don't Cube/CubeMX so don't know if this can be circumvented somehow, but wouldn't be surprised if not.
I wanted to ask, if this is CubeMX bug or MCU 'feature', I don't care about CubeMX too much, I can always set it afterwards. I wanted to know if MCU supports this or not. It seems like it, as examples don't use WS pin, but I'll have to try. I asked in case anybody did this before.
Speaking of the 'usual stuff', why don't you use an STM32 model which has DFSDM?
Stock levels and price of STM32F4x3V, STM32F407V which we use doesn't have it for some reason. I basically need a way to get 32kHz / 44.1kHz sampling rate from this mic (after decimation) without affecting HCLK of whole MCU, so I think I2S will help me with this, as it has separate clock. If you know of a better way, please let me know.
2018-04-12 11:55 PM
Nevermind, I will probably use SPI in slave mode, a Timer for generating clock and PDM filtering by software. One extra pin, but it should be doable.
2018-04-13 01:55 AM
Nevermind, I will probably use SPI in slave mode, a Timer for generating clock and PDM filtering by software. One extra pin, but it should be doable.
Wasn't it the extra wasted pin you wanted to avoid at the first place?
Sure it's doable in any way, but why would you do it?
I wanted to know if MCU supports this or not. It seems like it, as examples don't use WS pin, but I'll have to try. I asked in case anybody did this before.
Yes, the MCU supports it. I did exactly this as an exercise during writing USB audio class stuff, as I used the 'F4 DISCO and needed some reasonable audio source. And it worked, if this is the assurance you wanted to hear.
... stock levels and price of STM32F4x3V...
I see.
STM32F407V which we use doesn't have it for some reason.
The 'F407 is a quite old model and DFSDM is a relatively new module in the STM32 offerings.
Nevertheless, the decimation/filtering is relatively computation-intensive. In that exercise I mentioned above, when using a decimation factor of 2x16 (i.e. 32 input bits to one 16-bit output word) and 4-stage filtering (resulting in not quite HiFi sound), at 48 samples per 1ms USB frame (i.e. 48ksps), a straightforward implementation ate up 0.353ms, i.e. one third of the total processor time, with the processor at full throttle i.e. 168MHz. Could bring it down to some 0.220ms with some algorithmic optimizations, but still not something I would like to have in a final application. YMMV.
JW
PS. Note, that the MP45DT02 are marked as NRND.
2018-04-13 02:42 AM
Wasn't it the extra wasted pin you wanted to avoid at the first place?
Sure it's doable in any way, but why would you do it?
I needed that specific pin for something else
Nevertheless, the decimation/filtering is relatively computation-intensive. In that exercise I mentioned above, when using a decimation factor of 2x16 (i.e. 32 input bits to one 16-bit output word) and 4-stage filtering (resulting in not quite HiFi sound), at 48 samples per 1ms USB frame (i.e. 48ksps), a straightforward implementation ate up 0.353ms, i.e. one third of the total processor time, with the processor at full throttle i.e. 168MHz. Could bring it down to some 0.220ms with some algorithmic optimizations, but still not something I would like to have in a final application. YMMV.
Thanks for information. In our application it will be used primarily for intercom, i. e. 32ksps at 16 bit word. MCU has to do other things, but most of them are not time critical. Most important thing in this case is price and usual stock levels and I didn't find anything reasonable in LQFP100 with DFSDM, so F407 will probably have to do.
PS. Note, that the MP45DT02 are marked as NRND.
Thanks again, I forgot to check that for some time.
2018-04-13 06:30 AM
And an analog mic fed through a cheap preamp fed into ADC won't do?
JW
2018-04-13 06:45 AM
And an analog mic fed through a cheap preamp fed into ADC won't do?
PCB space is very limited and with digital mic we don't have to deal with analog circuitry, but if you have some solution at hand, which is simple enough (in terms of amount of components) and resistant to interference, I will be thankful for a link.
2018-04-13 06:51 AM
Nothing ready-to-use. We do this kind of stuff, but it tends to be much more complicated than what you'd need to use; so it's not just a matter of recycling something already made but the details would need to be fine-tuned. Sorry.
JW