Audio data reception methods

CN116055981BActive Publication Date: 2026-09-01HUADA SEMICON CHENGDU CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211721814.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-30
Publication Date
2026-09-01
Estimated Expiration
2042-12-30

AI Technical Summary

Technical Problem

[0004]鉴于以上所述现有技术的缺点,本发明的目的在于提供一种音频数据的接收方法,用于解决现有的音频数据通信方式因通信噪声而产生更多通信错误的问题

Benefits of technology

[0042]如上所述,本发明的音频数据的接收方法,在各声道接收音频数据的过程中若检测到WS跳变(对于I2S模式,检测到WS下降沿,对于TDM模式,检测到WS上升沿),由第一声道重新开始接收音频数据,从而避免因通信噪声产生通信错误;而且,在各声道接收音频数据时产生与各声道相对应的通道标识,并将通道标识与接收的音频数据进行拼接以写入数据FIFO,从而可进一步避免因通信噪声的存在造成通信数据和通道标识不匹配而导致更多通信错误的产生。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116055981B_ABST
    Figure CN116055981B_ABST
Patent Text Reader

Abstract

This invention provides a method for receiving audio data. The method includes: when receiving audio data in standard communication mode using I2S or TDM communication, there are five states: IDLE, LSTA, LRD, RSTA, and RRD. While in RSTA, LRD, or RRD state, if a WS transition is detected, the system switches to LSTA state, and the first bit of the first audio data transmitted on the first channel is received again from the first channel. During audio data reception, a channel identifier corresponding to each channel is generated, and each channel identifier is concatenated with the received audio data for each channel. The concatenated data is then written into a data FIFO. This invention solves the problem of increased communication errors caused by communication noise in existing audio data communication methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of audio technology, and in particular to a method for receiving audio data. Background Technology

[0002] The transmission, reception, and processing of audio data are crucial components of multimedia technology. Numerous digital audio systems have entered the consumer market, such as wireless microphones, headphones, and speakers within multimedia systems. For equipment manufacturers, standardized information transmission structures enhance system adaptability. Audio signal transmission interfaces support both I2S (Inter-IC sound, integrated circuit built-in audio bus) and TDM (Time Division Multiplexing) formats, serving as a codec interface to connect to external stereo audio decoding circuits (CODEC ICs), enabling microrecords and portable applications.

[0003] However, the current method of switching channels when receiving audio data is to determine whether the length of the transmitted data meets the agreed-upon specifications; if it does, the channel is switched. This method is prone to communication errors. Furthermore, existing I2S communication hardware modules cannot recognize and upload the channel identifier of the audio data, and therefore cannot adjust the communication data based on the channel identifier to avoid communication errors. Summary of the Invention

[0004] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide an audio data receiving method to solve the problem that existing audio data communication methods generate more communication errors due to communication noise.

[0005] To achieve the above and other related objectives, the present invention provides a method for receiving audio data, the method comprising:

[0006] When receiving audio data in standard communication mode using I2S or TDM communication, there are five states: IDLE, LSTA, LRD, RSTA, and RRD. In the IDLE state, the system waits for a trigger condition. In the LSTA and LRD states, the system receives audio data transmitted from the Mth channel. In the RSTA and RRD states, the system receives audio data transmitted from the Nth channel.

[0007] When in the RSTA state, the LRD state, or the RRD state, if a WS transition is detected, the system jumps to the LSTA state and the first channel resumes receiving the first bit of the first audio data transmitted in the first channel.

[0008] When receiving the audio data, a channel identifier corresponding to each channel is generated, and each channel identifier is concatenated with the audio data received by each channel. Then, the concatenated data is written into the data FIFO.

[0009] Specifically, for the I2S communication mode, M is 1, N is 2, and the WS transition becomes valid on the falling edge of WS. For the TDM communication mode, M is an odd number greater than or equal to 1, N is an even number greater than or equal to 2, and the WS transition becomes valid on the rising edge of WS.

[0010] Optionally, the I2S communication method includes a first channel and a second channel, where the first channel is the left channel and the second channel is the right channel. The first audio data transmitted in the first channel is the left channel audio data, and the second audio data transmitted in the second channel is the right channel audio data. The receiving process of the left channel audio data and the right channel audio data is as follows:

[0011] In the IDLE state, if a falling edge of WS is detected, the system jumps to the LSTA state, and the left channel begins to receive the first bit of the left channel audio data. The LSTA state then unconditionally jumps to the LRD state.

[0012] In the LRD state, if a falling edge of WS is detected, the system jumps to the LSTA state, and the left channel resumes receiving the first bit of the left channel audio data. If the channel length counter is detected to be 0, the system jumps to the RSTA state. If the system jumps to the left due to other conditions, the left channel continues to receive the next bit of the left channel data.

[0013] In the RSTA state, the right channel receives the first bit of the right channel audio data. If a falling edge of WS is detected, it jumps to the LSTA state, and the left channel resumes receiving the first bit of the left channel audio data. Under other conditions, it jumps to the RRD state.

