2016-04-28 08:40 AM
Hello,
I am trying to read a digital mems microphone that sends 24 bit via i2s. My problem is that I only receive 16 bit values and that the hal documentation is kind of confusing to me (probably because I am new to microcontroller programming). \\ I tried:\\ uint8_t sample=2; uint16_t I2S_RX_BUFFER2[sample]; ReadStatus= HAL_I2S_Receive(&hi2s1, (uint16_t*)I2S_RX_BUFFER2, sample, 0x1000); The values I get are between 0 and 65.535.\\ The relevant documentation:\\ ** * @brief Receive an amount of data in blocking mode * @param hi2s: pointer to a I2S_HandleTypeDef structure that contains * the configuration information for I2S module * @param pData: a 16-bit pointer to data buffer. * @param Size: number of data sample to be sent: ''''''''This note confuses me:'''''' * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S * configuration phase, the Size parameter means the number of 16-bit data length * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected * the Size parameter means the number of 16-bit data length. [ ...] HAL_StatusTypeDef HAL_I2S_Receive(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout) So my question is what did I do wrong when setting the parameters and how can I improve it. #i2s #stm32 #hal #cubemx