Skip to main content
ad ho
Associate II
August 8, 2017
Solved

How to feed both i2s channel with DMA

  • August 8, 2017
  • 5 replies
  • 1387 views
Posted on August 08, 2017 at 16:55

The original post was too long to process during our migration. Please click on the attachment to read the original post.
    This topic has been closed for replies.
    Best answer by ad ho
    Posted on August 14, 2017 at 14:30

    Okay, I found the mistake, I was expecting my DMA to be 16bits as I programmed i2s so, and did not see that data bit was actually in word. I have been confused as this parameter is not in the main and forgot about it.

    5 replies

    waclawek.jan
    Super User
    August 8, 2017
    Posted on August 08, 2017 at 17:58

    I2S naturally contains both channels so there's something wrong in your setup.

    Observe WS versus CK directly on the codec's pins.

    JW

    ad ho
    ad hoAuthor
    Associate II
    August 9, 2017
    Posted on August 09, 2017 at 09:22

    Hi Jan,

    Yes you are right, the fact that make me think that it is a software issue is that I checked the I2S bus with a logic analyser. WS is correctly balancing left right, CK is much faster as expected and the data is corresponding to the analog value -> right a nice sinus, left wierd semi periodical signal.

    But what I don't understand, if we take the problem reversly, if I had to send two different signal on the two channels, how would I proceed? 

    In 

    HAL_I2S_Transmit_DMA(&hi2s2, (uint16_t*) sine_table, 512); I don't see any reference about the second channel, is it suposed to be in the sine_table? I tried to put [sin0, 0, sin1, 0, sin2, 0] as if the data where [L0, R0, L1, R1, ...] but then the right channel was not clean anymore.

    I think I have not totally understood the concept...

    waclawek.jan
    Super User
    August 9, 2017
    Posted on August 09, 2017 at 11:12

    I tried to put [sin0, 0, sin1, 0, sin2, 0] as if the data where [L0, R0, L1, R1, ...]

    Yes that's exactly how are they supposed to be.

    but then the right channel was not clean anymore.

    This is why I say something is wrong in your setup. Is the CODEC set properly for I2S/Philips? FMT pin?

    CK is much faster

    Is it exactly 16 x WS?

    JW

    ad ho
    ad hoAuthorBest answer
    Associate II
    August 14, 2017
    Posted on August 14, 2017 at 14:30

    Okay, I found the mistake, I was expecting my DMA to be 16bits as I programmed i2s so, and did not see that data bit was actually in word. I have been confused as this parameter is not in the main and forgot about it.