[0014] In the RRD state, if a falling edge of WS is detected, the system jumps to the LSTA state, and the left channel resumes receiving the first bit of the left channel audio data. If no falling edge of WS is detected and the channel length counter is 0, the system jumps to the IDLE state to wait for a trigger condition. If the system jumps back to the previous state due to other conditions, the right channel continues to receive the last bit of the right channel audio data.

[0015] Optionally, the TDM communication method includes multiple channels, and the audio data reception process for each channel is as follows:

[0016] In the IDLE state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel begins to receive the first bit of the first audio data transmitted in the first channel. The LSTA state then unconditionally jumps to the LRD state.

[0017] In the LRD state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel restarts to receive the first bit of the first transmitted data. If the channel length counter is detected to be 0, the system jumps to the RSTA state, and the second channel starts to receive the first bit of the second audio data transmitted in the second channel. If the system jumps in place due to other conditions, the first channel continues to receive the remaining bits of the first audio data.

[0018] In the RSTA state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel resumes receiving the first bit of the first audio data. Under other conditions, the system jumps to the RRD state.

[0019] In the RRD state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel resumes receiving the first bit of the first audio data. If the channel length counter is 0 and the channel count counter is not 0, the system jumps to the LSTA state, and the third channel begins receiving the first bit of the third audio data transmitted in the third channel. If no rising edge of WS is detected and both the channel length counter and the channel count counter are 0, the system jumps to the IDLE state to wait for a trigger condition. If the system jumps back to the previous state due to other conditions, the second channel continues to receive the remaining bits of the second audio data.

[0020] The third channel and the other channels sequentially receive the audio data according to the above process.

[0021] Optionally, for the first channel, when a WS transition is detected, the channel length counter is reset, the shift register is cleared to 0, the first bit of the first audio data is written into the shift register, and a channel identifier corresponding to the first channel is generated; for the other channels, when the channel length counter is detected to be 0, the channel length counter is reset, the shift register is cleared to 0, the first bit of the audio data for each channel is written into the shift register, and a channel identifier corresponding to each channel is generated.

[0022] The present invention also provides a method for receiving audio data, the method comprising:

[0023] When receiving audio data in MSB / LSB communication mode using I2S or TDM communication, there are three states: IDLE, LRD, and RRD. In the IDLE state, the system waits for a trigger condition; in the LRD state, it receives the audio data transmitted from the Mth channel; and in the RRD state, it receives the audio data from the Nth channel.

[0024] When in the LRD state or the RRD state, if a WS transition is detected, both the LRD state and the RRD state will transition back to the LRD state, and the first bit of the first audio data transmitted in the first channel will be received again from the first channel.

[0025] When receiving the audio data, a channel identifier corresponding to each channel is generated, and each channel identifier is concatenated with the audio data received by each channel. Then, the concatenated data is written into the data FIFO.

[0026] Specifically, for the I2S communication mode, M is 1, N is 2, and the WS transition becomes valid on the falling edge of WS. For the TDM communication mode, M is an odd number greater than or equal to 1, N is an even number greater than or equal to 2, and the WS transition becomes valid on the rising edge of WS.

[0027] Optionally, the I2S communication method includes a first channel and a second channel, where the first channel is the left channel and the second channel is the right channel. The first audio data transmitted in the first channel is the left channel audio data, and the second audio data transmitted in the second channel is the right channel audio data. The receiving process of the left channel audio data and the right channel audio data is as follows:

[0028] In the IDLE state, if a falling edge of WS is detected, the system jumps to the LRD state, and the left channel receives the first bit of the left channel audio data.

[0029] In the LRD state, if a falling edge of WS is detected, the left channel resumes receiving the first bit of the left channel data. If the channel counter is detected to be 0, the system jumps to the RRD state, and the right channel receives the first bit of the right channel audio data. If the system jumps back to the starting position due to other conditions, the left channel continues to receive the remaining bits of the left channel audio data.

[0030] In the RRD state, if a falling edge of WS is detected, the system jumps to the LRD state, and the left channel resumes receiving the left channel audio data. If no falling edge of WS is detected and the channel length counter is 0, the system jumps to the IDLE state to wait for a trigger condition. If other conditions cause the system to jump in place, the right channel continues to receive the last bit of the right channel audio data.

[0031] Optionally, the TDM communication method includes multiple channels, and the audio data reception process for each channel is as follows:

[0032] In the IDLE state, if a rising edge of WS is detected, the system jumps to the LRD state, and the first channel begins to receive the first bit of the first audio data transmitted in the first channel.

[0033] In the LRD state, if a rising edge of WS is detected, the first channel resumes receiving the first audio data. If the channel counter is detected to be 0, the channel jumps to the RRD state, and the second channel begins to receive the first bit of the second audio data transmitted in the second channel. If other conditions cause the channel to jump in place, the first channel continues to receive the remaining bits of the first audio data.

