<?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 K81 - TRNG_GetRandomData hanging in MCUXpresso General</title>
    <link>https://community.nxp.com/t5/MCUXpresso-General/K81-TRNG-GetRandomData-hanging/m-p/1020720#M3125</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to get some random data from K81 hardware and I'm using&amp;nbsp;TRNG_GetRandomData from fsl_trng.c.&lt;/P&gt;&lt;P&gt;I'm using it in connection with :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//***********************************************************************************************************&lt;/P&gt;&lt;P&gt;return_code = mbedtls_rsa_rsaes_pkcs1_v15_encrypt(key, trng_ctr_drbg_random, NULL, MBEDTLS_RSA_PUBLIC, sizeof(_pers_kbpk), (const uint8_t*)&amp;amp;_pers_kbpk.data, enc_pers_kbpk_ptr);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static int trng_ctr_drbg_random(void* notused, unsigned char* output, size_t output_len)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return ( TRNG_GetRandomData(TRNG0, output, output_len) );&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//***********************************************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In&amp;nbsp;&lt;SPAN&gt;TRNG_GetRandomData&lt;/SPAN&gt;&amp;nbsp;it hangs in the check while loop:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while ((TRNG_RD_MCTL_ENT_VAL(base) == 0) &amp;amp;&amp;amp; (TRNG_RD_MCTL_ERR(base) == 0))&lt;BR /&gt; {&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;and never gets out.&lt;BR /&gt;If I run debug one step at a time it works perfect but if it runs normal it hangs.&lt;BR /&gt; Is there a workaround for this issue ?&lt;/P&gt;&lt;P&gt;It is configured with&amp;nbsp;TRNG_Init and default config.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32_t trng_enable()&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;trng_config_t trngConfig;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;TRNG_GetDefaultConfig(&amp;amp;trngConfig);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;trngConfig.sampleMode = kTRNG_SampleModeVonNeumann;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;return (TRNG_Init(TRNG0, &amp;amp;trngConfig));&lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jan 2020 07:57:31 GMT</pubDate>
    <dc:creator>christian_niels</dc:creator>
    <dc:date>2020-01-16T07:57:31Z</dc:date>
    <item>
      <title>K81 - TRNG_GetRandomData hanging</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/K81-TRNG-GetRandomData-hanging/m-p/1020720#M3125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to get some random data from K81 hardware and I'm using&amp;nbsp;TRNG_GetRandomData from fsl_trng.c.&lt;/P&gt;&lt;P&gt;I'm using it in connection with :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//***********************************************************************************************************&lt;/P&gt;&lt;P&gt;return_code = mbedtls_rsa_rsaes_pkcs1_v15_encrypt(key, trng_ctr_drbg_random, NULL, MBEDTLS_RSA_PUBLIC, sizeof(_pers_kbpk), (const uint8_t*)&amp;amp;_pers_kbpk.data, enc_pers_kbpk_ptr);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static int trng_ctr_drbg_random(void* notused, unsigned char* output, size_t output_len)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return ( TRNG_GetRandomData(TRNG0, output, output_len) );&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//***********************************************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In&amp;nbsp;&lt;SPAN&gt;TRNG_GetRandomData&lt;/SPAN&gt;&amp;nbsp;it hangs in the check while loop:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while ((TRNG_RD_MCTL_ENT_VAL(base) == 0) &amp;amp;&amp;amp; (TRNG_RD_MCTL_ERR(base) == 0))&lt;BR /&gt; {&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;and never gets out.&lt;BR /&gt;If I run debug one step at a time it works perfect but if it runs normal it hangs.&lt;BR /&gt; Is there a workaround for this issue ?&lt;/P&gt;&lt;P&gt;It is configured with&amp;nbsp;TRNG_Init and default config.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32_t trng_enable()&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;trng_config_t trngConfig;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;TRNG_GetDefaultConfig(&amp;amp;trngConfig);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;trngConfig.sampleMode = kTRNG_SampleModeVonNeumann;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;return (TRNG_Init(TRNG0, &amp;amp;trngConfig));&lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2020 07:57:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/K81-TRNG-GetRandomData-hanging/m-p/1020720#M3125</guid>
      <dc:creator>christian_niels</dc:creator>
      <dc:date>2020-01-16T07:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: K81 - TRNG_GetRandomData hanging</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/K81-TRNG-GetRandomData-hanging/m-p/1020721#M3126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christian,&lt;/P&gt;&lt;P&gt;I can't reproduce you problem at my board. Did you try the trng example in the SDK?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jan 2020 08:36:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/K81-TRNG-GetRandomData-hanging/m-p/1020721#M3126</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2020-01-17T08:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: K81 - TRNG_GetRandomData hanging</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/K81-TRNG-GetRandomData-hanging/m-p/1020722#M3127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Jing&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;That's the funny part is I'm using"&amp;nbsp;TRNG_GetRandomData(TRNG_Type *base, void *data, size_t dataSize) " from NXP.&lt;BR /&gt;I have seen that there is a new version on github but I got the same result with that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jan 2020 13:03:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/K81-TRNG-GetRandomData-hanging/m-p/1020722#M3127</guid>
      <dc:creator>christian_niels</dc:creator>
      <dc:date>2020-01-17T13:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: K81 - TRNG_GetRandomData hanging</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/K81-TRNG-GetRandomData-hanging/m-p/1020723#M3128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If the SDK example works well, there must be some configure error in your code. For example, the clock is gated by accident or work in CPO mode. Can you share your project?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 06:28:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/K81-TRNG-GetRandomData-hanging/m-p/1020723#M3128</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2020-01-20T06:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: K81 - TRNG_GetRandomData hanging</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/K81-TRNG-GetRandomData-hanging/m-p/1020724#M3129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;Thank you but I'm sorry but I can't share the project but I have hard coded the routine to return a fixed decimal so I can get on with project but I need to solve the problem some hove.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jan 2020 08:05:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/K81-TRNG-GetRandomData-hanging/m-p/1020724#M3129</guid>
      <dc:creator>christian_niels</dc:creator>
      <dc:date>2020-01-21T08:05:31Z</dc:date>
    </item>
  </channel>
</rss>

