<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Setting LPC1768 I2S to work with PCM5102A in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-LPC1768-I2S-to-work-with-PCM5102A/m-p/1023709#M39959</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Victor,&lt;/P&gt;&lt;P&gt;If want to get 48kHz, in 16 bit Stereo, you shoud have a BCLK of 2x16x48000 = 1536000, in other worss, the I2STX_CLK is required to be 1.536MHz.&lt;/P&gt;&lt;P&gt;&amp;nbsp;If you use the following diagram to generate the I2S transmitter clock,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You set up the I2S module as master which means that the LPC1768 drives the TX_SCK and TX_WS signals. If you use the I2S_TX_MCLK as the clock source to generate the TX_SCK signal. Pls refer to the Fig 102.&lt;/P&gt;&lt;P&gt;Assume that the LPC1768 runs ins 100MHz, the I2S_PCLK is also 100MHz.&lt;/P&gt;&lt;P&gt;If we set up the N=1, X=2,Y=65,&lt;/P&gt;&lt;P&gt;The TX_REF will be 100MHz*2/(65*2)=1.538MHz.&lt;/P&gt;&lt;P&gt;the bit clock BCLK will be 1.538MHz. I think it approach the 1.536MHz.&lt;/P&gt;&lt;P&gt;Hope it can help you&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/96922i6C690792A11F0AD4/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Jan 2020 07:09:33 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2020-01-17T07:09:33Z</dc:date>
    <item>
      <title>Setting LPC1768 I2S to work with PCM5102A</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-LPC1768-I2S-to-work-with-PCM5102A/m-p/1023708#M39958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am developing an audio application, that by now only requires to send data from the LPC to a DAC, I am using a development board with PCM5102A that has BCLK, LRCK and DATA, I have configured pins of the LPC as follows: P0.7 to BCLK, P0.8 to LRCK and P0.9 to DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here I attach my code, what I don't know how to configure are the registers I2SIRQ&lt;SPAN style="left: 501.8px; top: 539.4px; font-size: 20px; font-family: sans-serif; transform: scaleX(1.03295);"&gt;, &lt;/SPAN&gt;I2STXRATE, I2STXBITRATE and the &lt;SPAN style="left: 148.614px; top: 340.609px; font-size: 15.0113px; font-family: sans-serif; transform: scaleX(0.993341);"&gt;ws_halfperiod&lt;/SPAN&gt; of the DAO registe, I want to get 48kHz, in 16 bit Stereo, so as I have found on Google I shoud have a BCLK of 2x16x48000 = 1536000, but I don't know how to get the X and Y dividers for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include "LPC17xx.h"&lt;BR /&gt;#include "core_cm3.h"&lt;BR /&gt;#include "system_LPC17xx.h"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int InitI2S_PCM5102A(){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_SC-&amp;gt;PCONP |= (0x01&amp;lt;&amp;lt;27); //Alimentar Clock I2S&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_PINCON-&amp;gt;PINSEL0 |= ((0x01&amp;lt;&amp;lt;14) | (0x01&amp;lt;&amp;lt;16) | (0x01&amp;lt;&amp;lt;18));&amp;nbsp; //P0.7 I2STX_CLK -- P0.8 I2STX_WS -- P0.9 I2STX_SDA&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_I2S-&amp;gt;I2SDAO &amp;amp;= ~((0x01&amp;lt;&amp;lt;2) | (0x01&amp;lt;&amp;lt;5)); //I2S as Stereo and MASTER&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_I2S-&amp;gt;I2SIRQ |= (0x01&amp;lt;&amp;lt;1); //Enable TX I2S IRQ&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_I2S-&amp;gt;I2STXRATE = ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_I2S-&amp;gt;I2STXBITRATE = ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_I2S-&amp;gt;I2STXMODE &amp;amp;= ~(0x03&amp;lt;&amp;lt;0);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;NVIC_EnableIRQ(I2S_IRQn);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void muteTX(){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_I2S-&amp;gt;I2SDAO |= (0x01&amp;lt;&amp;lt;15);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void unmuteTX(){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_I2S-&amp;gt;I2SDAO &amp;amp;= ~(0x01&amp;lt;&amp;lt;15);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void I2S_TX_data(uint32_t data){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_I2S-&amp;gt;I2STXFIFO = data;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint8_t I2S_TX_Status(){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return ((LPC_I2S-&amp;gt;I2SSTATE &amp;gt;&amp;gt; 16) &amp;amp; 0x0F);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void I2S_IRQHandler(void){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2020 16:46:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-LPC1768-I2S-to-work-with-PCM5102A/m-p/1023708#M39958</guid>
      <dc:creator>victorcasado</dc:creator>
      <dc:date>2020-01-16T16:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Setting LPC1768 I2S to work with PCM5102A</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-LPC1768-I2S-to-work-with-PCM5102A/m-p/1023709#M39959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Victor,&lt;/P&gt;&lt;P&gt;If want to get 48kHz, in 16 bit Stereo, you shoud have a BCLK of 2x16x48000 = 1536000, in other worss, the I2STX_CLK is required to be 1.536MHz.&lt;/P&gt;&lt;P&gt;&amp;nbsp;If you use the following diagram to generate the I2S transmitter clock,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You set up the I2S module as master which means that the LPC1768 drives the TX_SCK and TX_WS signals. If you use the I2S_TX_MCLK as the clock source to generate the TX_SCK signal. Pls refer to the Fig 102.&lt;/P&gt;&lt;P&gt;Assume that the LPC1768 runs ins 100MHz, the I2S_PCLK is also 100MHz.&lt;/P&gt;&lt;P&gt;If we set up the N=1, X=2,Y=65,&lt;/P&gt;&lt;P&gt;The TX_REF will be 100MHz*2/(65*2)=1.538MHz.&lt;/P&gt;&lt;P&gt;the bit clock BCLK will be 1.538MHz. I think it approach the 1.536MHz.&lt;/P&gt;&lt;P&gt;Hope it can help you&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/96922i6C690792A11F0AD4/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jan 2020 07:09:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-LPC1768-I2S-to-work-with-PCM5102A/m-p/1023709#M39959</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2020-01-17T07:09:33Z</dc:date>
    </item>
  </channel>
</rss>