[0034] In the RRD state, if a rising edge of WS is detected, the system jumps to the LRD state, and the first channel resumes receiving the first audio data. If the channel length counter is 0 while the channel count counter is not 0, the system jumps to the LRD state, and the third channel begins receiving the third audio data transmitted through the third channel. If no rising edge of WS is detected and both the channel length counter and the channel count counter are 0, the system jumps to the IDLE state to wait for a trigger condition. If the system jumps back to the previous state due to other conditions, the second channel continues to receive the last bit of the second audio data.

[0035] The third channel and other channels sequentially receive the audio data according to the above process.

[0036] Optionally, for the first channel, when a WS transition is detected, the channel length counter is reset, the shift register is cleared to 0, the first bit of the first audio data is written into the shift register, and a channel identifier corresponding to the first channel is generated; for the other channels, when the channel length counter is detected to be 0, the channel length counter is reset, the shift register is cleared to 0, the first bit of the audio data for each channel is written into the shift register, and a channel identifier corresponding to each channel is generated.

[0037] Optionally, the channel identifier is represented using a 3-bit binary number.

[0038] Optionally, in the I2S communication mode, the channel identifier corresponding to the first channel is 000; the channel identifier corresponding to the second channel is 001, wherein the first channel is the left channel and the second channel is the right channel.

[0039] Optionally, when concatenating the channel identifier with the audio data received by each channel, the channel identifier is located in the high bit.

[0040] Optionally, in the TDM communication mode, the channel identifier corresponding to the first channel is 000, and the channel identifier corresponding to the first channel plus 1 becomes the channel identifier corresponding to the second channel. When the number of channels is greater than 2, the channel identifiers of all channels are generated in sequence.

[0041] Optionally, when concatenating the channel identifier with the audio data received by each channel, the channel identifier is located in the high bit.

[0042] As described above, in the audio data receiving method of the present invention, if a WS transition is detected during the reception of audio data in each channel (for I2S mode, a falling edge of WS is detected; for TDM mode, a rising edge of WS is detected), the audio data reception restarts from the first channel, thereby avoiding communication errors caused by communication noise. Moreover, when receiving audio data in each channel, a channel identifier corresponding to each channel is generated, and the channel identifier is concatenated with the received audio data to be written into the data FIFO, thereby further avoiding the generation of more communication errors caused by the mismatch between communication data and channel identifier due to the presence of communication noise. Attached Figure Description

[0043] Figure 1 The diagram shows the I2S or TDM state in the standard mode of Embodiment 1 of the present invention.

[0044] Figure 2 The diagram shown is an I2S or TDM state diagram under LSB / MSB mode according to Embodiment 2 of the present invention. Detailed Implementation

[0045] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention.

[0046] Please see Figures 1 to 2It should be noted that the illustrations provided in this embodiment are only schematic representations of the basic concept of the present invention. Although the illustrations only show components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation, the shape, quantity and proportion of each component in the actual implementation can be arbitrarily changed, and the layout of the components may also be more complex.

[0047] Example 1

[0048] This embodiment provides a method for receiving audio data, the method including:

[0049] When receiving audio data in standard communication mode using I2S or TDM communication, there are five states: IDLE, LSTA, LRD, RSTA, and RRD. In the IDLE state, the system waits for a trigger condition. In the LSTA and LRD states, the system receives audio data transmitted from the Mth channel. In the RSTA and RRD states, the system receives audio data transmitted from the Nth channel.

[0050] When in the RSTA state, the LRD state, or the RRD state, if a WS transition is detected, the system jumps to the LSTA state and the first channel resumes receiving the first bit of the first audio data transmitted in the first channel.

[0051] When receiving the audio data, a channel identifier corresponding to each channel is generated, and each channel identifier is concatenated with the audio data received by each channel. Then, the concatenated data is written into the data FIFO.

[0052] Specifically, for the I2S communication mode, M is 1, N is 2, and the WS transition becomes valid on the falling edge of WS. For the TDM communication mode, M is an odd number greater than or equal to 1, N is an even number greater than or equal to 2, and the WS transition becomes valid on the rising edge of WS.

[0053] Specifically, the I2S communication method includes a first channel and a second channel. The first channel is the left channel, and the second channel is the right channel. The first audio data transmitted in the first channel is the left channel audio data, and the second audio data transmitted in the second channel is the right channel audio data. The receiving process of the left channel audio data and the right channel audio data is as follows:

[0054] In the IDLE state, if a falling edge of WS is detected, the system jumps to the LSTA state, and the left channel begins to receive the first bit of the left channel audio data. The LSTA state then unconditionally jumps to the LRD state.

[0055] In the LRD state, if a falling edge of WS is detected, the system jumps to the LSTA state, and the left channel resumes receiving the first bit of the left channel audio data. If the channel length counter is detected to be 0, the system jumps to the RSTA state. If the system jumps to the left due to other conditions, the left channel continues to receive the next bit of the left channel data.

