G_ak4961_i2s_tx_handle. Instance->sr
__io uint32_t SR; /*!< SPI Status register,address offset:0x08 */
27.5.3 SPI Status Register (SPI_SR)
Crcerr
8:fre
Bit 8 FRE: Frame formatting error (frame format error)
Note: Use this flag when the SPI is working from mode or I2S in TI
#define __HAL_I2S_DISABLE (__handle__)
((__handle__)->instance->i2scfgr &= ~spi_i2scfgr_i2se)
Spi_i2scfgr_i2se
Spi_i2scfgr_i2se_msk
(0x1u << Spi_i2scfgr_i2se_pos)
(10U)
27.5.8 spi_i2s Configuration Register (SPI_I2SCFGR)
10:i2se
TI Mode frame Format error
If the SPI is operating in slave mode and is configured to conform to the TI mode protocol, a TI mode frame format error is detected when a NSS pulse occurs during continuous communication. When this error occurs, the FRE flag in the SPI_SR register resets to 1. The SPI is not turned off when an error occurs, but the NSS pulses are ignored, and the SPI waits until the next NSS Pulse before starting a new transmission. Because error detection can cause two data bytes to be lost, data can become corrupted.
When reading the SPI_SR register, the 0 FRE flag is cleared. If the Errie position is 1, an interrupt is generated when the frame format error is detected. In this case, due to the inability to guarantee data continuity, the SPI should be turned off and the communication will be re-initiated by the master after re-enabling it from the SPI.
P744
void I2sframeerrorcheck (void)
{
Check if IIS frame error occurs
if (G_ak4961_i2s_tx_handle. INSTANCE->SR) &0x100)
{
__hal_i2s_disable (&g_ak4961_i2s_tx_handle);
Wait WS goes down
while (Hal_gpio_readpin (Ak4961_i2s_ws_gpio_port, Ak4961_i2s_ws_pin));
Wait WS goes up
while (! Hal_gpio_readpin (Ak4961_i2s_ws_gpio_port, Ak4961_i2s_ws_pin));
__hal_i2s_enable (&g_ak4961_i2s_tx_handle);
}
Check if IIS frame error occurs
if (G_ak4961_i2s_rx_handle. INSTANCE->SR) &0x100)
{
__hal_i2s_disable (&g_ak4961_i2s_rx_handle);
Wait WS goes down
while (Hal_gpio_readpin (Ak4961_i2s_ws_gpio_port, Ak4961_i2s_ws_pin));
Wait WS goes up
while (! Hal_gpio_readpin (Ak4961_i2s_ws_gpio_port, Ak4961_i2s_ws_pin));
__hal_i2s_enable (&g_ak4961_i2s_rx_handle);
}
}