[0056] In the RSTA state, the right channel receives the first bit of the right channel audio data. If a falling edge of WS is detected, it jumps to the LSTA state, and the left channel resumes receiving the first bit of the left channel audio data. Under other conditions, it jumps to the RRD state.

[0057] In the RRD state, if a falling edge of WS is detected, the system jumps to the LSTA state, and the left channel resumes receiving the first bit of the left channel audio data. If no falling edge of WS is detected and the channel length counter is 0, the system jumps to the IDLE state to wait for a trigger condition. If the system jumps back to the previous state due to other conditions, the right channel continues to receive the last bit of the right channel audio data.

[0058] In this embodiment, if the left channel audio data is 32 bits, the subsequent bit data is 31 bits excluding the first bit data. It should be noted that in the ILDE state, the system may jump in place and wait for a trigger condition due to other conditions. Furthermore, in this embodiment, the falling edge of WS is used as the first condition, a channel counter of 0 is used as the second condition, and conditions other than the first and second conditions are considered other conditions, which are then used as the third condition. The priority of these three conditions is: the first condition is greater than the second condition, and the second condition is greater than the third condition.

[0059] The TDM communication method includes multiple audio channels, and the audio data reception process for each channel is as follows:

[0060] In the IDLE state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel begins to receive the first bit of the first audio data transmitted in the first channel. The LSTA state then unconditionally jumps to the LRD state.

[0061] In the LRD state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel restarts to receive the first bit of the first transmitted data. If the channel length counter is detected to be 0, the system jumps to the RSTA state, and the second channel starts to receive the first bit of the second audio data transmitted in the second channel. If the system jumps in place due to other conditions, the first channel continues to receive the remaining bits of the first audio data.

[0062] In the RSTA state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel resumes receiving the first bit of the first audio data. Under other conditions, the system jumps to the RRD state.

[0063] In the RRD state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel resumes receiving the first bit of the first audio data. If the channel length counter is 0 and the channel count counter is not 0, the system jumps to the LSTA state, and the third channel begins receiving the first bit of the third audio data transmitted in the third channel. If no rising edge of WS is detected and both the channel length counter and the channel count counter are 0, the system jumps to the IDLE state to wait for a trigger condition. If the system jumps back to the previous state due to other conditions, the second channel continues to receive the remaining bits of the second audio data.

[0064] The third channel and the other channels sequentially receive the audio data according to the above process.

[0065] Moreover, in this embodiment, the rising edge of WS is used as the first condition, the channel counter being 0 is used as the second condition, and other conditions are used as the third condition. The priority of the three conditions is that the first condition is greater than the second condition, and the second condition is greater than the third condition.

[0066] Assuming the TDM communication method includes four channels, namely the first channel, the second channel, the third channel, and the fourth channel, the specific process of each channel receiving the audio data is as follows:

[0067] In the IDLE state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel begins receiving the first bit of the first audio data. The LSTA state unconditionally jumps to the LRD state. In the LRD state, if the system jumps in place due to other conditions (no rising edge of WS detected and the channel length counter is not 0), the first channel continues to receive the remaining bits of the first audio data. If a rising edge of WS is detected during this process, the system jumps to the LSTA state, and the first channel restarts receiving the first bit of the first transmitted data. If no rising edge of WS is detected during this process, but the channel length counter is 0, the system jumps to the RSTA state, and the second channel begins receiving the first bit of the second audio data. In the RSTA state... In the LSTA state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel resumes receiving the first bit of the first audio data. Otherwise, it jumps to the RRD state. In the RRD state, if the system jumps back to the LSTA state due to other conditions (no rising edge of WS is detected and the channel length counter is not 0), the second channel continues to receive the remaining bits of the second audio data. If a rising edge of WS is detected during this process, the system jumps to the LSTA state, and the first channel resumes receiving the first bit of the first transmitted data. If no rising edge of WS is detected during this process but the channel length counter is 0, the system jumps to the LSTA state, and the third channel begins receiving the first bit of the third audio data (at this time, the channel count counter is not 0).

[0068] The LSTA state unconditionally transitions to the LRD state. In the LRD state, if it transitions in place due to other conditions (no rising edge of WS detected and the channel length counter is not 0), the third channel continues to receive the last bit of the third audio data. If a rising edge of WS is detected during this process, it transitions to the LSTA state, and the first channel restarts receiving the first bit of the first transmitted data. If no rising edge of WS is detected during this process, but the channel length counter is 0, it transitions to the RSTA state, and the fourth channel begins receiving the first bit of the fourth audio data transmitted on the fourth channel. In the RSTA state, if a rising edge of WS is detected... If the first channel restarts to receive the first bit of the first audio data under other conditions, it will jump to the LSTA state. Under the RRD state, if it jumps back to the LSTA state due to other conditions (no rising edge of WS detected and the channel length counter is not 0), the fourth channel will continue to receive the next bit of the fourth audio data. If a rising edge of WS is detected during this process, it will jump to the LSTA state, and the first channel will restart to receive the first bit of the first transmitted data. If no rising edge of WS is detected during this process, but the channel length counter is 0, it will jump to the IDLE state to wait for the trigger condition (at this time, the channel count counter is 0).

[0069] Specifically, for the first channel, when a WS transition is detected, the channel length counter is reset, the shift register is cleared to 0, the first bit of the first audio data is written into the shift register, and a channel identifier corresponding to the first channel is generated; for the other channels, when the channel length counter is detected to be 0, the channel length counter is reset, the shift register is cleared to 0, the first bit of the audio data of each channel is written into the shift register, and a channel identifier corresponding to each channel is generated.

[0070] In this embodiment, for the I2S communication mode, the WS transition to WS falling edge is valid; for the TDM communication mode, the WS transition to WS rising edge is valid. When writing the first bit of the first audio data into the shift register, the least significant bit of the shift register is written.

[0071] Specifically, the channel identifier is represented using a 3-bit binary number.

[0072] Specifically, in the I2S communication mode, the channel identifier corresponding to the first channel is 000; the channel identifier corresponding to the second channel is 001, wherein the first channel is the left channel and the second channel is the right channel.

[0073] As an example, when the channel identifier is concatenated with the audio data received by each channel, the channel identifier is located in the high bit.

[0074] Specifically, in the TDM communication mode, the channel identifier corresponding to the first channel is 000, and the channel identifier corresponding to the first channel plus 1 becomes the channel identifier corresponding to the second channel. When the number of channels is greater than 2, this process is repeated to generate channel identifiers for all channels.

[0075] In this embodiment, it is assumed that the TDM communication mode includes 4 channels, with the channel identifier of the first channel being 000, the channel identifier of the second channel being 001, the channel identifier of the third channel being 010, and the channel identifier of the fourth channel being 011.

[0076] As an example, when the channel identifier is concatenated with the audio data received by each channel, the channel identifier is located in the high bit.

[0077] Example 2

[0078] This embodiment also provides a method for receiving audio data, the method comprising:

[0079] When receiving audio data in MSB / LSB communication mode using I2S or TDM communication, there are three states: IDLE, LRD, and RRD. In the IDLE state, the system waits for a trigger condition; in the LRD state, it receives the audio data transmitted from the Mth channel; and in the RRD state, it receives the audio data from the Nth channel.

[0080] When in the LRD state or the RRD state, if a WS transition is detected, both the LRD state and the RRD state will switch to the LRD state, and the first channel will resume receiving the first bit of the first audio data transmitted in the first channel.

[0081] When receiving the audio data, a channel identifier corresponding to each channel is generated, and each channel identifier is concatenated with the audio data received by each channel. Then, the concatenated data is written into the data FIFO.

[0082] Specifically, for the I2S communication mode, M is 1, N is 2, and the WS transition becomes valid on the falling edge of WS. For the TDM communication mode, M is an odd number greater than or equal to 1, N is an even number greater than or equal to 2, and the WS transition becomes valid on the rising edge of WS.

[0083] Specifically, the I2S communication method includes a first channel and a second channel. The first channel is the left channel, and the second channel is the right channel. The first audio data transmitted in the first channel is the left channel audio data, and the second audio data transmitted in the second channel is the right channel audio data. The receiving process of the left channel audio data and the right channel audio data is as follows:

[0084] In the IDLE state, if a falling edge of WS is detected, the system jumps to the LRD state, and the left channel receives the first bit of the left channel audio data.

[0085] In the LRD state, if a falling edge of WS is detected, the left channel resumes receiving the first bit of the left channel data. If the channel counter is detected to be 0, the system jumps to the RRD state, and the right channel receives the first bit of the right channel audio data. If the system jumps back to the starting position due to other conditions, the left channel continues to receive the remaining bits of the left channel audio data.

[0086] In the RRD state, if a falling edge of WS is detected, the system jumps to the LRD state, and the left channel resumes receiving the left channel audio data. If no falling edge of WS is detected and the channel length counter is 0, the system jumps to the IDLE state to wait for a trigger condition. If the system jumps back to the previous state due to other conditions, the right channel continues to receive the last bit of the right channel audio data.

[0087] In this embodiment, if the left channel audio data is 32 bits, the subsequent bit data is 31 bits excluding the first bit data. It should be noted that in the ILDE state, the system may jump in place and wait for a trigger condition due to other conditions. Furthermore, in this embodiment, the falling edge of WS is used as the first condition, a channel counter of 0 is used as the second condition, and conditions other than the first and second conditions are considered other conditions, which are then used as the third condition. The priority of these three conditions is: the first condition is greater than the second condition, and the second condition is greater than the third condition.

[0088] Specifically, the TDM communication method includes multiple channels, and the audio data reception process for each channel is as follows:

[0089] In the IDLE state, if a rising edge of WS is detected, the system jumps to the LRD state, and the first channel begins to receive the first bit of the first audio data transmitted in the first channel.

[0090] In the LRD state, if a rising edge of WS is detected, the first channel resumes receiving the first audio data. If the channel counter is detected to be 0, the channel jumps to the RRD state, and the second channel begins to receive the first bit of the second audio data transmitted in the second channel. If the channel jumps to the previous state due to other conditions, the first channel continues to receive the remaining bits of the first audio data.

[0091] In the RRD state, if a rising edge of WS is detected, the system jumps to the LRD state, and the first channel resumes receiving the first audio data. If the channel length counter is 0 while the channel count counter is not 0, the system jumps to the LRD state, and the third channel begins receiving the third audio data transmitted through the third channel. If no rising edge of WS is detected and both the channel length counter and the channel count counter are 0, the system jumps to the IDLE state to wait for a trigger condition. If the system jumps back to the previous state due to other conditions, the second channel continues to receive the last bit of the second audio data.

[0092] The third channel and other channels sequentially receive the audio data according to the above process.

[0093] Assuming the TDM communication method includes four channels, namely the first channel, the second channel, the third channel, and the fourth channel, the specific process of each channel receiving the audio data is as follows:

[0094] In the IDLE state, if a rising edge of WS is detected, the system jumps to the LRD state, and the first channel begins receiving the first bit of the first audio data. In the LRD state, if the system jumps back to the previous state due to other conditions (no rising edge of WS detected and the channel length counter is not 0), the first channel continues receiving the remaining bits of the first audio data. If a rising edge of WS is detected during this process, the first channel restarts receiving the first audio data. If no rising edge of WS is detected during this process, but the channel length counter is 0, the system jumps to the RRD state, and the second channel begins receiving the second audio data. The first bit of the data; in the RRD state, if the system jumps in place due to other conditions (no rising edge of WS detected and the channel length counter is not 0), the second channel continues to receive the next bit of the second audio data. If a rising edge of WS is detected during this process, the system jumps to the LRD state, and the first channel restarts to receive the first audio data. If no rising edge of WS is detected during this process, but the channel length counter is 0, the system jumps to the LRD state, and the third channel begins to receive the first bit of the third audio data transmitted in the third channel (at this time, the channel count counter is not 0).

[0095] In the LRD state, if the channel jumps in place due to other conditions (no rising edge of WS detected and the channel length counter is not 0), the third channel continues to receive the last bit of the third audio data. If a rising edge of WS is detected during this process, the first channel restarts receiving the first audio data. If no rising edge of WS is detected during this process but the channel length counter is 0, the channel jumps to the RRD state, and the fourth channel begins to receive the first bit of the fourth audio data transmitted through the fourth channel. In the RRD state, if the channel jumps in place due to other conditions (no rising edge of WS detected and the channel length counter is not 0), the fourth channel continues to receive the last bit of the fourth audio data. If a rising edge of WS is detected during this process, the channel jumps to the LRD state, and the first channel restarts receiving the first audio data. If no rising edge of WS is detected during this process but the channel length counter is 0, the channel jumps to the IDLE state to wait for a trigger condition (at this time, the channel count counter is 0).

[0096] Specifically, for the first channel, when a WS transition is detected, the channel length counter is reset, the shift register is cleared to 0, the first bit of the first audio data is written into the shift register, and a channel identifier corresponding to the first channel is generated; for the other channels, when the channel length counter is detected to be 0, the channel length counter is reset, the shift register is cleared to 0, the first bit of the audio data of each channel is written into the shift register, and a channel identifier corresponding to each channel is generated.

[0097] In this embodiment, for the I2S communication mode, the transition from WS to WS is valid on the falling edge; for the TDM communication mode, the transition from WS to WS is valid on the rising edge. When writing the first bit of the first audio data into the shift register, the least significant bit of the shift register is written.

[0098] Specifically, the channel identifier is represented using a 3-bit binary number.

[0099] Specifically, in the I2S communication mode, the channel identifier corresponding to the first channel is 000; the channel identifier corresponding to the second channel is 001, wherein the first channel is the left channel and the second channel is the right channel.

[0100] As an example, when the channel identifier is concatenated with the audio data received by each channel, the channel identifier is located in the high bit.

[0101] Specifically, in the TDM communication mode, the channel identifier corresponding to the first channel is 000, and the channel identifier corresponding to the first channel plus 1 becomes the channel identifier corresponding to the second channel. When the number of channels is greater than 2, this process is repeated to generate channel identifiers for all channels.

[0102] In this embodiment, it is assumed that the TDM communication mode includes 4 channels, with the channel identifier of the first channel being 000, the channel identifier of the second channel being 001, the channel identifier of the third channel being 010, and the channel identifier of the fourth channel being 011.

[0103] As an example, when the channel identifier is concatenated with the audio data received by each channel, the channel identifier is located in the high bit.

[0104] In summary, the audio data receiving method of the present invention, if a WS transition is detected during the reception of audio data in each channel (for I2S mode, a falling edge of WS is detected; for TDM mode, a rising edge of WS is detected), audio data reception restarts from the first channel, thereby avoiding more communication errors caused by communication noise. Furthermore, when receiving audio data in each channel, a channel identifier corresponding to each channel is generated, and the channel identifier is concatenated with the received audio data to be written into the data FIFO, thereby further avoiding more communication errors caused by mismatch between communication data and channel identifiers due to the presence of communication noise. Therefore, the present invention effectively overcomes the various shortcomings of the prior art and has high industrial applicability.

[0105] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A method for receiving audio data, characterized in that, The method includes: When receiving audio data in standard communication mode using I2S or TDM communication, there are five states: IDLE, LSTA, LRD, RSTA, and RRD. In the IDLE state, the system waits for a trigger condition. In the LSTA and LRD states, the system receives audio data transmitted from the Mth channel. In the RSTA and RRD states, the system receives audio data transmitted from the Nth channel. When in the RSTA state, the LRD state, or the RRD state, if a WS transition is detected, the system jumps to the LSTA state and the first channel resumes receiving the first bit of the first audio data transmitted in the first channel. When receiving the audio data, a channel identifier corresponding to each channel is generated, and each channel identifier is concatenated with the audio data received by each channel. Then, the concatenated data is written into the data FIFO. Specifically, for the I2S communication mode, M is 1, N is 2, and the WS transition becomes valid on the falling edge of WS. For the TDM communication mode, M is an odd number greater than or equal to 1, N is an even number greater than or equal to 2, and the WS transition becomes valid on the rising edge of WS.

2. The method for receiving audio data according to claim 1, characterized in that, The I2S communication method includes a first channel and a second channel. The first channel is the left channel, and the second channel is the right channel. The first audio data transmitted in the first channel is the left channel audio data, and the second audio data transmitted in the second channel is the right channel audio data. The receiving process of the left channel audio data and the right channel audio data is as follows: In the IDLE state, if a falling edge of WS is detected, the system jumps to the LSTA state, and the left channel begins to receive the first bit of the left channel audio data. The LSTA state then unconditionally jumps to the LRD state. In the LRD state, if a falling edge of WS is detected, the system jumps to the LSTA state, and the left channel resumes receiving the first bit of the left channel audio data. If the channel length counter is detected to be 0, the system jumps to the RSTA state. If the system jumps to the left due to other conditions, the left channel continues to receive the next bit of the left channel data. In the RSTA state, the right channel receives the first bit of the right channel audio data. If a falling edge of WS is detected, it jumps to the LSTA state, and the left channel resumes receiving the first bit of the left channel audio data. Under other conditions, it jumps to the RRD state. In the RRD state, if a falling edge of WS is detected, the system jumps to the LSTA state, and the left channel resumes receiving the first bit of the left channel audio data. If no falling edge of WS is detected and the channel length counter is 0, the system jumps to the IDLE state to wait for a trigger condition. If the system jumps back to the previous state due to other conditions, the right channel continues to receive the last bit of the right channel audio data.

3. The method for receiving audio data according to claim 1, characterized in that, The TDM communication method includes multiple audio channels, and the audio data reception process for each channel is as follows: In the IDLE state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel begins to receive the first bit of the first audio data transmitted in the first channel. The LSTA state then unconditionally jumps to the LRD state. In the LRD state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel restarts to receive the first bit of the first transmitted data. If the channel length counter is detected to be 0, the system jumps to the RSTA state, and the second channel starts to receive the first bit of the second audio data transmitted in the second channel. If the system jumps in place due to other conditions, the first channel continues to receive the remaining bits of the first audio data. In the RSTA state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel resumes receiving the first bit of the first audio data. Under other conditions, the system jumps to the RRD state. In the RRD state, if a rising edge of WS is detected, the system jumps to the LSTA state, and the first channel resumes receiving the first bit of the first audio data. If the channel length counter is 0 and the channel counter is not 0, the system jumps to the LSTA state, and the third channel begins receiving the first bit of the third audio data transmitted in the third channel. If no rising edge of WS is detected and both the channel length counter and the channel counter are 0, the system jumps to the IDLE state to wait for a trigger condition. If the system jumps in place due to other conditions, the second channel continues to receive the remaining bits of the second audio data. The third channel and the other channels sequentially receive the audio data according to the above process.

4. The method for receiving audio data according to claim 2 or 3, characterized in that, For the first channel, when a WS transition is detected, the channel length counter is reset, the shift register is cleared to 0, the first bit of the first audio data is written into the shift register, and a channel identifier corresponding to the first channel is generated; for each of the other channels, when the channel length counter is detected to be 0, the channel length counter is reset, the shift register is cleared to 0, the first bit of the audio data for each channel is written into the shift register, and a channel identifier corresponding to each channel is generated.

5. A method for receiving audio data, characterized in that, The method includes: When receiving audio data in MSB / LSB communication mode using I2S or TDM communication, there are three states: IDLE, LRD, and RRD. In the IDLE state, the system waits for a trigger condition; in the LRD state, it receives the audio data transmitted from the Mth channel; and in the RRD state, it receives the audio data from the Nth channel. When in the LRD state or the RRD state, if a WS transition is detected, both the LRD state and the RRD state will transition back to the LRD state, and the first bit of the first audio data transmitted in the first channel will be received again from the first channel. When receiving the audio data, a channel identifier corresponding to each channel is generated, and each channel identifier is concatenated with the audio data received by each channel. Then, the concatenated data is written into the data FIFO. Specifically, for the I2S communication mode, M is 1, N is 2, and the WS transition becomes valid on the falling edge of WS. For the TDM communication mode, M is an odd number greater than or equal to 1, N is an even number greater than or equal to 2, and the WS transition becomes valid on the rising edge of WS.

6. The method for receiving audio data according to claim 5, characterized in that, The I2S communication method includes a first channel and a second channel. The first channel is the left channel, and the second channel is the right channel. The first audio data transmitted in the first channel is the left channel audio data, and the second audio data transmitted in the second channel is the right channel audio data. The receiving process of the left channel audio data and the right channel audio data is as follows: In the IDLE state, if a falling edge of WS is detected, the system jumps to the LRD state, and the left channel receives the first bit of the left channel audio data. In the LRD state, if a falling edge of WS is detected, the left channel resumes receiving the first bit of the left channel data. If the channel counter is detected to be 0, the system jumps to the RRD state, and the right channel receives the first bit of the right channel audio data. If the system jumps back to the starting position due to other conditions, the left channel continues to receive the remaining bits of the left channel audio data. In the RRD state, if a falling edge of WS is detected, the system jumps to the LRD state, and the left channel resumes receiving the left channel audio data. If no falling edge of WS is detected and the channel length counter is 0, the system jumps to the IDLE state to wait for a trigger condition. If the system jumps back to the previous state due to other conditions, the right channel continues to receive the last bit of the right channel audio data.

7. The method for receiving audio data according to claim 5, characterized in that, The TDM communication method includes multiple audio channels, and the audio data reception process for each channel is as follows: In the IDLE state, if a rising edge of WS is detected, the system jumps to the LRD state, and the first channel begins to receive the first bit of the first audio data transmitted in the first channel. In the LRD state, if a rising edge of WS is detected, the first channel resumes receiving the first audio data. If the channel counter is detected to be 0, the channel jumps to the RRD state, and the second channel begins to receive the first bit of the second audio data transmitted in the second channel. If the channel jumps to the previous state due to other conditions, the first channel continues to receive the next bit of the first audio data. In the RRD state, if a rising edge of WS is detected, the system jumps to the LRD state, and the first channel resumes receiving the first audio data. If the channel length counter is 0 but the channel counter is not 0, the system jumps to the LRD state, and the third channel begins receiving the third audio data transmitted through the third channel. If no rising edge of WS is detected and both the channel length counter and the channel counter are 0, the system jumps to the IDLE state to wait for a trigger condition. If the system jumps back to the previous state due to other conditions, the second channel continues to receive the last bit of the second audio data. The third channel and other channels sequentially receive the audio data according to the above process.

8. The method for receiving audio data according to claim 6 or 7, characterized in that, For the first channel, when a WS transition is detected, the channel length counter is reset, the shift register is cleared to 0, the first bit of the first audio data is written into the shift register, and a channel identifier corresponding to the first channel is generated; for each of the other channels, when the channel length counter is detected to be 0, the channel length counter is reset, the shift register is cleared to 0, the first bit of the audio data for each channel is written into the shift register, and a channel identifier corresponding to each channel is generated.

9. The method for receiving audio data according to claim 2 or 6, characterized in that, The channel identifier is represented using a 3-bit binary number.

10. The method for receiving audio data according to claim 9, characterized in that, In the I2S communication mode, the channel identifier corresponding to the first channel is 000; the channel identifier corresponding to the second channel is 001, wherein the first channel is the left channel and the second channel is the right channel.

11. The method for receiving audio data according to claim 10, characterized in that, When the channel identifier is concatenated with the audio data received by each channel, the channel identifier is located in the high bit.

12. The method for receiving audio data according to claim 9, characterized in that, In the TDM communication mode, the channel identifier corresponding to the first channel is 000, and the channel identifier corresponding to the first channel plus 1 becomes the channel identifier corresponding to the second channel. When the number of channels is greater than 2, the channel identifiers of all channels are generated in sequence.

13. The method for receiving audio data according to claim 12, characterized in that, When the channel identifier is concatenated with the audio data received by each channel, the channel identifier is located in the high bit.

Citation Information

Patent Citations

  • System for avoiding channel exchange of I2S audio interface

    CN114095837A

  • Method and device for acquiring audio data, processor and storage medium

    CN115134031A